예제 #1
0
    public void actionPerformed(ActionEvent event) {
      String action = event.getActionCommand();
      if (action.equals(colorString)) {
        Color newColor = ColorChooser.getColor(colorTitleString, getColor());

        if (newColor != null) {
          setColor(newColor);
          currentColor = newColor;
        }

        CommandManager.getInstance().execute("RepaintWorkspace");
      } else if (action.equals(dashedString)) {
        dashed = !dashed;
        currentIsDashed = dashed;

        CommandManager.getInstance().execute("RepaintWorkspace");
      }
    }
예제 #2
0
 @Nullable
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   myValue = ((MyTableModel) table.getModel()).getRegistryValue(row);
   if (myValue.asColor(null) != null) {
     final Color color =
         ColorChooser.chooseColor(
             table, "Choose color", ((RegistryValue) value).asColor(Color.WHITE));
     if (color != null) {
       myValue.setValue(color.getRed() + "," + color.getGreen() + "," + color.getBlue());
     }
     return null;
   } else if (myValue.isBoolean()) {
     myCheckBox.setSelected(myValue.asBoolean());
     myCheckBox.setBackground(table.getBackground());
     return myCheckBox;
   } else {
     myField.setText(myValue.asString());
     myField.setBorder(null);
     myField.selectAll();
     return myField;
   }
 }