package eg.ui;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JPanel;
import javax.swing.JButton;

//--Eadgyth--/
import eg.Constants;

/**
 * Defines a panel to which a component can be added
 */
public class ToolPanel {
   
   private final JPanel pnl = new JPanel(new BorderLayout());
   private final JPanel headPnl = new JPanel();
   private final JButton closeBt = new JButton(IconFiles.CLOSE_ICON);
   
   public ToolPanel() {
      pnl.setBorder(Constants.GRAY_BORDER);
   }
   
   /**
    * Adds a <code>Component</code> to this tool panel.
    * <p> The panel has a <code>BorderLayout</code> and gray border. The
    * Component is added to the center. A previously added component is
    * removed.
    *
    * @param c  the Component that is added
    */
   public void addComponent(Component c) {
      BorderLayout layout = (BorderLayout) pnl.getLayout();
      Component cCenter = layout.getLayoutComponent(BorderLayout.CENTER);
      if (cCenter != null) {
         pnl.remove(cCenter);
      }
      if (c != null) {
         pnl.add(c, BorderLayout.CENTER);
      }
      pnl.revalidate();
      pnl.repaint();
   }
   
   public JPanel panel() {
      return pnl;
   }
}
   

@@ -97,36 +97,8 @@
 nel;
-%0Aimport javax.swing.JButton;
 %0A%0A//
@@ -170,21 +170,46 @@
 h a 
-component
+variable %3Ccode%3EComponent%3C/code%3E
  can
+%0A *
  be 
@@ -313,126 +313,8 @@
 ));%0A
-   private final JPanel headPnl = new JPanel();%0A   private final JButton closeBt = new JButton(IconFiles.CLOSE_ICON);%0A
    %0A
@@ -407,40 +407,12 @@
   * 
-Adds a %3Ccode%3EComponent%3C/code%3E to
+Gets
  thi
@@ -427,121 +427,163 @@
 anel
-.
 %0A    *
- %3Cp%3E The panel has a %3Ccode%3EBorderLayout%3C/code%3E and gray border. The%0A    * Component is added to the center
+%0A    * @return  the %3Ccode%3EJPanel%3C/code%3E%0A    */%0A   public JPanel panel() %7B%0A      return pnl;%0A   %7D%0A   %0A   /**%0A    * Adds a component to this tool panel
 . A 
@@ -598,16 +598,22 @@
 ly added
+%0A    *
  compone
@@ -621,22 +621,16 @@
 t is
-%0A    *
  removed
 .%0A  
@@ -625,17 +625,16 @@
  removed
-.
 %0A    *%0A 
@@ -652,16 +652,22 @@
  c  the 
+%3Ccode%3E
 Componen
@@ -671,22 +671,15 @@
 nent
- that is added
+%3C/code%3E
 %0A   
@@ -1053,62 +1053,8 @@
   %7D%0A
-   %0A   public JPanel panel() %7B%0A      return pnl;%0A   %7D%0A
 %7D%0A  

remove unnecessary variables