public FBInputControlPanel(FBInputCADBlock fbInputCADBlock) { inBlock = fbInputCADBlock; this.setTitle(inBlock.getName()); this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); lGainSlider = new JSlider(JSlider.HORIZONTAL, -190, 190, 0); lGainSlider.addChangeListener(this); lGainLabel = new JLabel(); this.getContentPane().add(lGainLabel); this.getContentPane().add(lGainSlider); lGainSlider.setValue((int) Math.round(100.0 * inBlock.getLGain())); this.pack(); this.setAlwaysOnTop(true); this.setVisible(true); this.setLocation(new Point(inBlock.getX() + 200, inBlock.getY() + 150)); this.setResizable(false); }
public void stateChanged(ChangeEvent ce) { if (ce.getSource() == lGainSlider) { inBlock.setLGain((double) lGainSlider.getValue() / 100.0); lGainLabel.setText("Gain " + String.format("%2.2f", inBlock.getLGain())); } }