jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java
changeset 10096 f9ac9a52952d
parent 5506 202f599c92aa
child 14330 e4cb78065603
--- a/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java	Fri Jul 15 19:19:33 2011 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java	Fri Jul 15 19:23:03 2011 +0400
@@ -550,10 +550,10 @@
     /**
      * Paint the choice
      */
-    public void paint(Graphics g) {
+    @Override
+    void paintPeer(final Graphics g) {
         flush();
         Dimension size = getPeerSize();
-
         // TODO: when mouse is down over button, widget should be drawn depressed
         g.setColor(getPeerBackground());
         g.fillRect(0, 0, width, height);
@@ -912,16 +912,22 @@
         /*
          * fillRect with current Background color on the whole dropdown list.
          */
-        public void paintBackground(){
-            Graphics g = getGraphics();
-            g.setColor(getPeerBackground());
-            g.fillRect(0, 0, width, height);
+        public void paintBackground() {
+            final Graphics g = getGraphics();
+            if (g != null) {
+                try {
+                    g.setColor(getPeerBackground());
+                    g.fillRect(0, 0, width, height);
+                } finally {
+                    g.dispose();
+                }
+            }
         }
-
         /*
          * 6405689. In some cases we should erase background to eliminate painting
          * artefacts.
          */
+        @Override
         public void repaint() {
             if (!isVisible()) {
                 return;
@@ -931,8 +937,8 @@
             }
             super.repaint();
         }
-
-        public void paint(Graphics g) {
+        @Override
+        public void paintPeer(Graphics g) {
             //System.out.println("UC.paint()");
             Choice choice = (Choice)target;
             Color colors[] = XChoicePeer.this.getGUIcolors();