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


Java JOptionPane.UNINITIALIZED_VALUE屬性代碼示例

本文整理匯總了Java中javax.swing.JOptionPane.UNINITIALIZED_VALUE屬性的典型用法代碼示例。如果您正苦於以下問題:Java JOptionPane.UNINITIALIZED_VALUE屬性的具體用法?Java JOptionPane.UNINITIALIZED_VALUE怎麽用?Java JOptionPane.UNINITIALIZED_VALUE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.swing.JOptionPane的用法示例。


在下文中一共展示了JOptionPane.UNINITIALIZED_VALUE屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: propertyChange

@Override
public void propertyChange(PropertyChangeEvent ev) {
	final String prop = ev.getPropertyName();
	if (isVisible()
			&& ev.getSource() == option_pane
			&& (JOptionPane.VALUE_PROPERTY.equals(prop)
			|| JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
		if (option_pane.getValue() == JOptionPane.UNINITIALIZED_VALUE)
			return;
		option_pane.setValue(JOptionPane.UNINITIALIZED_VALUE);
		
		final Component selected_panel = tabbed_pane.getSelectedComponent();
		if (selected_panel == rotation_panel)
			create_rotation_gate();
		else if (selected_panel == phase_shift_panel) {
			create_phase_shift_gate();
		} else if (selected_panel == matrix_panel) {
			create_matrix_gate();
		} else
			throw new RuntimeException("Selected tab is not listed in the tabbed panel");
	}
}
 
開發者ID:QwertygidQ,項目名稱:DeutschSim,代碼行數:22,代碼來源:CustomGatePrompt.java

示例2: propertyChange

/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    // Let the defaultCloseOperation handle the closing if the
    // user closed the window without selecting a button (in which
    // case the new value will be null).  Otherwise, close the dialog.
    if (this.isVisible()
        && e.getSource() == pane
        && (JOptionPane.VALUE_PROPERTY.equals(e.getPropertyName())
            || JOptionPane.INPUT_VALUE_PROPERTY.equals(e.getPropertyName()))
        && e.getNewValue() != null
        && e.getNewValue() != JOptionPane.UNINITIALIZED_VALUE) {
        this.setVisible(false);
    }
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:17,代碼來源:FreeColDialog.java

示例3: propertyChange

/** This method reacts to state changes in the option pane. */
public void propertyChange(PropertyChangeEvent e) {
	String prop = e.getPropertyName();

	if (isVisible() && (e.getSource() == optionPane)
			&& (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
		Object value = optionPane.getValue();

		if (value == JOptionPane.UNINITIALIZED_VALUE) {
			//ignore reset
			return;
		}

		//Reset the JOptionPane's value.
		//If you do not do this, then if the user
		//presses the same button next time, no
		//property change event will be fired.
		optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);

		if (btnString1.equals(value)) {
			if (nolimitRB.isSelected()) {
				typedText = "unlimited";
				typedValue = 0;
				clearAndHide();
			} else {
				typedText = textField.getText();
				try {
					typedValue = Integer.parseInt(typedText);
				} catch (NumberFormatException nfe) {
					typedValue = 0;
				}
				if ((typedValue > 100000) || (typedValue < 1)) {
					//text was invalid
					textField.selectAll();
					JOptionPane.showMessageDialog(CustomDialog.this, "Sorry, '" + typedValue + "' " + "is not a valid response.\n"
							+ "Please enter a number between 1 and 100'000.", "Please try again", JOptionPane.ERROR_MESSAGE);
					typedText = null;
					typedValue = 0;
					textField.requestFocusInWindow();
				} else {
					clearAndHide();
				}
			}
		} else { //user closed dialog or clicked cancel
			typedValue = 0;
			typedText = null;
			clearAndHide();
		}
	}
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:50,代碼來源:CustomDialog.java

示例4: propertyChange

/** This method reacts to state changes in the option pane. */
public void propertyChange(PropertyChangeEvent e) {
	String prop = e.getPropertyName();

	if (isVisible() && (e.getSource() == optionPane)
			&& (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
		Object value = optionPane.getValue();

		if (value == JOptionPane.UNINITIALIZED_VALUE) {
			//ignore reset
			return;
		}

		//Reset the JOptionPane's value.
		//If you do not do this, then if the user
		//presses the same button next time, no
		//property change event will be fired.
		optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);

		if (btnString1.equals(value)) {
			if (mm1RB.isSelected()) {
				selectedMethod = "mm1";
				typedValue = 0;
				clearAndHide();
			} else if (mm1kRB.isSelected()) {
				selectedMethod = "mm1k";
				typedValue = 0;
				clearAndHide();
			}

			else {

				if (mmnRB.isSelected()) {
					selectedMethod = "mmn";
				} else if (mmnkRB.isSelected()) {
					selectedMethod = "mmnk";
				}

				try {
					typedValue = Integer.parseInt(textField.getText());
				} catch (NumberFormatException nfe) {
					typedValue = 0;
				}
				if ((typedValue > maximumServer) || (typedValue < 1)) {
					//text was invalid
					textField.selectAll();
					JOptionPane.showMessageDialog(CustomDialogMethod.this, "Sorry, '" + typedValue + "' " + "is not a valid response.\n"
							+ "Please enter a number between 2 and " + maximumServer + ".", "Please try again", JOptionPane.ERROR_MESSAGE);
					selectedMethod = null;
					typedValue = 0;
					textField.requestFocusInWindow();
				} else {
					clearAndHide();
				}
			}
		} else { //user closed dialog or clicked cancel
			typedValue = 0;
			selectedMethod = null;
			clearAndHide();
		}
	}
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:62,代碼來源:CustomDialogMethod.java

示例5: propertyChange

/** This method reacts to state changes in the option pane. */
public void propertyChange(PropertyChangeEvent e) {
    String prop = e.getPropertyName();

    if (isVisible() && (e.getSource() == optionPane)
            && (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
        Object value = optionPane.getValue();

        if (value == JOptionPane.UNINITIALIZED_VALUE) {
            // ignore reset
            return;
        }

        // Reset the JOptionPane's value.
        // If you don't do this, then if the user
        // presses the same button next time, no
        // property change event will be fired.
        optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);

        if (btnString1.equals(value)) {
            typedText = textField.getText();
            String ucText = typedText.toUpperCase();
            if (magicWord.equals(ucText)) {
                // we're done; clear and dismiss the dialog
                clearAndHide();
            } else {
                // text was invalid
                textField.selectAll();
                JOptionPane.showMessageDialog(CustomDialog.this,
                        "Sorry, \"" + typedText + "\" " + "isn't a valid response.\n" + "Please enter " + magicWord + ".",
                        "Try again", JOptionPane.ERROR_MESSAGE);
                typedText = null;
                textField.requestFocusInWindow();
            }
        } else { // user closed dialog or clicked cancel
            dd.setLabel("It's OK.  " + "We won't force you to type " + magicWord + ".");
            typedText = null;
            clearAndHide();
        }
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:41,代碼來源:CustomDialog.java

示例6: propertyChange

/** This method reacts to state changes in the option pane. */
public void propertyChange(PropertyChangeEvent e) {
	String prop = e.getPropertyName();

	if (isVisible() && (e.getSource() == optionPane)
			&& (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
		Object value = optionPane.getValue();

		if (value == JOptionPane.UNINITIALIZED_VALUE) {
			//ignore reset
			return;
		}

		//Reset the JOptionPane's value.
		//If you don't do this, then if the user
		//presses the same button next time, no
		//property change event will be fired.
		optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);

		if (btnString1.equals(value)) {
			if (nolimitRB.isSelected()) {
				typedText = "unlimited";
				typedValue = 0;
				clearAndHide();
			} else {
				typedText = textField.getText();
				try {
					typedValue = Integer.parseInt(typedText);
				} catch (NumberFormatException nfe) {
					typedValue = 0;
				}
				if ((typedValue > 100000) || (typedValue < 1)) {
					//text was invalid
					textField.selectAll();
					JOptionPane.showMessageDialog(CustomDialog.this, "Sorry, '" + typedValue + "' " + "isn't a valid response.\n"
							+ "Please enter a number between 1 and 100'000.", "Please try again", JOptionPane.ERROR_MESSAGE);
					typedText = null;
					typedValue = 0;
					textField.requestFocusInWindow();
				} else {
					clearAndHide();
				}
			}
		} else { //user closed dialog or clicked cancel
			typedValue = 0;
			typedText = null;
			clearAndHide();
		}
	}
}
 
開發者ID:HOMlab,項目名稱:QN-ACTR-Release,代碼行數:50,代碼來源:CustomDialog.java

示例7: propertyChange

/** This method reacts to state changes in the option pane. */
public void propertyChange(PropertyChangeEvent e) {
	String prop = e.getPropertyName();

	if (isVisible() && (e.getSource() == optionPane)
			&& (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
		Object value = optionPane.getValue();

		if (value == JOptionPane.UNINITIALIZED_VALUE) {
			//ignore reset
			return;
		}

		//Reset the JOptionPane's value.
		//If you don't do this, then if the user
		//presses the same button next time, no
		//property change event will be fired.
		optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);

		if (btnString1.equals(value)) {
			if (mm1RB.isSelected()) {
				selectedMethod = "mm1";
				typedValue = 0;
				clearAndHide();
			} else if (mm1kRB.isSelected()) {
				selectedMethod = "mm1k";
				typedValue = 0;
				clearAndHide();
			}

			else {

				if (mmnRB.isSelected()) {
					selectedMethod = "mmn";
				} else if (mmnkRB.isSelected()) {
					selectedMethod = "mmnk";
				}

				try {
					typedValue = Integer.parseInt(textField.getText());
				} catch (NumberFormatException nfe) {
					typedValue = 0;
				}
				if ((typedValue > maximumServer) || (typedValue < 1)) {
					//text was invalid
					textField.selectAll();
					JOptionPane.showMessageDialog(CustomDialogMethod.this, "Sorry, '" + typedValue + "' " + "isn't a valid response.\n"
							+ "Please enter a number between 2 and " + maximumServer + ".", "Please try again", JOptionPane.ERROR_MESSAGE);
					selectedMethod = null;
					typedValue = 0;
					textField.requestFocusInWindow();
				} else {
					clearAndHide();
				}
			}
		} else { //user closed dialog or clicked cancel
			typedValue = 0;
			selectedMethod = null;
			clearAndHide();
		}
	}
}
 
開發者ID:HOMlab,項目名稱:QN-ACTR-Release,代碼行數:62,代碼來源:CustomDialogMethod.java

示例8: responded

/**
 * Has this dialog been given a response.
 *
 * @return True if the dialog has a response.
 */
public synchronized boolean responded() {
    return this.pane != null
        && this.pane.getValue() != JOptionPane.UNINITIALIZED_VALUE;
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:9,代碼來源:FreeColDialog.java


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