I am new to Swing and I am trying to disable jspinner, so that it will not be editable.
I added a spinner and change the model type to date in the properties. So that it can display the date&time. Have changed the variable name to "Datespin".
I am trying with below code, but that dint help.
My Question: Can you please help me in making this field non-editable? It should display the date&time when executed, but it shouldn't be editable by the user.
private void hDateSpinnerPropertyChange(java.beans.PropertyChangeEvent evt) {
JSpinner spinner= new JSpinner();
JFormattedTextField spin=((JSpinner.DefaultEditor)spinner.getEditor()).getTextField();
spin.setEditable(false);
Where am I going wrong?