當前位置: 首頁>>代碼示例>>Java>>正文


Java JOptionPane.NO_OPTION屬性代碼示例

本文整理匯總了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);
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:23,代碼來源:ImageComponent.java

示例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;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:16,代碼來源:ConfigDialog.java

示例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);
		}
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:16,代碼來源:ReloadHandler.java

示例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;
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:30,代碼來源:Deck.java

示例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;
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:14,代碼來源:ProjectWindow.java

示例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();
           }
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:29,代碼來源:BiasgenFrame.java

示例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;
}
 
開發者ID:HOMlab,項目名稱:QN-ACTR-Release,代碼行數:9,代碼來源:InputPanel.java

示例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;
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:10,代碼來源:LoadDemoPanel.java

示例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;
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:9,代碼來源:InputPanel.java

示例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;
}
 
開發者ID:Streus,項目名稱:Project-SADS,代碼行數:31,代碼來源:MainWindow.java

示例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;
}
 
開發者ID:HOMlab,項目名稱:QN-ACTR-Release,代碼行數:10,代碼來源:LoadDemoPanel.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:55,代碼來源:UiUtils.java

示例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;}
}
 
開發者ID:asiermarzo,項目名稱:Ultraino,代碼行數:6,代碼來源:DialogUtils.java

示例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]);
    			

    		}
	
}
 
開發者ID:superiqbal7,項目名稱:Snake-Ladder,代碼行數:64,代碼來源:Main.java

示例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();
		}
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:48,代碼來源:GroupDetailsPanel.java


注:本文中的javax.swing.JOptionPane.NO_OPTION屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。