예제 #1
0
  userDialog(ApplicationFrame frame, Graphic gr) {
    super(frame, "Precizati intervalul...", true);
    parentFrame = frame;
    graphic = gr;

    left = new JTextField(10);
    right = new JTextField(10);
    error = new JTextField(10);

    Object[] optionPaneComponent = {text1, left, text2, right, text3, error};
    Object[] optionPaneButtons = {button1, button2};

    optionPane =
        new JOptionPane(
            optionPaneComponent,
            JOptionPane.QUESTION_MESSAGE,
            JOptionPane.YES_NO_OPTION,
            null,
            optionPaneButtons,
            optionPaneButtons[0]);

    setContentPane(optionPane);
    pack();

    optionPane.addPropertyChangeListener(this);

    setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
    setResizable(false);
  }
예제 #2
0
 protected void installListeners() {
   if ((propertyChangeListener = createPropertyChangeListener()) != null) {
     optionPane.addPropertyChangeListener(propertyChangeListener);
   }
 }