src/share/classes/javax/swing/plaf/LayerUI.java

Print this page


   1 /*
   2  * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  43  * or any of its subcomponents.
  44  * <p>
  45  * The {@code LayerUI} differs from the UI delegates of the other components,
  46  * because it is LookAndFeel independent and is not updated by default when
  47  * the system LookAndFeel is changed.
  48  * <p>
  49  * The subclasses of {@code LayerUI} can either be stateless and shareable
  50  * by multiple {@code JLayer}s or not shareable.
  51  *
  52  * @param <V> one of the super types of {@code JLayer}'s view component
  53  *
  54  * @see JLayer#setUI(LayerUI)
  55  * @see JLayer#setView(Component)
  56  * @see JLayer#getView()
  57  * @since 1.7
  58  *
  59  * @author Alexander Potochkin
  60  */
  61 public class LayerUI<V extends Component>
  62         extends ComponentUI implements Serializable {

  63 
  64     private final PropertyChangeSupport propertyChangeSupport =
  65             new PropertyChangeSupport(this);
  66 
  67     /**
  68      * Paints the specified component.
  69      * Subclasses should override this method and use
  70      * the specified {@code Graphics} object to
  71      * render the content of the component.
  72      * <p>
  73      * The default implementation paints the passed component as is.
  74      *
  75      * @param g the {@code Graphics} context in which to paint
  76      * @param c the component being painted
  77      */
  78     public void paint(Graphics g, JComponent c) {
  79         c.paint(g);
  80     }
  81 
  82     /**


   1 /*
   2  * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  43  * or any of its subcomponents.
  44  * <p>
  45  * The {@code LayerUI} differs from the UI delegates of the other components,
  46  * because it is LookAndFeel independent and is not updated by default when
  47  * the system LookAndFeel is changed.
  48  * <p>
  49  * The subclasses of {@code LayerUI} can either be stateless and shareable
  50  * by multiple {@code JLayer}s or not shareable.
  51  *
  52  * @param <V> one of the super types of {@code JLayer}'s view component
  53  *
  54  * @see JLayer#setUI(LayerUI)
  55  * @see JLayer#setView(Component)
  56  * @see JLayer#getView()
  57  * @since 1.7
  58  *
  59  * @author Alexander Potochkin
  60  */
  61 public class LayerUI<V extends Component>
  62         extends ComponentUI implements Serializable {
  63     private static final long serialVersionUID = 654939289258160655L;
  64 
  65     private final PropertyChangeSupport propertyChangeSupport =
  66             new PropertyChangeSupport(this);
  67 
  68     /**
  69      * Paints the specified component.
  70      * Subclasses should override this method and use
  71      * the specified {@code Graphics} object to
  72      * render the content of the component.
  73      * <p>
  74      * The default implementation paints the passed component as is.
  75      *
  76      * @param g the {@code Graphics} context in which to paint
  77      * @param c the component being painted
  78      */
  79     public void paint(Graphics g, JComponent c) {
  80         c.paint(g);
  81     }
  82 
  83     /**