佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1531|回复: 1

做不出我要的JAVA GUI INTETFACE,帮帮我(已解决)

[复制链接]
发表于 13-12-2013 11:21 PM | 显示全部楼层 |阅读模式
到底我是错在哪里?各位有经验的大大可以帮我看一下救救小弟吗? 在 JTexArea加入大的column和row,解决!Output = new JTextArea(8,10);
  1. import java.awt.*;
  2. import javax.swing.*;
  3. import java.awt.event.*;

  4. public class Shakelee extends JFrame implements ActionListener {

  5.         Container pane;
  6.         String [] BranchName = {"Bangi","Kajang","Seri Kembangan"};
  7.         JLabel name,id,branch,Type,TypeP;
  8.         JTextField Fname, Fid;
  9.         JPanel p1,p2,p3,p4,p5;
  10.         JComboBox Branch;
  11.         JRadioButton Cc,Ob,Payp;
  12.         JCheckBox Ve,Vc,Omg,Alf;
  13.         JButton submit,cancel;
  14.         JTextArea Output;
  15.         
  16.         Shakelee()
  17.         {
  18.                 pane = getContentPane();
  19.                 pane.setLayout(new BorderLayout());
  20.                 pane.setBackground(Color.white);
  21.                 p1 = new JPanel();
  22.                 //p1.setLayout(new GridLayout(1,5));
  23.                 pane.add(p1,BorderLayout.NORTH);
  24.                 name = new JLabel("Name: ");
  25.                 p1.add(name);
  26.                 Fname = new JTextField(15);
  27.                 p1.add(Fname);
  28.                 id = new JLabel("ShakeLee ID ");
  29.                 p1.add(id);
  30.                 Fid = new JTextField(8);
  31.                 p1.add(Fid);
  32.                 branch = new JLabel("Branch :");
  33.                 p1.add(branch);
  34.                 Branch = new JComboBox(BranchName);
  35.                 p1.add(Branch);
  36.                 p2 = new JPanel();
  37.                 //p2.setLayout(new FlowLayout (FlowLayout.CENTER));
  38.                 Type = new JLabel("Type of Vitamin: ");
  39.                 p2.add(Type);
  40.                 Ve = new JCheckBox("Vitamin E");
  41.                 p2.add(Ve);
  42.                 Vc = new JCheckBox("Vitamin C Plus");
  43.                 p2.add(Vc);
  44.                 Omg = new JCheckBox("Omega Guard");
  45.                 p2.add(Omg);
  46.                 Alf = new JCheckBox("Alfafa");
  47.                 p2.add(Alf);
  48.                 p3 = new JPanel();
  49.                 //p3.setLayout(new FlowLayout (FlowLayout.CENTER));
  50.                 TypeP = new JLabel("Type of Payment :");
  51.                 p3.add(TypeP);
  52.                 Cc = new JRadioButton("Credit Card");
  53.                 p3.add(Cc);
  54.                 Ob = new JRadioButton("Online Banking");
  55.                 p3.add(Ob);
  56.                 Payp = new JRadioButton("Paypal");
  57.                 p3.add(Payp);
  58.                 p4 = new JPanel();
  59.                 //p4.setLayout(new FlowLayout (FlowLayout.CENTER));
  60.                 submit = new JButton("Submit");
  61.                 p4.add(submit);
  62.                 cancel = new JButton("Cancel");
  63.                 p4.add(cancel);
  64.                 p5 = new JPanel();
  65.                 p5.setLayout(new GridLayout(5,1));
  66.                 p5.add(p2,BorderLayout.NORTH);
  67.                 p5.add(p3,BorderLayout.CENTER);
  68.                 p5.add(p4,BorderLayout.SOUTH);
  69.                 Output = new JTextArea();
  70.                 pane.add(p5,BorderLayout.CENTER);
  71.                 pane.add(Output,BorderLayout.SOUTH);
  72.                
  73.         }
  74.         
  75.         public static void actionPerformed(ActionListener e)
  76.         {
  77.                
  78.         }
  79.         public static void main(String[] args) {
  80.                 // TODO Auto-generated method stub
  81.                 Shakelee frame = new Shakelee();
  82.                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  83.                 frame.setTitle("ShakeLee Order Form");
  84.                 frame.setSize(650,400);
  85.                 frame.setVisible(true);

  86.         }

  87.         @Override
  88.         public void actionPerformed(ActionEvent arg0) {
  89.                 // TODO Auto-generated method stub
  90.                
  91.         }

  92. }
复制代码
本帖最后由 shern91 于 14-12-2013 06:56 PM 编辑

功课要求的

功课要求的
output2.jpg
回复

使用道具 举报


ADVERTISEMENT

发表于 14-1-2015 12:44 PM | 显示全部楼层
你好, 请问你是JAVA Programmer 吗?

我有一个软件的问题需要帮忙, 可以面谈吗 ?
回复

使用道具 举报

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

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 22-8-2025 01:50 AM , Processed in 0.122585 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表