Here is some random code i found just to illustrate the problem .
Two things:
1.When i enter data in jspinner i have to click on enter for data to be accepted ,is it possible for data to be accepted instantly as i`m typing?
2.When i click on checkbox(just so jspinner loses the focus) and back on jspinner all the data is selected and i want to be
able with first mouse click to select desired numbers in the middle
Here is the video that show how i am unable to select numbers i want (with first mouse click)
jspinner - YouTube
I would be really grateful if someone who knows the solution can write some simple example.
import java.util.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
public class SpinDemo3 {
public static void main(String args[]) {
// create a JFrame
JFrame frame = new JFrame("SpinDemo3");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
// create a JSpinner set to the current
// date, with increment/decrement
// set to minutes
final SpinnerModel sm =
new SpinnerDateModel(new Date(),
null, null, Calendar.MINUTE);
JSpinner jsp = new JSpinner(sm);
// add a change listener for the JSpinner
jsp.addChangeListener(
new ChangeListener() {
public void stateChanged(
ChangeEvent e) {
Date d = (Date)sm.getValue();
System.out.println(
"new date: " + d);
}
});
// create a JPanel
JPanel panel = new JPanel();
panel.setPreferredSize(
new Dimension(300, 300));
JCheckBox chckbxNewCheckBox = new JCheckBox("New check box");
panel.add(chckbxNewCheckBox);
panel.add(jsp);
frame.getContentPane().add(panel);
// display the frame
frame.pack();
frame.setVisible(true);
}
}