Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / September 2005

Tip: Looking for answers? Try searching our database.

JSpinner arrow buttons are irresponsive

Thread view: 
hiwa - 06 Sep 2005 03:39 GMT
Below, I believe, is a quite standard JSpinner creation
with a date model. However, spinner's arrow buttons are
irresponsive and the display of the date doesn't spin.
What could be the cause and the soultion for the problem?

If you manually select the minute field with the caret,
spinner's suddenly got activated. But I (and user) can't
depend on the quirk.

Environment: JDK 1.6 build 44, Fedora Core 3, GNOME 2.8
-----------------------------------------------------------
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;

public class DateSpinnerWoe{
JSpinner dateSpinner;
SpinnerDateModel dateModel;
Date s, e, v;
int step, hour, minute;

public DateSpinnerWoe(){
hour = 6;
minute = 45;
step = Calendar.MINUTE;

s = createDsParameter(hour, minute);
e = createDsParameter(hour + 24, minute);
v = createDsParameter(hour, minute + 5);

dateModel = new SpinnerDateModel(v, s, e, step);
dateSpinner = new JSpinner(dateModel);
dateSpinner.setEditor
(new JSpinner.DateEditor(dateSpinner, "yyyy MM dd HH:mm"));

dateSpinner.addChangeListener(new ChangeListener(){
public void stateChanged(ChangeEvent e){
JSpinner spi = (JSpinner)e.getSource();
try{
spi.commitEdit();
}
catch (Exception ex){
ex.printStackTrace();
}
System.out.println(spi.getValue());
}
});
}

private Date createDsParameter(int hr, int min){
GregorianCalendar gc = new GregorianCalendar();
gc.set(Calendar.HOUR_OF_DAY, hr);
gc.set(Calendar.MINUTE, min);
gc.set(Calendar.SECOND, 0);
return gc.getTime();
}

public static void main(String[] args){
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container con = frame.getContentPane();
DateSpinnerWoe ds = new DateSpinnerWoe();
frame.add(ds.dateSpinner);
frame.pack();
frame.setVisible(true);
}
}
---------------------------------------------------------------
Michael Dunn - 06 Sep 2005 04:10 GMT
Sun broke it somewhere in the 1.4.2's

This program runs fine on 1.4.0_01.
Same program on 1.4.2_08 (I think) it is the first field (hh)
that increments/decrements with the buttons.

import java.awt.*;
import javax.swing.*;
import java.util.*;
class Testing extends JFrame
{
 public Testing()
 {
   setLocation(400,300);
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   JSpinner spinner = new JSpinner (new SpinnerDateModel(new
Date(),null,null,Calendar.SECOND));
   spinner.setEditor (new JSpinner.DateEditor(spinner,"hh:mm:ss"));
   getContentPane().add(spinner);
   pack();
 }
 public static void main(String[] args){new
Testing().setVisible(true);}
}
hiwa - 06 Sep 2005 05:42 GMT
1.4.1 (1.4.1_07) also fails.
1.4.0 (1.4.0_04) is normal, as Michael has pointed out.
Relevant bug report can't be found on Sun bugdatabase.
hiwa - 09 Sep 2005 00:24 GMT
> 1.4.1 (1.4.1_07) also fails.
> 1.4.0 (1.4.0_04) is normal, as Michael has pointed out.
> Relevant bug report can't be found on Sun bugdatabase.

It has become 'authorized' as a new bug:

<quote>
Hi Hiroshi Iwatani,

Thank you for reporting this issue.

We have determined that this report is a new bug and entered
the bug into our internal bug tracking system under
Bug Id: 6321570.

You can monitor this bug on the Java Bug Database at
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6321570.

It may take a day or two before your bug shows up in this
external database.

As you are a member of the Sun Developer Network (SDN),
consider logging in and clicking "Watch this bug" on the left
side of the report page.  Adding this report to your Bug Watch
list means that you will receive an email notification when
this bug is updated.  The SDN membership also enables voting
for this bug.

We greatly appreciate your efforts in identifying areas in the
J2SE where we can improve upon and I would request you to
continue doing so.
</quote>
Michael Dunn - 09 Sep 2005 21:12 GMT
>> 1.4.1 (1.4.1_07) also fails.
>> 1.4.0 (1.4.0_04) is normal, as Michael has pointed out.
[quoted text clipped - 28 lines]
> continue doing so.
> </quote>

Thanks hiwa, I'll keep an eye on the progress of the bug report
Syrion - 07 Sep 2005 00:11 GMT
> Below, I believe, is a quite standard JSpinner creation
> with a date model. However, spinner's arrow buttons are
[quoted text clipped - 7 lines]
> Environment: JDK 1.6 build 44, Fedora Core 3, GNOME 2.8
> -----------------------------------------------------------

"JDK 1.6" : Huh ?!
Thomas Hawtin - 07 Sep 2005 00:15 GMT
>> Environment: JDK 1.6 build 44, Fedora Core 3, GNOME 2.8
>> -----------------------------------------------------------
>>
> "JDK 1.6" : Huh ?!

It's the current development version, surprisingly enough.

https://mustang.dev.java.net/

Tom Hawtin (JDK 1.6 build 50, Fedora Core 4)
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

Roedy Green - 07 Sep 2005 08:51 GMT
>"JDK 1.6" : Huh ?!
yup. Beta code name Mustang.  

JDK 1.7 after that will be called code-name Dolphin

See http://mindprod.com/jgloss/javareleasedates.html

For the download, see http://mindprod.com/jgloss/jdk.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

Roedy Green - 07 Sep 2005 08:36 GMT
>Below, I believe, is a quite standard JSpinner creation
>with a date model. However, spinner's arrow buttons are
>irresponsive and the display of the date doesn't spin.
>What could be the cause and the soultion for the problem?

Is it just the spinner or everything?  Usually the problem in such
cases is you have somehow tied up the Swing thread so it can't service
the spinner.  You may have put it to sleep or given it some long
onerous task.

See http://mindprod.com/jgloss/jspinner.html for sample code to use a
JSpinner.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.