jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java
changeset 20168 137788883a22
parent 7668 d4a77089c587
child 23010 6dadb192ad81
equal deleted inserted replaced
20167:341d5373a64e 20168:137788883a22
    32 import javax.swing.plaf.basic.BasicInternalFrameUI;
    32 import javax.swing.plaf.basic.BasicInternalFrameUI;
    33 import java.beans.*;
    33 import java.beans.*;
    34 
    34 
    35 
    35 
    36 /**
    36 /**
    37  * Provides the Synth L&F UI delegate for
    37  * Provides the Synth L&F UI delegate for
    38  * {@link javax.swing.JInternalFrame}.
    38  * {@link javax.swing.JInternalFrame}.
    39  *
    39  *
    40  * @author David Kloba
    40  * @author David Kloba
    41  * @author Joshua Outwater
    41  * @author Joshua Outwater
    42  * @author Rich Schiavi
    42  * @author Rich Schiavi
    59     protected SynthInternalFrameUI(JInternalFrame b) {
    59     protected SynthInternalFrameUI(JInternalFrame b) {
    60         super(b);
    60         super(b);
    61     }
    61     }
    62 
    62 
    63     /**
    63     /**
    64      * @inheritDoc
    64      * {@inheritDoc}
    65      */
    65      */
    66     @Override
    66     @Override
    67     public void installDefaults() {
    67     public void installDefaults() {
    68         frame.setLayout(internalFrameLayout = createLayoutManager());
    68         frame.setLayout(internalFrameLayout = createLayoutManager());
    69         updateStyle(frame);
    69         updateStyle(frame);
    70     }
    70     }
    71 
    71 
    72     /**
    72     /**
    73      * @inheritDoc
    73      * {@inheritDoc}
    74      */
    74      */
    75     @Override
    75     @Override
    76     protected void installListeners() {
    76     protected void installListeners() {
    77         super.installListeners();
    77         super.installListeners();
    78         frame.addPropertyChangeListener(this);
    78         frame.addPropertyChangeListener(this);
    79     }
    79     }
    80 
    80 
    81     /**
    81     /**
    82      * @inheritDoc
    82      * {@inheritDoc}
    83      */
    83      */
    84     @Override
    84     @Override
    85     protected void uninstallComponents() {
    85     protected void uninstallComponents() {
    86         if (frame.getComponentPopupMenu() instanceof UIResource) {
    86         if (frame.getComponentPopupMenu() instanceof UIResource) {
    87             frame.setComponentPopupMenu(null);
    87             frame.setComponentPopupMenu(null);
    88         }
    88         }
    89         super.uninstallComponents();
    89         super.uninstallComponents();
    90     }
    90     }
    91 
    91 
    92     /**
    92     /**
    93      * @inheritDoc
    93      * {@inheritDoc}
    94      */
    94      */
    95     @Override
    95     @Override
    96     protected void uninstallListeners() {
    96     protected void uninstallListeners() {
    97         frame.removePropertyChangeListener(this);
    97         frame.removePropertyChangeListener(this);
    98         super.uninstallListeners();
    98         super.uninstallListeners();
   116         }
   116         }
   117         context.dispose();
   117         context.dispose();
   118     }
   118     }
   119 
   119 
   120     /**
   120     /**
   121      * @inheritDoc
   121      * {@inheritDoc}
   122      */
   122      */
   123     @Override
   123     @Override
   124     protected void uninstallDefaults() {
   124     protected void uninstallDefaults() {
   125         SynthContext context = getContext(frame, ENABLED);
   125         SynthContext context = getContext(frame, ENABLED);
   126         style.uninstallDefaults(context);
   126         style.uninstallDefaults(context);
   131         }
   131         }
   132 
   132 
   133     }
   133     }
   134 
   134 
   135     /**
   135     /**
   136      * @inheritDoc
   136      * {@inheritDoc}
   137      */
   137      */
   138     @Override
   138     @Override
   139     public SynthContext getContext(JComponent c) {
   139     public SynthContext getContext(JComponent c) {
   140         return getContext(c, getComponentState(c));
   140         return getContext(c, getComponentState(c));
   141     }
   141     }
   148     private int getComponentState(JComponent c) {
   148     private int getComponentState(JComponent c) {
   149         return SynthLookAndFeel.getComponentState(c);
   149         return SynthLookAndFeel.getComponentState(c);
   150     }
   150     }
   151 
   151 
   152     /**
   152     /**
   153      * @inheritDoc
   153      * {@inheritDoc}
   154      */
   154      */
   155     @Override
   155     @Override
   156     protected JComponent createNorthPane(JInternalFrame w) {
   156     protected JComponent createNorthPane(JInternalFrame w) {
   157         titlePane = new SynthInternalFrameTitlePane(w);
   157         titlePane = new SynthInternalFrameTitlePane(w);
   158         titlePane.setName("InternalFrame.northPane");
   158         titlePane.setName("InternalFrame.northPane");
   159         return titlePane;
   159         return titlePane;
   160     }
   160     }
   161 
   161 
   162     /**
   162     /**
   163      * @inheritDoc
   163      * {@inheritDoc}
   164      */
   164      */
   165     @Override
   165     @Override
   166     protected ComponentListener createComponentListener() {
   166     protected ComponentListener createComponentListener() {
   167         if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
   167         if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
   168             return new ComponentHandler() {
   168             return new ComponentHandler() {
   242      */
   242      */
   243     protected void paint(SynthContext context, Graphics g) {
   243     protected void paint(SynthContext context, Graphics g) {
   244     }
   244     }
   245 
   245 
   246     /**
   246     /**
   247      * @inheritDoc
   247      * {@inheritDoc}
   248      */
   248      */
   249     @Override
   249     @Override
   250     public void paintBorder(SynthContext context, Graphics g, int x,
   250     public void paintBorder(SynthContext context, Graphics g, int x,
   251                             int y, int w, int h) {
   251                             int y, int w, int h) {
   252         context.getPainter().paintInternalFrameBorder(context,
   252         context.getPainter().paintInternalFrameBorder(context,
   253                                                             g, x, y, w, h);
   253                                                             g, x, y, w, h);
   254     }
   254     }
   255 
   255 
   256     /**
   256     /**
   257      * @inheritDoc
   257      * {@inheritDoc}
   258      */
   258      */
   259     @Override
   259     @Override
   260     public void propertyChange(PropertyChangeEvent evt) {
   260     public void propertyChange(PropertyChangeEvent evt) {
   261         SynthStyle oldStyle = style;
   261         SynthStyle oldStyle = style;
   262         JInternalFrame f = (JInternalFrame)evt.getSource();
   262         JInternalFrame f = (JInternalFrame)evt.getSource();