changeset 2334:d5b94f5b3c3a

6899453: Remove unnecessary methods from LayerUI Reviewed-by: peterz
author alexp
date Thu, 29 Apr 2010 18:56:26 +0400
parents ff11655cf75b
children 0f5ef61eea9e
files src/share/classes/javax/swing/plaf/LayerUI.java
diffstat 1 files changed, 4 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/swing/plaf/LayerUI.java	Thu Apr 29 18:38:25 2010 +0400
+++ b/src/share/classes/javax/swing/plaf/LayerUI.java	Thu Apr 29 18:56:26 2010 +0400
@@ -72,53 +72,13 @@
      * the specified {@code Graphics} object to
      * render the content of the component.
      * <p/>
-     * If {@code g} is not an instance of {@code Graphics2D},
-     * this method is no-op.
+     * The default implementation paints the passed component as is.
      *
-     * @param g the {@code Graphics} context in which to paint;
-     * @param c the component being painted;
-     * it can be safely cast to {@code JLayer<? extends V>}
-     *
-     * @see #configureGraphics(Graphics2D, JLayer)
-     * @see #paintLayer(Graphics2D, JLayer)
+     * @param g the {@code Graphics} context in which to paint
+     * @param c the component being painted
      */
     public void paint(Graphics g, JComponent c) {
-        if (g instanceof Graphics2D) {
-            Graphics2D g2 = (Graphics2D) g.create();
-            JLayer<? extends V> l = (JLayer<? extends V>) c;
-            configureGraphics(g2, l);
-            paintLayer(g2, l);
-            g2.dispose();
-        }
-    }
-
-    /**
-     * This method is called by the {@link #paint} method prior to
-     * {@link #paintLayer} to configure the {@code Graphics2D} object.
-     * The default implementation is empty.
-     *
-     * @param g2 the {@code Graphics2D} object to configure
-     * @param l the {@code JLayer} being painted
-     *
-     * @see #paintLayer(Graphics2D, JLayer)
-     */
-    protected void configureGraphics(Graphics2D g2, JLayer<? extends V> l) {
-    }
-
-    /**
-     * Called by the {@link #paint} method,
-     * subclasses should override this method
-     * to perform any custom painting operations.
-     * <p/>
-     * The default implementation paints the passed {@code JLayer} as is.
-     *
-     * @param g2 the {@code Graphics2D} context in which to paint
-     * @param l the {@code JLayer} being painted
-     *
-     * @see #configureGraphics(Graphics2D, JLayer)
-     */
-    protected void paintLayer(Graphics2D g2, JLayer<? extends V> l) {
-        l.paint(g2);
+        c.paint(g);
     }
 
     /**
@@ -628,17 +588,6 @@
     }
 
     /**
-     * Repaints all {@code JLayer} instances this {@code LayerUI} is set to.
-     * Call this method when the state of this {@code LayerUI} is changed
-     * and the visual appearance of its {@code JLayer} objects needs to be updated.
-     *
-     * @see Component#repaint()
-     */
-    protected void repaintLayer() {
-        firePropertyChange("dirty", null, null);
-    }
-
-    /**
      * Notifies the {@code LayerUI} when any of its property are changed
      * and enables updating every {@code JLayer}
      * this {@code LayerUI} instance is set to.
@@ -647,9 +596,6 @@
      * @param l the {@code JLayer} this LayerUI is set to
      */
     public void applyPropertyChange(PropertyChangeEvent evt, JLayer<? extends V> l) {
-        if ("dirty".equals(evt.getPropertyName())) {
-            l.repaint();
-        }
     }
 
     /**