1.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class TEST {
public static void main(String args[])
{
JFrame jtfMainFrame = new
JFrame("Which Button Demo");
jtfMainFrame.setSize(150, 150);
JButton jbnButton1 = new
JButton("Button 1");
JButton jbnButton2 = new
JButton("Button 2");
JPanel jplPanel = new JPanel();
JTextField jtfInput = new JTextField(20);
jplPanel.add(jbnButton1);
jplPanel.add(jbnButton2);
jplPanel.add(jtfInput);
jtfMainFrame.getContentPane().add(jplPanel,
BorderLayout.CENTER);
jtfMainFrame.setVisible(true);
System.out.print("我叫tony");
}
}
2.