controlP5 / adding listeners
in
Contributed Library Questions
•
2 years ago
Hi,
I'm currently using controlP5 in a Java/Swing/Processing application and recently I had to split the GUI into a Controller and a View. Now my Controller implements ControllerListener and I add the variables hopefully to the controller. I'm not sure if this is right:
So I'm wandering what's wrong :-/
regards,
Johannes
I'm currently using controlP5 in a Java/Swing/Processing application and recently I had to split the GUI into a Controller and a View. Now my Controller implements ControllerListener and I add the variables hopefully to the controller. I'm not sure if this is right:
- int i = 0;
for (final Slider slider : mSliders) {
slider.setGroup(ctrl);
slider.setId(i);
slider.captionLabel().toUpperCase(true);
slider.captionLabel().style().padding(4, 0, 1, 3);
slider.captionLabel().style().marginTop = -4;
slider.captionLabel().style().marginLeft = 0;
slider.captionLabel().style().marginRight = -14;
slider.captionLabel().setColorBackground(0x99ffffff);
slider.plugTo(mControl);
i++;
}
- /**
* Constructor.
*
* @param paramApplet
* {@link PApplet} instance
* @param paramControl
* {@link ISunburstControl} implementation
* @param paramDb
* {@link ReadDB} instance
*/
protected AbsSunburstGUI(final PApplet paramApplet, final ISunburstControl paramControl, final ReadDB paramDb) {
assert paramApplet != null;
assert paramControl != null;
assert paramDb != null;
mParent = paramApplet;
mControl = paramControl;
mDb = paramDb;
mZoomer = new ZoomPan(mParent);
mZoomer.setMouseMask(PConstants.CONTROL);
mControlP5 = new ControlP5(mParent);
mControlP5.addListener(mControl);
mSliders = new LinkedList<Slider>();
mRanges = new LinkedList<Range>();
mToggles = new LinkedList<Toggle>();
}
/** Initial setup of the GUI. */
protected abstract void setupGUI();
- mToggles.add(ti, getControlP5().addToggle("mShowArcs", mShowArcs, left + 0, top + posY, 15, 15));
mToggles.get(ti++).setLabel("show Arcs");
So I'm wandering what's wrong :-/
regards,
Johannes
1