public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (source == unitXSlider) { ux = source.getValue(); graph.setUnityX(ux); } else { uy = source.getValue(); graph.setUnityY(uy); } }
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) return; optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE); if (button1.equals(value)) { try { double a = Double.parseDouble(left.getText()); double b = Double.parseDouble(right.getText()); double err = Double.parseDouble(error.getText()); if (a > b) { JOptionPane.showMessageDialog(this, "A < B!!!", null, JOptionPane.ERROR_MESSAGE); } else { hideIt(); graphic.startApplyingMethod(parentFrame.getSelectedMethod(), err, a, b); } } catch (Exception ex) { JOptionPane.showMessageDialog( this, "Trebuie sa fie numar real!", null, JOptionPane.ERROR_MESSAGE); } } else if (button2.equals(value)) { hideIt(); } } }
public void componentResized(ComponentEvent e) { Dimension dim = getSize(); dim.height -= 75; dim.width -= 50; graph.setDimensions(dim); }