本文整理汇总了Java中javax.swing.JOptionPane.NO_OPTION属性的典型用法代码示例。如果您正苦于以下问题:Java JOptionPane.NO_OPTION属性的具体用法?Java JOptionPane.NO_OPTION怎么用?Java JOptionPane.NO_OPTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.swing.JOptionPane
的用法示例。
在下文中一共展示了JOptionPane.NO_OPTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
public void save() throws IOException {
initChooser();
int ok = JOptionPane.NO_OPTION;
if( file!=null ) {
ok = JOptionPane.showConfirmDialog(
(JFrame)getTopLevelAncestor(),
"overwrite "+file.getName()+"?",
"overwrite?",
JOptionPane.YES_NO_CANCEL_OPTION);
if( ok==JOptionPane.CANCEL_OPTION) return;
chooser.setSelectedFile( file);
}
if( ok==JOptionPane.NO_OPTION) {
ok = chooser.showSaveDialog((JFrame)getTopLevelAncestor());
if( ok==chooser.CANCEL_OPTION) return;
file = chooser.getSelectedFile();
}
apply();
String type = file.getName().substring(
file.getName().indexOf(".")+1).toLowerCase();
if( !type.equals("jpg") && !type.equals("png") && !type.equals("tif")) type="jpg";
ImageIO.write( image, type, file);
}
示例2: askSave
/** Asks and attempts to save the current configuration, if it is dirty. */
boolean askSave() {
if (!isDirty()) {
return true;
}
int answer = JOptionPane.showConfirmDialog(this,
String.format("Configuration '%s' has been modified. Save changes?", getSelectedName()),
null,
JOptionPane.YES_NO_CANCEL_OPTION);
if (answer == JOptionPane.YES_OPTION) {
saveConfig();
} else if (answer == JOptionPane.NO_OPTION) {
setDirty(false);
}
return answer != JOptionPane.CANCEL_OPTION;
}
示例3: actionPerformed
@Override
public void actionPerformed(ActionEvent e)
{
if( reload.isSelected() )
{
int result = JOptionPane.showConfirmDialog(reload,
CurrentLocale.get("com.dytech.edge.admin.wizard.reloadhandler.selecting"),
CurrentLocale.get("com.dytech.edge.admin.wizard.reloadhandler.warning"), JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
if( result == JOptionPane.NO_OPTION )
{
reload.setSelected(false);
}
}
}
示例4: getSaveFileName
private File getSaveFileName() {
FileChooser fc = GameModule.getGameModule().getFileChooser();
File sf = fc.getSelectedFile();
if (sf != null) {
String name = sf.getPath();
if (name != null) {
int index = name.lastIndexOf('.');
if (index > 0) {
name = name.substring(0, index) + ".sav"; //$NON-NLS-1$
fc.setSelectedFile(new File(name));
}
}
}
if (fc.showSaveDialog(map.getView()) != FileChooser.APPROVE_OPTION)
return null;
File outputFile = fc.getSelectedFile();
if (outputFile != null &&
outputFile.exists() &&
shouldConfirmOverwrite() &&
JOptionPane.NO_OPTION ==
JOptionPane.showConfirmDialog(GameModule.getGameModule().getFrame(),
Resources.getString("Deck.overwrite", outputFile.getName()), Resources.getString("Deck.file_exists"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
JOptionPane.YES_NO_OPTION)) {
outputFile = null;
}
return outputFile;
}
示例5: getUserFeedbackForClosingProject
@Override
public ProjectCloseUserFeedback getUserFeedbackForClosingProject(String msgTitle, String msgText) {
ProjectCloseUserFeedback userFeedback = null;
int msgAnswer = JOptionPane.showConfirmDialog(Application.getMainWindow(), msgText, msgTitle, JOptionPane.YES_NO_CANCEL_OPTION);
if (msgAnswer == JOptionPane.CANCEL_OPTION) {
userFeedback = ProjectCloseUserFeedback.CancelCloseAction;
} else if (msgAnswer == JOptionPane.YES_OPTION) {
userFeedback = ProjectCloseUserFeedback.SaveProject;
} else if (msgAnswer == JOptionPane.NO_OPTION) {
userFeedback = ProjectCloseUserFeedback.DoNotSaveProject;
}
return userFeedback;
}
示例6: exitMenuItemActionPerformed
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
// int ret=showInternalOptionDialog(
// Component parent,
// Object message,
// String title,
// int optionType,
// int messageType,
// Icon icon,
// Object[] options,
// Object initialValue
// )
Object[] options = {"Yes, really exit JVM", "Just close window", "Cancel"};
int ret = JOptionPane.showOptionDialog(
getContentPane(),
"Are you sure you want to exit (this will kill JVM and thus matlab if running from within matlab)?",
"Exit biasgen?",
JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE,
null,
options,
options[1]);
if (ret == JOptionPane.YES_OPTION) {
biasgen.close();
System.exit(0);
} else if (ret == JOptionPane.NO_OPTION) {
biasgen.close();
dispose();
}
}
示例7: canGoBack
public boolean canGoBack() {
if (JOptionPane.showConfirmDialog(this, "Are you sure want to go back to start screen ?", "Back operation", JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE) == JOptionPane.NO_OPTION) {
return false;
}
//Reset della finestra principale
parent.resetScreen();
return true;
}
示例8: canGoBack
@Override
public boolean canGoBack() {
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to go back to start screen?", "Back operation", JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE) == JOptionPane.NO_OPTION) {
return false;
}
//Reset della finestra principale
parent.resetScreen();
return true;
}
示例9: canGoBack
public boolean canGoBack() {
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to go back to start screen?", "Back operation", JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE) == JOptionPane.NO_OPTION) {
return false;
}
//Reset della finestra principale
parent.resetScreen();
return true;
}
示例10: resolveUnsavedChanges
/**
* Check for unsaved changes in the Editor
*
* @return whether the situation was resolved
*/
private boolean resolveUnsavedChanges()
{
//check if any changes have not been saved
if(unsavedChanges)
{
int option = JOptionPane.showConfirmDialog(frmStringSequenceAnalyzer, "There are unsaved changes. Would you like to save?", "Save?", JOptionPane.YES_NO_CANCEL_OPTION);
switch(option)
{
case JOptionPane.YES_OPTION:
//save the contents of editorArea
save(currentBatch, editorArea.getText());
unsavedChanges = false;
break;
case JOptionPane.NO_OPTION:
//just continue with the opening procedure
break;
case JOptionPane.CANCEL_OPTION:
//back out of opening a file
return false;
}
}
return true;
}
示例11: canGoBack
@Override
public boolean canGoBack() {
if (JOptionPane.showConfirmDialog(this, "Are you sure want to go back to start screen ?", "Back operation", JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE) == JOptionPane.NO_OPTION) {
return false;
}
//Reset della finestra principale
parent.resetScreen();
return true;
}
示例12: showMessageDialog
public static boolean showMessageDialog(
final String message,
final String title,
final MessageType messageType) {
initLAF();
boolean exitInstaller = false;
switch (UiMode.getCurrentUiMode()) {
case SWING:
int intMessageType = JOptionPane.INFORMATION_MESSAGE;
LogManager.logIndent("... show message dialog");
LogManager.log("title: "+ title);
LogManager.log("message: " + message);
if (messageType == MessageType.WARNING) {
intMessageType = JOptionPane.WARNING_MESSAGE;
} else if (messageType == MessageType.CRITICAL) {
intMessageType = JOptionPane.ERROR_MESSAGE;
exitInstaller = true;
}
if (messageType == MessageType.ERROR) {
int result = JOptionPane.showOptionDialog(null,
message,
title,
JOptionPane.YES_NO_OPTION,
JOptionPane.ERROR_MESSAGE,
null,
null,
JOptionPane.YES_OPTION);
if (result == JOptionPane.NO_OPTION) {
exitInstaller = true;
LogManager.logUnindent("... user selected: NO");
} else {
LogManager.logUnindent("... user selected: YES");
}
} else {
JOptionPane.showMessageDialog(null,
message,
title,
intMessageType);
}
LogManager.logUnindent("... dialog closed");
break;
case SILENT:
LogManager.log(message);
System.err.println(message);
break;
}
return exitInstaller;
}
示例13: getBooleanDialog
public static int getBooleanDialog(Component father, String title){
int option = JOptionPane.showConfirmDialog(father,title);
if ( option == JOptionPane.YES_OPTION) { return 1;}
else if ( option == JOptionPane.NO_OPTION) { return 0;}
else{ return -1;}
}
示例14: inputName
public void inputName(){
// Initialize variables
playerName = new String[playerPos];
for(int i=0; i<playerPos; i++){
playerName[i] = "Player "+String.valueOf(i+1);
}
// Input Names
int confirm = JOptionPane.showConfirmDialog(null, "Do you want Skip Names?", "Player!", JOptionPane.YES_NO_OPTION);
if(confirm == JOptionPane.NO_OPTION){
for(int i=0; i<playerPos; i++){
try{
//do{
playerName[i] = JOptionPane.showInputDialog("Enter Name of Player "+ String.valueOf(i+1)+" :");
JOptionPane.showMessageDialog(null, playerName[i]);
// }while(playerName[i].equals(""));
}catch(Exception e){
JOptionPane.showMessageDialog(null, "Invalid name");
playerName[i] = "Player "+ String.valueOf(i+1);
}
}
}
if(playerPos == 2){
// = Integer.parseInt(JOptionPane.showInputDialog("Enter No of players"));
lblP1.setText(playerName[0]);
lblP2.setText(playerName[1]);
label_1.setVisible(false);
lblP3.setVisible(false);
p3score.setVisible(false);
label_2.setVisible(false);
lblP4.setVisible(false);
p4score.setVisible(false);
}
else if(playerPos == 3){
lblP1.setText(playerName[0]);
lblP2.setText(playerName[1]);
lblP3.setText(playerName[2]);
label_2.setVisible(false);
lblP4.setVisible(false);
p4score.setVisible(false);
}
else if(playerPos == 4){
lblP1.setText(playerName[0]);
lblP2.setText(playerName[1]);
lblP3.setText(playerName[2]);
lblP4.setText(playerName[3]);
}
}
示例15: loadGroup
public void loadGroup(final TLEGroup group, final TreeUpdateName r)
{
if( loadedGroup != null && group != null && loadedGroup.getId() == group.getId() )
{
return;
}
if( !changeDetector.hasDetectedChanges() )
{
loadDetails(group);
}
else
{
Object[] buttons = new Object[]{
CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.save"), //$NON-NLS-1$
CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.dontsave")}; //$NON-NLS-1$
int results = JOptionPane.showOptionDialog(this,
CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.savemods"), //$NON-NLS-1$
CurrentLocale.get("com.tle.admin.usermanagement.internal.groupdetailspanel.savegroup"), //$NON-NLS-1$
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, buttons, buttons[1]);
if( results == JOptionPane.NO_OPTION )
{
loadDetails(group);
}
else if( results == JOptionPane.YES_OPTION )
{
new MyGlassSwingWorker<String>(this)
{
@Override
public String doStuff()
{
return saveLoadedGroup();
}
@Override
public void finished()
{
if( r != null && loadedGroup != null )
{
r.update(loadedGroup.getName());
}
loadDetails(group);
}
}.start();
}
}
}