本帖最后由 张向辉 于 2013-1-22 11:14 编辑
package cn.itzero;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class MyJFrame extends javax.swing.JFrame {
/**
*
*/
private static final long serialVersionUID = -3597768312571563368L;
private JButton jButton1;
private JTextField jTextField1;
/**
* Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
MyJFrame inst = new MyJFrame();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
}
public MyJFrame() {
super();
initGUI();
}
private void initGUI() {
try {
getContentPane().setLayout(null);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setBackground(new java.awt.Color(0,128,64));
{
jButton1 = new JButton();
getContentPane().add(jButton1);
jButton1.setLayout(null);
jButton1.setText("\u63d0\u4ea4");
jButton1.setBounds(336, 27, 65, 28);
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
}
{
jTextField1 = new JTextField();
getContentPane().add(jTextField1);
jTextField1.setBounds(38, 26, 253, 29);
}
pack();
this.setSize(500, 400);
} catch (Exception e) {
e.printStackTrace();
}
}
int count=1;
private void jButton1ActionPerformed(ActionEvent evt) {
System.out.println(count++);
}
}
|