JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » 違規輔導區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to postflat modego to previous topicgo to next topic
話題被移動
該話題已被移動 - koji , 2012-01-30 18:35
如果您尚不清楚該話題被移動的原因,請參考論壇規則以及本版公告或者聯系本版版主。
本主題所含的標籤
無標籤
作者 錯誤...不知為何,麻煩高手替小弟看一下了~感恩!
lonely741215

數學才是王道



發文: 196
積分: 0
於 2012-01-30 12:45 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import javax.swing.JFrame;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JLabel;
import java.awt.BorderLayout;
 
public class AMouse extends JFrame
{
  private JLabel statusBar;
  private String detail;
  public AMouse()
  {
    super("Mouse clicks and buttons");
    
    statusBar = new JLabel("Please click the mouse");
    add( statusBar, BorderLayout.SOUTH );
    addMouseListener( new MouseHandler() );
  }
  
  private class MouseHandler extends MouseAdapter
  {
    public void mouseClicked( MouseEvent event )
    {
      detail = String.format("Clicked %d time(s)", event.getClickCount() );
      
      if ( event.isMetaDown() )
        detail += "with right mouse button";
      else if ( event.isAltDown() )
        detail += "with center mouse button";
      else
        detail += "with left mouse button";
      
      statusBar.setText( detail );
    }
  }
}


1
2
3
4
5
6
7
8
9
10
11
12
import javax.swing.JFrame;
 
public class AMouseTest 
{
  public static void main(String[] args)
  {
    AMouse application = new AMouse();
    application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    application.setSize( 300, 100 );
    application.setVisible( true );
  }
}


以下是錯誤訊息,謝謝了~

java.lang.NoClassDefFoundError: Test
Caused by: java.lang.ClassNotFoundException: Test
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main"


reply to postreply to post
數學啊數學~總有一天我要狂嗑你!!
話題樹型展開
人氣 標題 作者 字數 發文時間
460 錯誤...不知為何,麻煩高手替小弟看一下了~感恩! lonely741215 1684 2012-01-30 12:45
327 Re:錯誤...不知為何,麻煩高手替小弟看一下了~感恩! FlyMaple 60 2012-01-30 13:05
336 Re:錯誤...不知為何,麻煩高手替小弟看一下了~感恩! bernardvai 86 2012-01-30 13:06
398 Re:錯誤...不知為何,麻煩高手替小弟看一下了~感恩! lonely741215 10 2012-01-30 13:31
» JWorld@TW »  違規輔導區

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8