1 7 8 package com.memoire.vainstall.builder.gui; 9 10 import com.memoire.vainstall.VAGlobals; 11 12 import java.awt.*; 13 14 import javax.swing.*; 15 import javax.swing.border.*; 16 import javax.swing.event.*; 17 import javax.swing.tree.*; 18 19 27 public class VAIBuilderFrame extends JFrame { 28 29 private final static Border loweredBorder = new SoftBevelBorder(BevelBorder.LOWERED); 30 private final static Border raisedBorder = new SoftBevelBorder(BevelBorder.RAISED); 31 32 JPanel allPanel; 33 34 JDesktopPane paneJDesktopPane = null; 35 36 JLabel informationLabel = new JLabel(); 37 38 public VAIBuilderFrame() { 39 super(""); 40 41 setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); 42 43 allPanel = new JPanel(new BorderLayout()); 45 46 allPanel.add(getDesktopPane(), BorderLayout.CENTER); 47 48 GridBagLayout informationLayout = new GridBagLayout(); 49 GridBagConstraints informationContraint = new GridBagConstraints(); 50 51 JPanel informationPanel = new JPanel(); 52 informationPanel.setLayout(informationLayout); 53 informationPanel.setBackground(Color.lightGray); 54 informationPanel.setBorder(raisedBorder); 55 56 informationLabel.setBorder(loweredBorder); 57 informationContraint.fill = GridBagConstraints.HORIZONTAL; 58 informationContraint.anchor = GridBagConstraints.WEST; 59 informationContraint.gridx = 0; 60 informationContraint.gridy = 0; 61 informationContraint.gridwidth = 3; 62 informationContraint.gridheight = 1; 63 informationContraint.weightx = 1; 64 informationContraint.weighty = 0; 65 informationLayout.setConstraints(informationLabel,informationContraint); 66 informationPanel.add(informationLabel); 67 68 allPanel.add(informationPanel, BorderLayout.SOUTH); 70 71 this.getContentPane().add("Center",allPanel); 73 74 } 75 76 public void center() { 77 Dimension dimScreen = Toolkit.getDefaultToolkit().getScreenSize(); 78 setLocation((dimScreen.width - this.getSize().width) / 2, 79 (dimScreen.height - this.getSize().height) / 2); 80 } 81 82 public JLabel getInformationLabel() { 83 return informationLabel; 84 } 85 86 public JDesktopPane getDesktopPane() { 87 88 if(paneJDesktopPane==null) { 89 paneJDesktopPane=new JDesktopPane(); 90 paneJDesktopPane.setBackground(Color.lightGray); 91 } 92 return paneJDesktopPane; 93 } 94 95 public void setJToolBar(JToolBar toolBar) { 96 97 JPanel toolBarPanel = new JPanel(); 98 toolBarPanel.setLayout(new BoxLayout(toolBarPanel,BoxLayout.X_AXIS)); 99 toolBarPanel.add(Box.createRigidArea(new Dimension(10,10))); 100 toolBarPanel.setBackground(Color.lightGray); 101 toolBarPanel.setBorder(raisedBorder); 102 toolBarPanel.add("Center",toolBar); 103 104 allPanel.add(toolBarPanel, BorderLayout.NORTH); 106 } 107 } 108 | Popular Tags |