/[classpath]/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by rabbit78, Tue Jul 12 15:06:59 2005 UTC revision 1.11 by rabbit78, Tue Jul 12 16:57:03 2005 UTC
# Line 253  public class BasicInternalFrameTitlePane Line 253  public class BasicInternalFrameTitlePane
253       */       */
254      public void propertyChange(PropertyChangeEvent evt)      public void propertyChange(PropertyChangeEvent evt)
255      {      {
256        // The title and frameIcon are taken care of during painting time.        String propName = evt.getPropertyName();
257        // The only other thing this will care about are the "is----izable"        if (propName.equals("closable"))
258        // properties. So we call enable actions to properly handle the          {
259        // buttons and menu items for us.            if (evt.getNewValue().equals(Boolean.TRUE))
260        enableActions();              closeButton.setVisible(true);
261              else
262                closeButton.setVisible(false);
263            }
264          else if (propName.equals("iconifiable"))
265            {
266              if (evt.getNewValue().equals(Boolean.TRUE))
267                iconButton.setVisible(true);
268              else
269                iconButton.setVisible(false);
270            }
271          else if (propName.equals("maximizable"))
272            {
273              if (evt.getNewValue().equals(Boolean.TRUE))
274                maxButton.setVisible(true);
275              else
276                maxButton.setVisible(false);
277            }
278            
279      }      }
280    }    }
281    
# Line 508  public class BasicInternalFrameTitlePane Line 526  public class BasicInternalFrameTitlePane
526    /** Inactive foreground color. */    /** Inactive foreground color. */
527    protected Color inactiveFGColor;    protected Color inactiveFGColor;
528    
   // FIXME: These icons need to be moved to MetalIconFactory.  
   
   /** The size of the icons in the buttons. */  
   private static final int iconSize = 16;  
   
   /** The icon displayed in the close button. */  
   protected Icon closeIcon = new Icon()  
     {  
       public int getIconHeight()  
       {  
         return iconSize;  
       }  
   
       public int getIconWidth()  
       {  
         return iconSize;  
       }  
   
       public void paintIcon(Component c, Graphics g, int x, int y)  
       {  
         g.translate(x, y);  
         Color saved = g.getColor();  
         g.setColor(Color.BLACK);  
   
         int four = iconSize / 4;  
         int six = iconSize * 6 / 16;  
         int ten = iconSize * 10 / 16;  
         int twelve = iconSize * 12 / 16;  
   
         Polygon a = new Polygon(new int[] { four, six, ten, twelve },  
                                 new int[] { six, four, twelve, ten }, 4);  
         Polygon b = new Polygon(new int[] { four, six, ten, twelve },  
                                 new int[] { ten, twelve, four, six }, 4);  
   
         g.fillPolygon(a);  
         g.fillPolygon(b);  
   
         g.setColor(saved);  
         g.translate(-x, -y);  
       }  
     };  
   
   // FIXME: Create new icon.  
   
529    /** The icon displayed in the restore button. */    /** The icon displayed in the restore button. */
530    protected Icon minIcon;    protected Icon minIcon = BasicIconFactory.createEmptyFrameIcon();
531    
532    /** The icon displayed in the maximize button. */    /** The icon displayed in the maximize button. */
533    protected Icon maxIcon = new Icon()    protected Icon maxIcon = BasicIconFactory.createEmptyFrameIcon();
     {  
       public int getIconHeight()  
       {  
         return iconSize;  
       }  
   
       public int getIconWidth()  
       {  
         return iconSize;  
       }  
   
       public void paintIcon(Component c, Graphics g, int x, int y)  
       {  
         g.translate(x, y);  
         Color saved = g.getColor();  
         g.setColor(Color.BLACK);  
   
         int four = iconSize / 4;  
         int two = four / 2;  
         int six = iconSize * 6 / 16;  
         int eight = four * 2;  
   
         g.fillRect(four, four, eight, two);  
         g.drawRect(four, six, eight, six);  
   
         g.setColor(saved);  
         g.translate(-x, -y);  
       }  
     };  
534    
535    /** The icon displayed in the iconify button. */    /** The icon displayed in the iconify button. */
536    protected Icon iconIcon = new Icon()    protected Icon iconIcon = BasicIconFactory.createEmptyFrameIcon();
     {  
       public int getIconHeight()  
       {  
         return iconSize;  
       }  
   
       public int getIconWidth()  
       {  
         return iconSize;  
       }  
   
       public void paintIcon(Component c, Graphics g, int x, int y)  
       {  
         g.translate(x, y);  
         Color saved = g.getColor();  
         g.setColor(Color.BLACK);  
   
         g.fillRect(iconSize / 4, iconSize * 10 / 16, iconSize / 2, iconSize / 8);  
   
         g.setColor(saved);  
         g.translate(-x, -y);  
       }  
     };  
537    
538    /** The JInternalFrame that this TitlePane is used in. */    /** The JInternalFrame that this TitlePane is used in. */
539    protected JInternalFrame frame;    protected JInternalFrame frame;
# Line 781  public class BasicInternalFrameTitlePane Line 703  public class BasicInternalFrameTitlePane
703    protected void createButtons()    protected void createButtons()
704    {    {
705      closeButton = new PaneButton(closeAction);      closeButton = new PaneButton(closeAction);
706        if (!frame.isClosable())
707          closeButton.setVisible(false);
708      iconButton = new PaneButton(iconifyAction);      iconButton = new PaneButton(iconifyAction);
709        if (!frame.isIconifiable())
710          iconButton.setVisible(false);
711      maxButton = new PaneButton(maximizeAction);      maxButton = new PaneButton(maximizeAction);
712        if (!frame.isMaximizable())
713          maxButton.setVisible(false);
714    }    }
715    
716    /**    /**

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26