Code example for JSlider

Methods: getValuegetValueIsAdjusting

0
 
 
		fontSize.addChangeListener(new ChangeListener() {
			public void stateChanged(ChangeEvent e) {
				JSlider source = (JSlider)e.getSource();
				if (!source.getValueIsAdjusting()) {
					int points = (int)source.getValue();
					setFontSize(points);
				} 
			} 
		}); 
		//add the slider to the content pane 
		cp.add(BorderLayout.NORTH, fontSize);
 
		// Make a panel for CENTER to hold two labels above each other 
		JPanel timesPanel = new JPanel();
		timesPanel.setLayout(new GridLayout(2,1));
 
		cp.add(BorderLayout.CENTER, timesPanel);
		timesPanel.add(
Experience pair programming with AI  Get Codota for Java