Save This Page
Home » openjdk-7 » net » sf » bibkeeper » [javadoc | source]
    1   package net.sf.bibkeeper;
    2   
    3   import javax.swing;
    4   import java.awt;
    5   import java.awt.event.ActionListener;
    6   import java.awt.event.ActionEvent;
    7   import java.net.URL;
    8   
    9   public class SidePaneHeader extends JPanel implements ActionListener {
   10   
   11       private JButton close = new JButton(new ImageIcon
   12   					(GUIGlobals.closeIconFile));
   13       private JLabel nameLabel, imageIcon;
   14       private SidePaneComponent parent;
   15       private GridBagLayout gbl = new GridBagLayout();
   16       private GridBagConstraints con = new GridBagConstraints();
   17   
   18       /*
   19       public SidePaneHeader(String name, URL image, JButton button,
   20   			  JComponent parent_) {
   21          
   22   			  }*/
   23   
   24       public SidePaneHeader(String name, URL image, SidePaneComponent parent_) {
   25   	addPart(name, image, parent_);
   26   	gbl.setConstraints(close, con);
   27   	add(close);
   28       }
   29   
   30       private void addPart(String name, URL image, SidePaneComponent parent_) {
   31   	parent = parent_;
   32   	setLayout(gbl);
   33   	//imageIcon = new JLabel(new ImageIcon(image));
   34   	nameLabel = new JLabel(name, new ImageIcon(image),
   35   			       SwingConstants.LEFT);
   36   	//nameLabel.setPreferredSize(new Dimension(70, 24));
   37   	close.addActionListener(this);
   38   	close.setToolTipText("Close");
   39   	close.setPreferredSize(new Dimension(20, 20));
   40   
   41   	//setBorder(BorderFactory.createEtchedBorder());
   42   	//add(imageIcon, BorderLayout.WEST);
   43   
   44   	con.gridwidth = 1;
   45   	con.anchor = GridBagConstraints.WEST;
   46   	con.fill = GridBagConstraints.NONE;
   47   	gbl.setConstraints(nameLabel, con);
   48   	add(nameLabel);
   49   	JPanel pan = new JPanel();
   50   	con.fill = GridBagConstraints.HORIZONTAL;
   51   	con.weightx = 1;
   52   	gbl.setConstraints(pan, con);
   53   	add(pan);
   54   	con.weightx = 0;
   55   	con.fill = GridBagConstraints.NONE;
   56   	con.gridwidth = GridBagConstraints.REMAINDER;
   57       }
   58   
   59       public void actionPerformed(ActionEvent e) {
   60   	parent.hideAway(); //setVisible(false);
   61       }
   62   }

Save This Page
Home » openjdk-7 » net » sf » bibkeeper » [javadoc | source]