< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java

Print this page




  48 
  49     /**
  50      * The value {@code isPalette}
  51      */
  52     protected boolean isPalette = false;
  53 
  54     /**
  55      * The palette close icon.
  56      */
  57     protected Icon paletteCloseIcon;
  58 
  59     /**
  60      * The height of the palette title.
  61      */
  62     protected int paletteTitleHeight;
  63 
  64     private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0);
  65 
  66     /**
  67      * Key used to lookup Color from UIManager. If this is null,
  68      * <code>getWindowTitleBackground</code> is used.
  69      */
  70     private String selectedBackgroundKey;
  71     /**
  72      * Key used to lookup Color from UIManager. If this is null,
  73      * <code>getWindowTitleForeground</code> is used.
  74      */
  75     private String selectedForegroundKey;
  76     /**
  77      * Key used to lookup shadow color from UIManager. If this is null,
  78      * <code>getPrimaryControlDarkShadow</code> is used.
  79      */
  80     private String selectedShadowKey;
  81     /**
  82      * Boolean indicating the state of the <code>JInternalFrame</code>s
  83      * closable property at <code>updateUI</code> time.
  84      */
  85     private boolean wasClosable;
  86 
  87     int buttonsWidth = 0;
  88 
  89     MetalBumps activeBumps
  90         = new MetalBumps( 0, 0,
  91                           MetalLookAndFeel.getPrimaryControlHighlight(),
  92                           MetalLookAndFeel.getPrimaryControlDarkShadow(),
  93           (UIManager.get("InternalFrame.activeTitleGradient") != null) ? null :
  94                           MetalLookAndFeel.getPrimaryControl() );
  95     MetalBumps inactiveBumps
  96         = new MetalBumps( 0, 0,
  97                           MetalLookAndFeel.getControlHighlight(),
  98                           MetalLookAndFeel.getControlDarkShadow(),
  99         (UIManager.get("InternalFrame.inactiveTitleGradient") != null) ? null :
 100                           MetalLookAndFeel.getControl() );
 101     MetalBumps paletteBumps;
 102 
 103     private Color activeBumpsHighlight = MetalLookAndFeel.


 502 
 503         if (isPalette) {
 504             closeButton.setIcon(paletteCloseIcon);
 505          if( frame.isMaximizable() )
 506                 remove(maxButton);
 507             if( frame.isIconifiable() )
 508                 remove(iconButton);
 509         } else {
 510             closeButton.setIcon(closeIcon);
 511             if( frame.isMaximizable() )
 512                 add(maxButton);
 513             if( frame.isIconifiable() )
 514                 add(iconButton);
 515         }
 516         revalidate();
 517         repaint();
 518     }
 519 
 520     /**
 521      * Updates any state dependant upon the JInternalFrame being shown in
 522      * a <code>JOptionPane</code>.
 523      */
 524     private void updateOptionPaneState() {
 525         int type = -2;
 526         boolean closable = wasClosable;
 527         Object obj = frame.getClientProperty("JInternalFrame.messageType");
 528 
 529         if (obj == null) {
 530             // Don't change the closable state unless in an JOptionPane.
 531             return;
 532         }
 533         if (obj instanceof Integer) {
 534             type = ((Integer) obj).intValue();
 535         }
 536         switch (type) {
 537         case JOptionPane.ERROR_MESSAGE:
 538             selectedBackgroundKey =
 539                               "OptionPane.errorDialog.titlePane.background";
 540             selectedForegroundKey =
 541                               "OptionPane.errorDialog.titlePane.foreground";
 542             selectedShadowKey = "OptionPane.errorDialog.titlePane.shadow";




  48 
  49     /**
  50      * The value {@code isPalette}
  51      */
  52     protected boolean isPalette = false;
  53 
  54     /**
  55      * The palette close icon.
  56      */
  57     protected Icon paletteCloseIcon;
  58 
  59     /**
  60      * The height of the palette title.
  61      */
  62     protected int paletteTitleHeight;
  63 
  64     private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0);
  65 
  66     /**
  67      * Key used to lookup Color from UIManager. If this is null,
  68      * {@code getWindowTitleBackground} is used.
  69      */
  70     private String selectedBackgroundKey;
  71     /**
  72      * Key used to lookup Color from UIManager. If this is null,
  73      * {@code getWindowTitleForeground} is used.
  74      */
  75     private String selectedForegroundKey;
  76     /**
  77      * Key used to lookup shadow color from UIManager. If this is null,
  78      * {@code getPrimaryControlDarkShadow} is used.
  79      */
  80     private String selectedShadowKey;
  81     /**
  82      * Boolean indicating the state of the {@code JInternalFrame}s
  83      * closable property at {@code updateUI} time.
  84      */
  85     private boolean wasClosable;
  86 
  87     int buttonsWidth = 0;
  88 
  89     MetalBumps activeBumps
  90         = new MetalBumps( 0, 0,
  91                           MetalLookAndFeel.getPrimaryControlHighlight(),
  92                           MetalLookAndFeel.getPrimaryControlDarkShadow(),
  93           (UIManager.get("InternalFrame.activeTitleGradient") != null) ? null :
  94                           MetalLookAndFeel.getPrimaryControl() );
  95     MetalBumps inactiveBumps
  96         = new MetalBumps( 0, 0,
  97                           MetalLookAndFeel.getControlHighlight(),
  98                           MetalLookAndFeel.getControlDarkShadow(),
  99         (UIManager.get("InternalFrame.inactiveTitleGradient") != null) ? null :
 100                           MetalLookAndFeel.getControl() );
 101     MetalBumps paletteBumps;
 102 
 103     private Color activeBumpsHighlight = MetalLookAndFeel.


 502 
 503         if (isPalette) {
 504             closeButton.setIcon(paletteCloseIcon);
 505          if( frame.isMaximizable() )
 506                 remove(maxButton);
 507             if( frame.isIconifiable() )
 508                 remove(iconButton);
 509         } else {
 510             closeButton.setIcon(closeIcon);
 511             if( frame.isMaximizable() )
 512                 add(maxButton);
 513             if( frame.isIconifiable() )
 514                 add(iconButton);
 515         }
 516         revalidate();
 517         repaint();
 518     }
 519 
 520     /**
 521      * Updates any state dependant upon the JInternalFrame being shown in
 522      * a {@code JOptionPane}.
 523      */
 524     private void updateOptionPaneState() {
 525         int type = -2;
 526         boolean closable = wasClosable;
 527         Object obj = frame.getClientProperty("JInternalFrame.messageType");
 528 
 529         if (obj == null) {
 530             // Don't change the closable state unless in an JOptionPane.
 531             return;
 532         }
 533         if (obj instanceof Integer) {
 534             type = ((Integer) obj).intValue();
 535         }
 536         switch (type) {
 537         case JOptionPane.ERROR_MESSAGE:
 538             selectedBackgroundKey =
 539                               "OptionPane.errorDialog.titlePane.background";
 540             selectedForegroundKey =
 541                               "OptionPane.errorDialog.titlePane.foreground";
 542             selectedShadowKey = "OptionPane.errorDialog.titlePane.shadow";


< prev index next >