Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1794
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Update GUI while JSli |
| Message-ID | <73877a162cd8e@uwe> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <1181544065_2266@sicinfo3.epfl.ch> |
| Date | 2011-04-27 15:35 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
Philipp wrote:
>Knute Johnson a |-crit :
..
> > You need to take a look at JSlider.getValueIsAdjusting().
..
>How could I implement that?
<sscce>
import javax.swing.*;
import javax.swing.event.*;
public class SliderValue
extends JPanel
implements ChangeListener {
JSlider slider;
JLabel message;
SliderValue() {
super(new java.awt.GridLayout(0,1));
slider = new JSlider(1,100);
slider.addChangeListener( this );
message = new JLabel( "50" );
add(slider);
add(message);
}
/** The ChangeEvents will be continuously dumped
to the JLabel, but we only want the pop-up
(animation speed, ..whatever) to be updated/appear
once the user has *released* the slider. */
public void stateChanged(ChangeEvent ce) {
message.setText( "" + slider.getValue() );
if ( !slider.getValueIsAdjusting() ) {
JOptionPane.showMessageDialog(null,
"Value selected: " + slider.getValue() );
}
}
public static void main(String[] args) {
SliderValue sv = new SliderValue();
JOptionPane.showMessageDialog( null, sv );
}
}
</sscce>
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200706/1
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Update GUI while JSlider "Philipp" <philipp@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: Update GUI while JSli "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: Update GUI while JSli "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: Update GUI while JSli "Chris Smith" <chris.smith@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
Re: Update GUI while JSli "Philipp" <philipp@THRWHITE.remove-dii-this> - 2011-04-27 15:35 +0000
csiph-web