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

PLAIN_MESSAGE text skewed to right in JOptionPane.show___Dialog

XMLWordPrintable

    • beta
    • x86
    • windows_nt



      Name: krT82822 Date: 12/03/98


      Cosmetic layout problem: creating a JOptionPane.showxxxDialog
      with a message type of PLAIN_MESSAGE results in a dialog with
      contents skewed to the right.


      ------------------------

      // text for PLAIN message skewed to right, apparently since space
      // reserved for optional icon, even if not used?

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;


      public class skewedMsg extends JFrame implements ActionListener
      {
         private JButton testButton;
         
         public skewedMsg()
         {
            super( "JOptionPane.showInputDialog() Test" );
            init();
         }
            
         private void init()
         {
            testButton = new JButton( "Run Test" );
            testButton.addActionListener( this );
            testButton.setActionCommand( "RUN_TEST" );
            getContentPane().add( testButton, BorderLayout.CENTER );
            
            addWindowListener( new WindowAdapter()
               {
                  public void windowClosing( WindowEvent e )
                  {
                     System.exit( 0 );
                  }
               } );

         }
         
         public void actionPerformed( ActionEvent e )
         {
            if ( e.getActionCommand().equals( "RUN_TEST" ) )
            {
               final Object message = (Object)
                              "This is an extremely tedious message...whose only " +
                                      "purpose is to fill up a lot of space in this dialog box";
                              JOptionPane.showConfirmDialog(
                                      null, message, "Title Here...",
                                      JOptionPane.YES_NO_CANCEL_OPTION,
                                      JOptionPane.PLAIN_MESSAGE);
            }
         }
          
         public static void main( String[] args )
         {
            skewedMsg frame = new skewedMsg();
            frame.pack();
            frame.setLocation( 100, 100 );
            frame.setVisible(true);
         }
      }
      (Review ID: 40277)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: