2010-12-29 4 views
0

erstellen I einen Dialog unter Verwendung JOptionPane manuell die Codes unterFehlermeldung Symbol mit PLAIN_MESSAGE Parametern auf einem Objekt JOptionPane gezeigt

JOptionPane pane = new JOptionPane(feedbackPanel, JOptionPane.YES_OPTION, JOptionPane.PLAIN_MESSAGE); 
pane.setOptions(options); 
pane.setInitialValue(options[0]); 
pane.setIcon(null); 
JDialog dialog = pane.createDialog(null, "Your feedback"); 
dialog.setLocation(contentPane.getLocation()); 
dialog.setVisible(true); 

Hinweis verwenden, die ich in JOptionPane.PLAIN_MESSAGE übergeben, wenn das Objekt JOptionPane erstellen, jedoch der Dialog zeigt weiterhin ein ERROR_MESSAGE-Symbol zusammen mit allem anderen an. Ich möchte das Icon loswerden (d. H. Kein Icon haben). Weiß jemand, wo das Problem liegt? Vielen Dank.

Antwort

2

Sie haben Ihre JOptionPane Konstruktorparameter bekam vertauscht:

JOptionPane pane = new JOptionPane(feedbackPanel, JOptionPane.PLAIN_MESSAGE, 
    JOptionPane.DEFAULT_OPTION); 

Es ist JOptionPane(message, messageType, optionType)

EDITED:

auch: option sollte für einen {DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, OK_CANCEL_OPTION}

YES_OPTION wird früher die Rückgabewerte.

+0

Hoppla ... Das erklärt! Vielen Dank! – skyork

Verwandte Themen