/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * HSBControl.java
 *
 * Created in 2013.
 */

package webcamstudio.sources.effects.controls;

import webcamstudio.sources.effects.WaterFx;

/**
 *
 * @author karl
 */
public class WaterFxControl extends javax.swing.JPanel {

    WaterFx effect = null;
    /** Creates new form MosaicControl
     * @param effect */
    public WaterFxControl(WaterFx effect) {
        initComponents();
        this.effect=effect;
        sliderRadius.setValue((int)effect.getRadius());
        sliderAmplitude.setValue((int)effect.getAmplitude());
        sliderWavelength.setValue((int)effect.getWavelength());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        sliderRadius = new javax.swing.JSlider();
        sliderAmplitude = new javax.swing.JSlider();
        sliderWavelength = new javax.swing.JSlider();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        setPreferredSize(new java.awt.Dimension(250, 108));

        sliderRadius.setMaximum(320);
        sliderRadius.setMinimum(1);
        sliderRadius.setMinorTickSpacing(20);
        sliderRadius.setPaintLabels(true);
        sliderRadius.setPaintTicks(true);
        sliderRadius.setName("sliderRadius"); // NOI18N
        sliderRadius.setOpaque(true);
        sliderRadius.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                sliderRadiusStateChanged(evt);
            }
        });

        sliderAmplitude.setMaximum(5);
        sliderAmplitude.setMinimum(1);
        sliderAmplitude.setMinorTickSpacing(1);
        sliderAmplitude.setPaintLabels(true);
        sliderAmplitude.setPaintTicks(true);
        sliderAmplitude.setName("sliderAmplitude"); // NOI18N
        sliderAmplitude.setOpaque(true);
        sliderAmplitude.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                sliderAmplitudeStateChanged(evt);
            }
        });

        sliderWavelength.setMaximum(200);
        sliderWavelength.setMinimum(1);
        sliderWavelength.setMinorTickSpacing(20);
        sliderWavelength.setPaintLabels(true);
        sliderWavelength.setPaintTicks(true);
        sliderWavelength.setName("sliderWavelength"); // NOI18N
        sliderWavelength.setOpaque(true);
        sliderWavelength.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                sliderWavelengthStateChanged(evt);
            }
        });

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel1.setText("Radius");
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText("Amplitude");
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel3.setText("Wavelength");
        jLabel3.setName("jLabel3"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(sliderWavelength, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(sliderAmplitude, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(sliderRadius, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(sliderRadius, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(sliderAmplitude, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(sliderWavelength, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addGap(6, 6, 6))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void sliderRadiusStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sliderRadiusStateChanged
        effect.setRadius(sliderRadius.getValue());
    }//GEN-LAST:event_sliderRadiusStateChanged

    private void sliderAmplitudeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sliderAmplitudeStateChanged
        effect.setAmplitude(sliderAmplitude.getValue());
    }//GEN-LAST:event_sliderAmplitudeStateChanged

    private void sliderWavelengthStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sliderWavelengthStateChanged
        effect.setWavelength(sliderWavelength.getValue());
    }//GEN-LAST:event_sliderWavelengthStateChanged


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JSlider sliderAmplitude;
    private javax.swing.JSlider sliderRadius;
    private javax.swing.JSlider sliderWavelength;
    // End of variables declaration//GEN-END:variables

}
