照着书上写个程序,可是大部分都看不太懂,咋办?

[复制链接]
查看11 | 回复1 | 2008-11-8 15:18:46 | 显示全部楼层 |阅读模式
我是java的初学者,可是感觉自己老入不了门。说学java最好能做个小项目。我照着书上自己写了个小程序,可是用jbuilder自动生成的代码,不知道为什么大部分都看不懂啊。希望有高手可以大致地给我讲解一下!好的话我再多送20分!呵呵,当然相信大家不会为了分数才答得啊!
public class Frame1 extends JFrame {
static int count=0;
JPanel contentPane;
XYLayout xYLayout1 = new XYLayout();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JTextField jTextField1 = new JTextField();
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea jTextArea1 = new JTextArea();
Construct the frame
public Frame1() {

enableEvents(AWTEvent.WINDOW_EVENT_MASK);//这个是什么?

try {

jbInit();

}

catch(Exception e) {

e.printStackTrace();

}
}
//Component initialization
private void jbInit() throws Exception{

contentPane = (JPanel) this.getContentPane();

jButton1.setFont(new java.awt.Font("Dialog", 0, 11));

jButton1.setActionCommand("文件选择");//??我看不懂这个

jButton1.setText("文件选择");

jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));

contentPane.setEnabled(false);

contentPane.setLayout(xYLayout1);

this.setSize(new Dimension(400, 300));//这个是什么意思?Dimension?

this.setTitle("example");

jButton2.setText("选择背景颜色");

jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));

jLabel1.setText("选择的文件列表");

jLabel2.setText("显示文件数目");

jTextField1.setEditable(false);

jTextField1.setText("");

jTextArea1.setText("");

contentPane.add(jLabel2, new XYConstraints(21, 241, 94, 17));

contentPane.add(jTextField1, new XYConstraints(6, 273, 276, 17));

contentPane.add(jScrollPane1,new XYConstraints(11, 49, 248, 174));

contentPane.add(jButton2, new XYConstraints(275, 153, 113, 26));

contentPane.add(jButton1, new XYConstraints(304, 100, -1, 27));

contentPane.add(jLabel1, new XYConstraints(18, 18, 100, 23));

jScrollPane1.getViewport().add(jTextArea1, null);
}

回复

使用道具 举报

千问 | 2008-11-8 15:18:46 | 显示全部楼层
找本java编程的书看看,这些都是很基础的,就窗口控件的定义和初始化...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行