You are here: Wiki>AGGeom Web>JavaView>JVOwnProject>JVSliders (22 Mar 2016, saintdiz)Edit

JVSliders

You will find here information to use and manipulate the sliders

Contrary to buttons and checkboxes, sliders must be declared in the Pj class. There are a types for each sliders you may want to create. For instance, you can use "PuDouble" for a sliders of double. Then you have to initialize it twice :
  • In the Pj class constructor, you have to instantiate the slider using for instance this line :
m_[name of the slider] = new PuDouble("Step Size:", this);
The slider is now aware that he have to pass the update information with the method "update".
  • In the Pj init() method for the practical details, such as bounds, initial value, etc...

Now you have to announce the slider to your slider panel in the IP class, in the method "setParent", using this line :
m_sliderPanel.add(m_myProject.m_[slider name].getInfoPanel());

Finally, you have access to the value of the slider using the function "getValue" of the slider class, and you can handle an update of the slider state in the method update using this condition :
if(event == m_[name of the slider]) {
    //Do whatever you want
    return super.update(this);
}

Comments

 
Topic revision: r2 - 22 Mar 2016, saintdiz
 
  • Printable version of this topic (p) Printable version of this topic (p)