Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » DateSpinner Event Example
DateSpinner Event Example [message #113525] Sat, 17 December 2005 01:21 Go to next message
Eclipse UserFriend
Originally posted by: milnfalcon4163.yahoo.com

I am using eclipse 3.1.1 with the ve 1.1 plug-in. I am trying to save a
date spinner value into the label text field. I have tried all events for
a JSpinner in ve. none of them entering the date spinner value in the
label text field. Can some one provide me with a simple example? Thanks.
Re: DateSpinner Event Example [message #113537 is a reply to message #113525] Sat, 17 December 2005 11:24 Go to previous messageGo to next message
Francesc Rosés is currently offline Francesc RosésFriend
Messages: 213
Registered: July 2009
Senior Member
Hello,

1. Right click your JSpinner
2. Select Events->Add Evvents... from the popup menu
3. Click on change - Change Listener to expand the tree node
4. Select stateChanged
5. Click on Finish button

This will add a ChangeListener to your JSpinner. Then you
can obtain the JSpinner value when changed and write it
to a JLabel.

Voila my code:

spDate = new JSpinner();
spDate.setBounds(new Rectangle(180, 70, 86, 20)); // Generated
// Cosyumizing my JSpinner
spDate.setModel(new SpinnerDateModel());
// Assign a date editor with a date format
spDate.setEditor(new JSpinner.DateEditor(spDate, "dd/mm/yyyy"));
// VE added ChangeListener
spDate.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent e) {
// Assign the new value to the JLabel
stInfo.setText(getSpDate().getValue().toString());
}
});


Francesc Rosés
Re: DateSpinner Event Example [message #113561 is a reply to message #113537] Sat, 17 December 2005 16:54 Go to previous message
Eclipse UserFriend
Originally posted by: milnfalcon4163.yahoo.com

Thanks a lot. That helped
Re: DateSpinner Event Example [message #611652 is a reply to message #113525] Sat, 17 December 2005 11:24 Go to previous message
Francesc Rosés is currently offline Francesc RosésFriend
Messages: 213
Registered: July 2009
Senior Member
Hello,

1. Right click your JSpinner
2. Select Events->Add Evvents... from the popup menu
3. Click on change - Change Listener to expand the tree node
4. Select stateChanged
5. Click on Finish button

This will add a ChangeListener to your JSpinner. Then you
can obtain the JSpinner value when changed and write it
to a JLabel.

Voila my code:

spDate = new JSpinner();
spDate.setBounds(new Rectangle(180, 70, 86, 20)); // Generated
// Cosyumizing my JSpinner
spDate.setModel(new SpinnerDateModel());
// Assign a date editor with a date format
spDate.setEditor(new JSpinner.DateEditor(spDate, "dd/mm/yyyy"));
// VE added ChangeListener
spDate.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent e) {
// Assign the new value to the JLabel
stInfo.setText(getSpDate().getValue().toString());
}
});


Francesc Rosés
Re: DateSpinner Event Example [message #611655 is a reply to message #113537] Sat, 17 December 2005 16:54 Go to previous message
Richard is currently offline RichardFriend
Messages: 49
Registered: July 2009
Member
Thanks a lot. That helped
Previous Topic:Candidate build for VE 1.2M1
Next Topic:DateSpinner with date only
Goto Forum:
  


Current Time: Tue Mar 19 02:51:55 GMT 2024

Powered by FUDForum. Page generated in 0.02259 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top