Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4107840

JOptionPane.showOptionDialog is painting "message" object twice

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.0.2
    • 1.1, 1.2.0
    • client-libs
    • None
    • 1.0.2
    • generic, sparc
    • solaris_2.6, solaris_9, solaris_10

      The following program shows the "pane" parameter passed into
      JOptionPane.showOptionDialog is being painted twice!

      import java.awt.*;
      import com.sun.java.swing.*;

      public class PaintTest extends JFrame
      {
         public PaintTest()
         {
            JPanel pane = new JPanel(new BorderLayout());
            JPanel titlePanel = new JPanel(new BorderLayout());
            titlePanel.add(new JLabel("Title"), "Center");
            pane.add(titlePanel, "North");

            JScrollPane scrollFilterPane =
               new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                               JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
            scrollFilterPane.setAlignmentX(JScrollPane.LEFT_ALIGNMENT);
            scrollFilterPane.setAlignmentY(JScrollPane.TOP_ALIGNMENT);

            JViewport vp = scrollFilterPane.getViewport();
            vp.add(new JPanel());
            pane.add(scrollFilterPane, "Center");

            JOptionPane.showOptionDialog(this, pane, "Title",
                                         JOptionPane.DEFAULT_OPTION,
                                         JOptionPane.PLAIN_MESSAGE, null,
                                         new Object[] {new JPanel()},
                                         null);
         }

         public static void main(String[] argv)
         {
            PaintTest dlg = new PaintTest
      ();
         }
      }

            amfowler Anne Fowler (Inactive)
            amfowler Anne Fowler (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: