java.awt.Component 1.0
  Point getLocation() 
   返回该组件左上角的坐标值 该值是相对于包围容器的左上角而言

解决方案 »

  1.   

    jbtn_datechoose.setBounds(new Rectangle(108, 5, 25, 20));
    jPanel1.add(jbtn_datechoose, null);这种设定方法,设定的就是对应所在的container的相对的坐标位置~~~
      

  2.   

    jButton_1.setBounds(new Rectangle(XX, XX, XX, XX));
      

  3.   

    是这样的,做了个程序, 定义了一个ButtonHandler类implements ActionListener,在actionPerformed
    中想要得到这个button的相对位置,但按照说的用getLocation也会出现异常.
    exception 的 stacktrace 中就是写着bug出在得到相对位置这一行.
    不知道为什么.
      

  4.   

    类似以下的方法:
      jbutton1.setBounds(new Rectangle(xx1,xx2,xx3,xx4)
    其中xx1和xx2是左上的坐标
    xx3和xx4是右上的坐标
      

  5.   

    类似以下的方法:
      jbutton1.setBounds(new Rectangle(xx1,xx2,xx3,xx4)
    其中xx1和xx2是左上的坐标
    xx3和xx4是右上的坐标  
    ........................应该是右下的坐标吧!
      

  6.   

    jbtn_datechoose.setBounds(new Rectangle(108, 5, 25, 20));
    jPanel1.add(jbtn_datechoose, null);这个坐标应该是相对于panel的
    为了控制用坐标表示button,可能panel的layout咬设置为null或XYLayout