public FloatControlPanel(final FloatControl control, int axis) { super(control); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.control = control; boolean rotary = control.isRotary(); // || axis == BoxLayout.X_AXIS; // !!! simple heuristic if (rotary) { pot = new ControlKnob(control); addMenu(); // doesn't work with JSlider } else { pot = new ControlSlider(control); } String name = abbreviate(control.getAnnotation()); JLabel label = new JLabel(name); label.setLabelFor(pot); label.setFont(font); label.setAlignmentX(0.5f); add(label); pot.setAlignmentX(0.5f); add(pot); }
protected void addMenu() { if (control.getPresetNames() == null) return; pot.setComponentPopupMenu(LawControlPresetMenu.getInstance()); }