程式設計工藝大師
程式代碼:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class Test
{
public static void main(String[] args)
{
JButton jbnButton1, jbnButton2;
JTextField jtfInput;
JPanel jblPanel;
JFrame jtfMainFrame;
jtfMainFrame = new JFrame("Which Button Demo");
jtfMainFrame.setSize(550,150);
jbnButton1 = new JButton("Button 1");
jbnButton2= new JButton("Button 2");
jtfInput = new JTextField(20);
JPanel jplPanel = new JPanel();
jplPanel.add(jtfInput);
jplPanel.add(jbnButton1);
jplPanel.add(jbnButton2);
jtfMainFrame.getContentPane().add(jplPanel, BorderLayout.CENTER);
jtfMainFrame.setVisible(true);
System.out.println("123");
}
}
沒有留言:
張貼留言