1 20 21 import javax.swing.*; 22 import java.awt.*; 23 24 25 30 31 class MyStatusBar extends Box { 32 public JLabel lblObject, lblSize, lblDesc; 33 34 public MyStatusBar() { 35 super(BoxLayout.X_AXIS); 36 37 Toolkit kit = Toolkit.getDefaultToolkit(); 38 Dimension screenSize = kit.getScreenSize(); 39 40 lblObject = new JLabel("Selected Object(s):", SwingConstants.LEADING); 42 lblObject.setPreferredSize(new Dimension((int) (0.6 * screenSize.width), 43 22)); 44 lblObject.setBorder(BorderFactory.createLoweredBevelBorder()); 45 this.add(lblObject, null); 46 47 lblSize = new JLabel("Size:", SwingConstants.LEADING); 49 lblSize.setPreferredSize(new Dimension((int) (0.2 * screenSize.width), 50 22)); 51 lblSize.setBorder(BorderFactory.createLoweredBevelBorder()); 52 this.add(lblSize, null); 53 54 lblDesc = new JLabel("Description:", SwingConstants.LEADING); 56 lblDesc.setPreferredSize(new Dimension((int) (0.2 * screenSize.width), 57 22)); 58 lblDesc.setBorder(BorderFactory.createLoweredBevelBorder()); 59 this.add(lblDesc, null); 60 } 61 } 62 | Popular Tags |