showInputDialog?



  • hallo, wie kann ich die Buttonaufschrift eines InputDialogs ändern?
    ich habs zur zeit so, geht aber nicht:

    Object[] options = {"Ja", "Nein, ohne Suche starten"};
                //JOptionPane laden und die Auswahl des Users in "eingabe" speichern
                eingabe=(String)JOptionPane.showInputDialog(
                                                        JBrain.frame, 
                                                        "[Ok] >> Ja [Abbrechen] >> Nein  ", "Was wollen Sie tun?", 
                                                        JOptionPane.INFORMATION_MESSAGE,
                                                        null, 
                                                        options, 
                                                        options[0]);
    

    DANKE:-)



  • Du darfst keinen Input-Dialog aufrufen sondern einen Option-Dialog mittels showOptionDialog...



  • jaja, aber ich brauch ein inputdialog. gehts dann nicht? DANKE


  • Mod

    [ Dieser Beitrag wurde am 28.03.2003 um 12:12 Uhr von Gregor editiert. ]



  • 🙄 :o



  • was musst du denn wissen? welche taste geklickt wurde?

    Aus java api doc.

    showOptionDialog
    public static int showOptionDialog(Component parentComponent,
                                       Object message,
                                       String title,
                                       int optionType,
                                       int messageType,
                                       Icon icon,
                                       Object[] options,
                                       Object initialValue)
    Brings up a modal dialog with a specified icon, where the initial choice is dermined by the initialValue parameter and the number of choices is determined by the optionType parameter. 
    If optionType is YES_NO_OPTION, or YES_NO_CANCEL_OPTION and the options parameter is null, then the options are supplied by the Look and Feel. 
    
    The messageType parameter is primarily used to supply a default icon from the Look and Feel.
    
    Parameters:
    parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
    message - the Object to display
    title - the title string for the dialog
    optionType - an integer designating the options available on the dialog: YES_NO_OPTION, or YES_NO_CANCEL_OPTION
    messageType - an integer designating the kind of message this is, primarily used to determine the icon from the pluggable Look and Feel: ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE, QUESTION_MESSAGE, or PLAIN_MESSAGE
    icon - the icon to display in the dialog
    options - an array of objects indicating the possible choices the user can make; if the objects are components, they are rendered properly; non-String objects are rendered using their toString methods; if this parameter is null, the options are determined by the Look and Feel.
    initialValue - the object that represents the default selection for the dialog
    Returns:
    an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the Dialog
    

    Der return-Wert sagt dir schon welcher Button geklickt wurde...



  • nene, ega, habs anders gelöst:-),DANKE


Anmelden zum Antworten