当前位置: 首页>>代码示例>>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;未经允许,请勿转载。