home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / jfc.bin / MotifInternalFrameUI.java < prev    next >
Text File  |  1998-02-26  |  4KB  |  117 lines

  1. /*
  2.  * @(#)MotifInternalFrameUI.java    1.6 98/02/02
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.motif;
  22.  
  23. import java.awt.*;
  24. import java.awt.event.*;
  25. import com.sun.java.swing.*;
  26. import java.util.EventListener;
  27.  
  28. import com.sun.java.swing.plaf.basic.*;
  29. import com.sun.java.swing.border.*;
  30. import com.sun.java.swing.plaf.*;
  31.  
  32.  
  33. /**
  34.  * A Motif L&F implementation of InternalFrame.  
  35.  * <p>
  36.  * Warning: serialized objects of this class will not be compatible with
  37.  * future swing releases.  The current serialization support is appropriate
  38.  * for short term storage or RMI between Swing1.0 applications.  It will
  39.  * not be possible to load serialized Swing1.0 objects with future releases
  40.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  41.  * baseline for the serialized form of Swing objects.
  42.  *
  43.  * @version 1.6 02/02/98
  44.  * @author Tom Ball
  45.  */
  46. public class MotifInternalFrameUI extends BasicInternalFrameUI {
  47.  
  48.     Color color;
  49.     Color highlight;
  50.     Color shadow;
  51.     MotifInternalFrameTitlePane titlePane;
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // ComponentUI Interface Implementation methods
  55. /////////////////////////////////////////////////////////////////////////////
  56.     public static ComponentUI createUI(JComponent w)    {
  57.         return new MotifInternalFrameUI((JInternalFrame)w);
  58.     }
  59.  
  60.     public MotifInternalFrameUI(JInternalFrame w)   {
  61.         super(w);
  62.     }
  63.             
  64.     public void installUI(JComponent c)   {
  65.         super.installUI(c);
  66.         setColors((JInternalFrame)c);
  67.     }   
  68.  
  69.     public void uninstallUI(JComponent c) {             
  70.         super.uninstallUI(c);
  71.     }
  72.         
  73.     protected void installDefaults(JInternalFrame frame) {
  74.     Border frameBorder = frame.getBorder();
  75.         if (frameBorder == null || frameBorder instanceof UIResource) {
  76.             frame.setBorder(new MotifInternalFrameBorder(frame));
  77.         }    
  78.     }
  79.  
  80.     protected void uninstallDefaults(JInternalFrame frame) {
  81.         LookAndFeel.uninstallBorder(frame);
  82.     }
  83.  
  84.     public JComponent createNorthPane(JInternalFrame w) {
  85.         titlePane = new MotifInternalFrameTitlePane(w);
  86.         return titlePane;
  87.     }
  88.  
  89.     public Dimension getMaximumSize(JComponent x) {
  90.         return Toolkit.getDefaultToolkit().getScreenSize();
  91.     }
  92.     
  93.     /** This method is called when the frame becomes selected.
  94.       */
  95.     protected void activateFrame(JInternalFrame f) {
  96.         super.activateFrame(f);
  97.         setColors(f);
  98.     }
  99.     /** This method is called when the frame is no longer selected.
  100.       */
  101.     protected void deactivateFrame(JInternalFrame f) {
  102.         setColors(f);
  103.         super.deactivateFrame(f);
  104.     }
  105.  
  106.     void setColors(JInternalFrame frame) {
  107.         if (frame.isSelected()) {
  108.             color = UIManager.getColor("activeCaptionBorder");
  109.         } else {
  110.             color = UIManager.getColor("inactiveCaptionBorder");
  111.         }
  112.         highlight = color.brighter();
  113.         shadow = color.darker().darker();
  114.         titlePane.setColors(color, highlight, shadow);
  115.     }
  116. }
  117.