当前位置: 首页>>代码示例>>Java>>正文


Java JOptionPane.addPropertyChangeListener方法代码示例

本文整理汇总了Java中javax.swing.JOptionPane.addPropertyChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java JOptionPane.addPropertyChangeListener方法的具体用法?Java JOptionPane.addPropertyChangeListener怎么用?Java JOptionPane.addPropertyChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JOptionPane的用法示例。


在下文中一共展示了JOptionPane.addPropertyChangeListener方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CustomGatePrompt

import javax.swing.JOptionPane; //导入方法依赖的package包/类
public CustomGatePrompt(final JFrame frame) {
	super(frame, true);
	
	this.frame = frame;
	
	JPanel panel = new JPanel();
	panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
	
	gate_name = new TextEditor("Gate name", TextEditor.Type.SINGLE_LINE);
	panel.add(gate_name);
	
	tabbed_pane = new JTabbedPane();
	
	create_rotation_panel();
	tabbed_pane.add("Rotation", rotation_panel);
	
	create_phase_shift_panel();
	tabbed_pane.add("Phase Shift", phase_shift_panel);
	
	create_matrix_panel();
	tabbed_pane.add("Matrix", matrix_panel);
	
	tabbed_pane.addChangeListener(new TabbedPaneListener(tabbed_pane));
	panel.add(tabbed_pane);
	
	trig_selection = new AngleTypeSelection("What to represent arguments of " + 
			"trigonometric functions in?");
	panel.add(trig_selection);
	
	option_pane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_OPTION,
			null, new Object[] {"Create Gate"});
	
	setTitle("Create Custom Gate");
	setResizable(false);
	setContentPane(option_pane);
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	pack();
	
	option_pane.addPropertyChangeListener(new OKButtonListener());
}
 
开发者ID:QwertygidQ,项目名称:DeutschSim,代码行数:41,代码来源:CustomGatePrompt.java

示例2: CustomDialog

import javax.swing.JOptionPane; //导入方法依赖的package包/类
/** Creates the reusable dialog. */
public CustomDialog(Frame aFrame, String aWord, DialogDemo parent) {
    super(aFrame, true);
    dd = parent;

    magicWord = aWord.toUpperCase();
    setTitle("Quiz");

    textField = new JTextField(10);

    // Create an array of the text and components to be displayed.
    String msgString1 = "What was Dr. SEUSS's real last name?";
    String msgString2 = "(The answer is \"" + magicWord + "\".)";
    Object[] array = { msgString1, msgString2, textField };

    // Create an array specifying the number of dialog buttons
    // and their text.
    Object[] options = { btnString1, btnString2 };

    // Create the JOptionPane.
    optionPane = new JOptionPane(array, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION, null, options, options[0]);

    // Make this dialog display it.
    setContentPane(optionPane);

    // Handle window closing correctly.
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent we) {
            /*
             * Instead of directly closing the window, we're going to change
             * the JOptionPane's value property.
             */
            optionPane.setValue(new Integer(JOptionPane.CLOSED_OPTION));
        }
    });

    // Ensure the text field always gets the first focus.
    addComponentListener(new ComponentAdapter() {
        public void componentShown(ComponentEvent ce) {
            textField.requestFocusInWindow();
        }
    });

    // Register an event handler that puts the text into the option pane.
    textField.addActionListener(this);

    // Register an event handler that reacts to option pane state changes.
    optionPane.addPropertyChangeListener(this);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:51,代码来源:CustomDialog.java


注:本文中的javax.swing.JOptionPane.addPropertyChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。