|
到底我是错在哪里?各位有经验的大大可以帮我看一下救救小弟吗? 在 JTexArea加入大的column和row,解决! Output = new JTextArea(8,10);- import java.awt.*;
- import javax.swing.*;
- import java.awt.event.*;
- public class Shakelee extends JFrame implements ActionListener {
- Container pane;
- String [] BranchName = {"Bangi","Kajang","Seri Kembangan"};
- JLabel name,id,branch,Type,TypeP;
- JTextField Fname, Fid;
- JPanel p1,p2,p3,p4,p5;
- JComboBox Branch;
- JRadioButton Cc,Ob,Payp;
- JCheckBox Ve,Vc,Omg,Alf;
- JButton submit,cancel;
- JTextArea Output;
-
- Shakelee()
- {
- pane = getContentPane();
- pane.setLayout(new BorderLayout());
- pane.setBackground(Color.white);
- p1 = new JPanel();
- //p1.setLayout(new GridLayout(1,5));
- pane.add(p1,BorderLayout.NORTH);
- name = new JLabel("Name: ");
- p1.add(name);
- Fname = new JTextField(15);
- p1.add(Fname);
- id = new JLabel("ShakeLee ID ");
- p1.add(id);
- Fid = new JTextField(8);
- p1.add(Fid);
- branch = new JLabel("Branch :");
- p1.add(branch);
- Branch = new JComboBox(BranchName);
- p1.add(Branch);
- p2 = new JPanel();
- //p2.setLayout(new FlowLayout (FlowLayout.CENTER));
- Type = new JLabel("Type of Vitamin: ");
- p2.add(Type);
- Ve = new JCheckBox("Vitamin E");
- p2.add(Ve);
- Vc = new JCheckBox("Vitamin C Plus");
- p2.add(Vc);
- Omg = new JCheckBox("Omega Guard");
- p2.add(Omg);
- Alf = new JCheckBox("Alfafa");
- p2.add(Alf);
- p3 = new JPanel();
- //p3.setLayout(new FlowLayout (FlowLayout.CENTER));
- TypeP = new JLabel("Type of Payment :");
- p3.add(TypeP);
- Cc = new JRadioButton("Credit Card");
- p3.add(Cc);
- Ob = new JRadioButton("Online Banking");
- p3.add(Ob);
- Payp = new JRadioButton("Paypal");
- p3.add(Payp);
- p4 = new JPanel();
- //p4.setLayout(new FlowLayout (FlowLayout.CENTER));
- submit = new JButton("Submit");
- p4.add(submit);
- cancel = new JButton("Cancel");
- p4.add(cancel);
- p5 = new JPanel();
- p5.setLayout(new GridLayout(5,1));
- p5.add(p2,BorderLayout.NORTH);
- p5.add(p3,BorderLayout.CENTER);
- p5.add(p4,BorderLayout.SOUTH);
- Output = new JTextArea();
- pane.add(p5,BorderLayout.CENTER);
- pane.add(Output,BorderLayout.SOUTH);
-
- }
-
- public static void actionPerformed(ActionListener e)
- {
-
- }
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Shakelee frame = new Shakelee();
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setTitle("ShakeLee Order Form");
- frame.setSize(650,400);
- frame.setVisible(true);
- }
- @Override
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
- }
复制代码 本帖最后由 shern91 于 14-12-2013 06:56 PM 编辑
|
-
功课要求的
-
|