We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › ControlP5 - Sliders dont work in the applet
Page Index Toggle Pages: 1
ControlP5 - Sliders dont work in the applet (Read 453 times)
ControlP5 - Sliders dont work in the applet
Feb 24th, 2009, 6:13pm
 
Im  using ControlP5 for an applet that rotates some 3D objects (P3D).  When I run the code from inside the Processing App, or, when I export to an application, everything works fine.

However, When I export to a java applet, the sliders slide and the numbers change, but the objects aren't rotating. So, I'm a bit perplexed.

As I'm new to processing, I would be appreciative of any tips or input.
Has anyone come across this before?

Thanks,
Andrew
Re: ControlP5 - Sliders dont work in the applet
Reply #1 - Feb 25th, 2009, 5:08am
 
hi, what you encounter is java security issues. see a working demo of using sliders in an applet here. the following is copied from the library page:
"export to applet. since the security regulations for applets are very high and strict, you need to make fields and functions that you control with controlP5 public in your code."

Code:

import controlP5.*;

ControlP5 controlP5;
int myColorBackground = color(0,0,0);
public int sliderValue = 100;

void setup() {
 size(400,400);
 controlP5 = new ControlP5(this);
 controlP5.addSlider("slider",100,167,128,100,160,10,100);
 controlP5.addSlider("sliderValue",0,255,12,200,200,10,100);
}

void draw() {
 background(myColorBackground);
 fill(sliderValue);
 rect(0,0,width,100);
}

public void slider(float theColor) {
 myColorBackground = color(theColor);
 println("a slider event. setting background to "+theColor);
}



hope this makes the sliders work for you.
best,
andreas

Page Index Toggle Pages: 1