想将jdialog中的一个button光标设置成手状,但是用jButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR))没有反应,给整个jdilog设置鼠标样式是可以的,但那样整个dialog(里面还有label和text)都会变成手状鼠标,而我只要里面的button是鼠标样的,能弄么? 看了下component里的setCursor的说明,不是很理解~button不是Component么而且不是visible, displayable, and enabled么,为什么不行 ?另外如果不能弄的话,那能在一个jframe下的按钮事件触发时产生一个新的jframe而不是jdialog么?

解决方案 »

  1.   

    jframe当然能生成新的jframe...而我在JDialog里设置jButton的鼠标样式没什么问题...- -!
    并且用的还是你的代码
      

  2.   

    jframe怎么生成jframe啊,比如想在button里生成TJFrameB,jButton.addMouseListener(new MouseAdapter(){public void mouseClicked(MouseEvent e){??}});在??里输入什么代码?TJFrame().show()么?还有我的jdialog是通过jframe里的button产生的窗口,好像不能改鼠标样式啊?而且我在sun的bugdatabase里看到有个说JDialog doesn't respect setCursor (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5079694),是不是在jdk1.6里修复好了,还是什么的,我这个是jdk1.5的~
      

  3.   

    貌似我在jdialog中设置都生成不了,jframe怎么产生jframe已经知道了~~