在这里插入代码片
工程纲领
商品面板
public static void createGoodsPanel() {//产生商品版面
goodsPanel=new JPanel();
JTabbedPane tabpane = new JTabbedPane(JTabbedPane.TOP);
HamburgerPanel hamP = new HamburgerPanel();
FriedChickenPanel chickP = new FriedChickenPanel();
RefreshmentsPanel refreshP= new RefreshmentsPanel();
DrinkPanel drinkP= new DrinkPanel();
ComboPanel comboP =new ComboPanel();
tabpane.add("汉堡",hamP);
tabpane.add("炸鸡",chickP);
tabpane.add("小食",refreshP);
tabpane.add("饮料",drinkP);
tabpane.add("套餐",comboP);
goodsPanel.setLayout(new GridLayout(1, 1));
tabpane.setSelectedIndex(1);
goodsPanel.add(tabpane);
}
效果如下
结账面板
checkOutPanel=new JPanel();
checkOutPanel.setLayout(null);
ta=new TextArea("",0,0);
ta.setSize(380, 500);
ta.setEditable(false);
//ta.setLineWrap(true);
if(ta!=null) {
timer.schedule(new TimerTask() {
public void run() {
ta.setText(show());
}
},20,100);
}
JButton ok=new JButton("结账");
ButtonGroup bg =new ButtonGroup();
JRadioButton tt1yuan = new JRadioButton("天天一元");
tt1yuan.setBackground(Color.white);
JRadioButton manjian = new JRadioButton("满减");
manjian.setBackground(Color.white);
JLabel youhuiLabel= new JLabel("优惠:");
youhuiLabel.setBounds(100, 550, 80, 25);
checkOutPanel.add(youhuiLabel);
tt1yuan.setBounds(100, 600, 80, 25);
manjian.setBounds(100, 650, 80, 25);
bg.add(tt1yuan);
bg.add(manjian);
checkOutPanel.add(tt1yuan);
checkOutPanel.add(manjian);