showOptionDialog « JOptionPane « Java Swing Q&A





1. How to show scrollbar in Swing's JOptionPane.showOptionDialog?    stackoverflow.com


In our Swing application, we show error messages using JOptionPane.showOptionDialog. However, some of the messages are long and we would like to limit the height of the dialog and show a ...

2. Closing a dialog created by JOptionPane.showOptionDialog()    stackoverflow.com

I am creating an options dialog using JOptionPane.showOptionDialog(...); For the options parameter I am passing an array of JButtons each with its own ActionListener. One of these buttons is responsible for closing the ...

3. JOptionPane.showOptionDialog does not always move to front in Applet    stackoverflow.com

I have a JOptionPane popup in my applet normally, a-la:

      Object[] options = {"Grade", "Save", "Cancel"};
      selection = JOptionPane.showOptionDialog(this,
   ...

4. how to listen to Enter button when using JOptionPane.showOptionDialog    stackoverflow.com

I use:

        char[] password = null;
    JPasswordField jpf = new JPasswordField(30);
    java.lang.Object [] messageInput = { prompt, jpf ...

5. Setting component focus in JOptionPane.showOptionDialog()    stackoverflow.com

In order to have custom button captions in an input dialog, I created the following code:

String key = null;
JTextField txtKey = new JTextField();        
int ...

6. JOptionPane.showOptionDialog shows no buttons?    stackoverflow.com

The following code shows a dialog as expected, apart from having no buttons:

  final JPasswordField passwdField = new JPasswordField();
  passwdField.setColumns(20);
  final JComponent[] inputs = new JComponent[] { ...

7. How to specify size for a JOptionpane showOptionDialog    coderanch.com

Hi I am using JOptionpane showOptionDialog to show the confirmation vales entered ina screen and providing 2 butons ok and cancel. i am using GridLAyout to display the field names and values. I am able to display all the information but i want to increase the size of the frame. Is it possible to do. Regards Kiran

8. JOptionPane.ShowOptionDialog not blocking properly    coderanch.com

I'm having a problem with Swing not quite behaving as I think it should, and any help from any Swing gurus out there would be appreciated. here's excerpts from my code: public synchronized void actionPerformed(ActionEvent event) { if (event.getSource() == Competitor_entry_field) { [a couple levels of function calls omitted] int item_selected = JOptionPane.showOptionDialog ( this, question_string, "Seed mark?", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, ...

9. JOptionPane.showOptionDialog    coderanch.com

Hey guys. I'm having trouble understanding the concept of this command. I'm creating a small game. Here's what I need to do. 1) Have a user specify how many players (2-4) 2) Have the user create names, or custom strings, for each player 3) Sort the names in an array 4) Create a dialog box that throws up the names and ...





11. JOptionPane.showOptionDialog(null....) does not show up the dialog at all.    java-forums.org

Hello guys, I used JOptionPane.showOptionDialog(null,....). Null as first parameter indicates that the parent for this dialog is not known. My question here is if I run the code from eclipse, sometime I see the dialog coming under the main window and sometimes over the main window of my application (centered). However, if I run the application from release build (Made local ...

12. JOptionPane.showOptionDialog    java-forums.org

public class Exit { private static Main mainfile = new Main(); private static MenuBar menubar = new MenuBar(); public void onexit() { if (mainfile.fn.equals("unnamed")) { Object[] options = { "YES", "NO", "CANCEL"}; int response = JOptionPane.showOptionDialog(null, "Do you want to save " + mainfile.fn + "?", "Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); switch (response) { case 0: menubar.saveas(); case 1: case ...

13. Help with closing JOptionPane.showOptionDialog    java-forums.org

I wouldn't add any buttons to the array that you pass into your JOptionPane. Rather create an array of String and then do actions based on the int returned from the JOptionPane. The int will either be an int corresponding to the array index of the button pushed or else it will be == to the JOption.CLOSED_OPTION constant if the user ...

14. JOptionpane.showOptionDialog help    forums.oracle.com