Java problem

Discussion in 'OT Technology' started by machine, Mar 23, 2004.

  1. machine

    machine Welcome to the Machine OT Supporter

    Joined:
    Oct 23, 2003
    Messages:
    8,977
    Likes Received:
    0
    Location:
    DSotM
    I've got a program using the class JOptionPane. Everything is fine, except for the fact that my main program is running on a command line interface, and when I have the JOptionPane boxes show up, sometimes they are hidden behind the main command line window. The only way to realize they are even there is to draw the main window out of the way. Does anyone know any way I can make it appear 'on top' of the command line window whenever it gets called?

    Thanks a lot for the help!
    By the way, the code for this particular section of my class is here:
    (and if anyone can figure out how to avoid having the numbers infront of the data fields such as "2 Street", i'd really appreciate it.)


    try
    {
    Object[] selections = {"0 First Name", "1 House/Apartment Number",
    "2 Street", "3 City", "4 Province", "5 Country", "6 Postal Code", "7 Phone Number",
    "8 E-Mail Address", "9 Birthday"};

    char choice = ((String)JOptionPane.showInputDialog(getParent(),"Select field to edit.","Edit",
    JOptionPane.PLAIN_MESSAGE, null, selections, selections[0])).charAt(0);
    String data = JOptionPane.showInputDialog(null, "Enter new data for " +
    selections[Character.digit(choice, 10)]);
    switch(choice)
    {
    case '0': firstName = data;
    break;
    case '1': houseNumber = data;
    break;
    case '2': street = data;
    break;
    case '3': city = data;
    break;
    case '4': province = data;
    break;
    case '5': country = data;
    break;
    case '6': postalCode = data;
    break;
    case '7': phone = data;
    break;
    case '8': email = data;
    break;
    case '9': birthday = data;
    break;
    default: break;
    }
    }
    catch(Exception e)
    {
    }
     
  2. shinigami24

    shinigami24 New Member

    Joined:
    Sep 22, 2002
    Messages:
    164
    Likes Received:
    0
    Location:
    South Florida
    hmm everything looks fine
    could it be that the command line windows has an option to be on top of everything?
     

Share This Page