初学jbiulder的一个问题

woshishui11121113 2003-08-30 09:53:28
jButton1.setBounds(new Rectangle(173, 209, 79, 29));


为什么编译时总是说"test.java": Error #: 300 : class Rectangle not found in class testhello.test at line 31, column 28
...全文
37 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
woshishui11121113 2003-08-30
  • 打赏
  • 举报
回复
源代码如下

package testhello;

import javax.swing.*;
import java.awt.event.*;


/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/

public class test extends JComponent {
private JButton jButton1 = new JButton();

public test() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
test test1 = new test();
}
private void jbInit() throws Exception {
jButton1.setBounds(new Rectangle(173, 209, 79, 29));
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
this.add(jButton1, null);
}

void jButton1_actionPerformed(ActionEvent e) {

}
}
Wnyu 2003-08-30
  • 打赏
  • 举报
回复
同意楼上
bigbigstone 2003-08-30
  • 打赏
  • 举报
回复
import java.awt.*;
import javax.swing.*;
noratong 2003-08-30
  • 打赏
  • 举报
回复
把原代码贴出来看一下!
woshishui11121113 2003-08-30
  • 打赏
  • 举报
回复
up

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧