Beispiel #1
0
  public static String getNewFileInSandbox(Frame f, String a) {

    List namesvector = getFileList(a);

    JComboBox combobox = new JComboBox(RiskUtil.asVector(namesvector));

    // Messages
    Object[] message =
        new Object[] {TranslationBundle.getBundle().getString("core.error.applet"), combobox};

    // Options
    String[] options = {"OK", "Cancel"};

    int result =
        JOptionPane.showOptionDialog(
            f, // the parent that the dialog blocks
            message, // the dialog message array
            "select " + a, // the title of the dialog window
            JOptionPane.OK_CANCEL_OPTION, // option type
            JOptionPane.QUESTION_MESSAGE, // message type
            null, // optional icon, use null to use the default icon
            options, // options string array, will be made into buttons
            options[0] // option that should be made into a default button
            );

    if (result == JOptionPane.OK_OPTION) {
      return combobox.getSelectedItem() + "";
    }

    return null;
  }