Ejemplo n.º 1
0
 public void zoneModelChanged(ZoneModelEvent event) {
   if ((!isStuck()) && model.containsPoint(index)) {
     add(unstickButton);
     revalidate();
     repaint();
   } else if (isStuck() && !model.containsPoint(index)) {
     remove(unstickButton);
     revalidate();
     repaint();
   }
 }
Ejemplo n.º 2
0
  Spacer(ZoneModel model, int index, SpacerHandle knobHandle) {
    this.model = model;
    this.index = index;
    this.knobHandle = knobHandle;

    knobPainter = new KnobPainter(this);

    setOpaque(false);
    setCursor(SliderCursor);

    initKeyMaps();

    Icon icon = getIcon("unstick");
    Icon pressedIcon = getIcon("unstickPressed");
    Icon highlightIcon = getIcon("unstickHighlight");
    unstickButton = new JButton(icon);
    unstickButton.setSize(icon.getIconWidth(), icon.getIconHeight());
    unstickButton.setPressedIcon(pressedIcon);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setRolloverIcon(highlightIcon);
    unstickButton.setBorder(null);
    unstickButton.putClientProperty(SubstanceLookAndFeel.BUTTON_PAINT_NEVER_PROPERTY, Boolean.TRUE);
    unstickButton.setBorderPainted(false);
    unstickButton.setRolloverEnabled(true);
    unstickButton.setOpaque(false);
    unstickButton.setCursor(ClickCursor);
    unstickButton.setFocusable(false);
    unstickButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            Spacer.this.model.removePoint(Spacer.this.index);
          }
        });
    if (model.containsPoint(index)) {
      add(unstickButton);
    }
    model.addZoneModelListener(this);

    setFocusable(true);
    addFocusListener(this);
    addMouseListener(this);
  }
Ejemplo n.º 3
0
 void updateModel() {
   double value = ComponentScaler.componentToScale(this, SpacerHeight / 2);
   model.setPoint(index, value);
 }