日期:2014-05-20 浏览次数:20728 次
JPanel panel = new JPanel();
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
panel.setSize(new Dimension((int) screen.getWidth(), (int) (screen.getHeight() - 37 - 46)));
panel.setOpaque(true);
JPanel labelPanel = new JPanel();
labelPanel.setLayout(new BorderLayout());
labelPanel.setOpaque(true);
JLabel labelLeft = new JLabel();
labelLeft.setOpaque(true);
labelLeft.setBackground(Color.BLACK);
labelLeft.setForeground(Color.WHITE);
labelLeft.setText("22222");
JLabel labelRight = new JLabel();
labelRight.setOpaque(true);
labelRight.setBackground(Color.BLACK);
labelRight.setForeground(Color.WHITE);
labelRight.setText("333333");
labelPanel.add(labelLeft, BorderLayout.WEST);
labelPanel.add(labelRight, BorderLayout.EAST);
panel.add(labelPanel, BorderLayout.SOUTH);
// getContentPane().add(panel, BorderLayout.CENTER);
getContentPane().add(labelPanel, BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(label1);
box.add(Box.createHorizontalGlue());
box.add(lable2);