Code example for JSlider

Methods: getValue

0
     * Receives change event notification from the slider. 
     * 
     * @param event  the event. 
     */ 
    public void stateChanged(ChangeEvent event) {
        int r = this.slider.getValue();
        double angle = Math.PI * 2.0 * (r / 360.0);
        this.drawStringPanel2.setAngle(angle);
        this.drawStringPanel2.invalidate();
        this.drawStringPanel2.repaint();
    } 
 
    /** 
     * Updates the display when combo 1 is updated. 
     */ 
    private void handleCombo1Change() { 
        final String text = this.combo1.getSelectedItem().toString();
        this.drawStringPanel1.setAnchor(convertStringToAnchor(text));
        this.drawStringPanel1.invalidate();
        this.drawStringPanel1.repaint();