-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2
-
generic
-
generic
Name: krT82822 Date: 06/21/99
For the Motif Look&Feel there is too much white space under the
button row for the JOptionPane's showXXXDialog windows. The
extra white space gives the dialog windows a "bloated" appearance.
It turns out the extra white space only shows up if the message
string being displayed has an empty line in it.
// ============ REVISED TEST CASE AND USER COMMENTS ====================================
One of us needs his vision checked (imho). I've changed the testcase so
it will be even more apparent there are layout bugs with the Motif LF.
This time I've emulated the exit dialog you get when exiting the CDE
desktop. I hope you have access to a machine running CDE, because
without it you really can't judge the problem. I have an NT box running
JDK1.2.2rc1 right next to a Solaris system running CDE. I run the
program included below and also click on the "EXIT" button on CDE's
workspace panel. It's real obvious where the padding/spacing problems
are in the JOptionPane.
//~~~~~~~~~~~~~~~~~~~~~~~ new program to run ~~~~~~~~~~~~~~~~~~~~~~~~~
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class msgbox extends JFrame {
public static void main (String args[]) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
} catch (Exception e) {e.printStackTrace();}
String msg = "Exiting the desktop session...\n\n" +
"Application updates you have not saved will be lost\n\n" +
"Your current session will be saved and returned to\n" +
"upon your next login. For more details select Help.\n\n" +
"Items in the Trash Can will be permanently shredded.\n\n" +
"Continue Logout?";
Object[] options = {"OK", "Cancel", "Help"};
JOptionPane.showOptionDialog(null, msg, "Logout Confirmation",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE,
null, options, options[0]
);
System.exit(0);
}
}
//~~~~~~~~~~~~~~~~~~~~~~~ END OF PROGRAM ~~~~~~~~~~~~~~~~~~~~~~~
Please let me know if it isn't readily apparent that there is a bug in
the amount of spacing being used in the JOptionPane's implementation of
the Motif LF. Here's a hint - look at the padding to the left of the
"OK" button, to the right of the "Help" button and the padding below all
three buttons. Remember you need to compare this to how it appears under
CDE.
Thanks,
John
// ============ ORIGINAL TEST CASE ====================================
The following code can be used to see the problem. Do the following
after compiling:
1. java -cp . msgbox "hello world" <<< THINGS LOOK OK
2. java -cp . msgbox "hello
world" <<< THIS STILL LOOK OK
3. java -cp . msgbox "hello
world" <<< NOW THERE'S TOO MUCH WHITE SPACE
//~~~~~~~~~~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class msgbox extends JFrame {
public static void main (String args[]) {
String msg = null;
if (args.length != 1) {
System.out.println("USAGE: java -cp . msgbox <message_text>");
System.exit(1);
} else
msg = new String(args[0]);
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
} catch (Exception e) {e.printStackTrace();}
JOptionPane.showMessageDialog(new msgbox(), msg);
System.exit(0);
}
}
(Review ID: 52500)
======================================================================
- duplicates
-
JDK-4202506 Motif version of JOptionPane has layout problems with button row
-
- Resolved
-