Пример #1
0
  public LineBorderEditor() {

    initialize();

    color = new ColorHolder();
    setCaption(getEditorLocaleString("Line"));
    assignValueToParameters();

    rounded = new JCheckBox(getEditorLocaleString("Rounded_corners"));
    rounded.setSelected(roundedCorners);
    rounded.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            roundedCorners = rounded.isSelected();
            fireChange();
          }
        });

    thickModel = new SpinnerNumberModel(thickness, MIN_THICK, MAX_THICK, 1);
    SpinPane thickPane = new SpinPane(thickModel, getEditorLocaleString("Thickness"));
    thickModel.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            thickness = thickModel.getNumber().intValue();
            fireChange();
          }
        });

    JButton bColor = new JButton(getEditorLocaleString("Color"));
    ColorChooseAction colorChooseAction =
        new ColorChooseAction(color, getEditorLocaleString("Color"), this);
    colorChooseAction.addPropertyChangeListener(this);
    bColor.addActionListener(colorChooseAction);

    setLayout(new BorderLayout());
    JPanel pane = new JPanel(new GridLayout(1, 2));
    pane.add(getCenteredPane(rounded));
    pane.add(getCenteredPane(thickPane));
    JPanel paneTotal = new JPanel(new GridLayout(2, 1));
    paneTotal.add(pane);
    paneTotal.add(getCenteredPane(bColor));
    add(paneTotal, BorderLayout.NORTH);

    refreshInterface();
  }
Пример #2
0
 public void refreshInterface() {
   assignValueToParameters();
   rounded.setSelected(roundedCorners);
   thickModel.setValue(new Integer(thickness));
 }