Ejemplo n.º 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();
  }
Ejemplo n.º 2
0
  public EtchedBorderEditor() {

    initialize();

    highlight = new ColorHolder();
    shadow = new ColorHolder();

    setCaption(getEditorLocaleString("Etched"));
    assignValueToParameters();

    selType = new RiseLowPanel(etchType, EtchedBorder.RAISED, EtchedBorder.LOWERED);
    selType.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            etchType = selType.getType();
            fireChange();
          }
        });

    JButton bHigh = new JButton(getEditorLocaleString("Highlight"));
    ColorChooseAction colorChooseAction =
        new ColorChooseAction(highlight, getEditorLocaleString("Highlight"), this);
    colorChooseAction.addPropertyChangeListener(this);
    bHigh.addActionListener(colorChooseAction);

    JButton bShadow = new JButton(getEditorLocaleString("Shadow"));
    colorChooseAction = new ColorChooseAction(shadow, getEditorLocaleString("Shadow"), this);
    colorChooseAction.addPropertyChangeListener(this);
    bShadow.addActionListener(colorChooseAction);

    setLayout(new BorderLayout());
    JPanel totalPane = new JPanel(new GridLayout(2, 1));
    totalPane.add(selType);
    JPanel buttonPane = new JPanel(new GridLayout(1, 2));
    buttonPane.add(getCenteredPane(bHigh));
    buttonPane.add(getCenteredPane(bShadow));
    totalPane.add(buttonPane);
    add(totalPane, BorderLayout.NORTH);

    refreshInterface();
  }