How can I use general string in Jspinner?
up vote
0
down vote
favorite
I have problem with JSpinner over to show Month in JSpinner and i have follow code bellow.I use swing control with jframe form to use spinner control. When I run project it always set default value 0. How to solve this error?
static protected String getMonthStrings() months[lastIndex].length()<=0)
String mS=new String[lastIndex];
System.arraycopy(months,0,mS, lastIndex,0);
return mS;
else
return months;
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
java swing jspinner
add a comment |
up vote
0
down vote
favorite
I have problem with JSpinner over to show Month in JSpinner and i have follow code bellow.I use swing control with jframe form to use spinner control. When I run project it always set default value 0. How to solve this error?
static protected String getMonthStrings() months[lastIndex].length()<=0)
String mS=new String[lastIndex];
System.arraycopy(months,0,mS, lastIndex,0);
return mS;
else
return months;
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
java swing jspinner
"When i run project it always set default value 0" - I don't understand what you mean by that. Do you mean that 1) the JSpinner displays "January" (index 0) and you don't want that? Or do you mean 2) that the JSpinner just displays a zero? Or maybe 3) that the JSpinner displays nothing? Please post a Short, Self Contained, Correct (Compilable), Example, so the problem becomes clearer and is actually runnable for us. (also see Minimal, Complete, and Verifiable example)
– Lukas Rotter
Sep 8 '15 at 17:37
Oh!yes the jspinner just only displays a zero.
– nara son
Sep 9 '15 at 1:55
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have problem with JSpinner over to show Month in JSpinner and i have follow code bellow.I use swing control with jframe form to use spinner control. When I run project it always set default value 0. How to solve this error?
static protected String getMonthStrings() months[lastIndex].length()<=0)
String mS=new String[lastIndex];
System.arraycopy(months,0,mS, lastIndex,0);
return mS;
else
return months;
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
java swing jspinner
I have problem with JSpinner over to show Month in JSpinner and i have follow code bellow.I use swing control with jframe form to use spinner control. When I run project it always set default value 0. How to solve this error?
static protected String getMonthStrings() months[lastIndex].length()<=0)
String mS=new String[lastIndex];
System.arraycopy(months,0,mS, lastIndex,0);
return mS;
else
return months;
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
java swing jspinner
java swing jspinner
edited Nov 10 at 14:51
Cœur
16.9k9102139
16.9k9102139
asked Sep 8 '15 at 16:52
nara son
195
195
"When i run project it always set default value 0" - I don't understand what you mean by that. Do you mean that 1) the JSpinner displays "January" (index 0) and you don't want that? Or do you mean 2) that the JSpinner just displays a zero? Or maybe 3) that the JSpinner displays nothing? Please post a Short, Self Contained, Correct (Compilable), Example, so the problem becomes clearer and is actually runnable for us. (also see Minimal, Complete, and Verifiable example)
– Lukas Rotter
Sep 8 '15 at 17:37
Oh!yes the jspinner just only displays a zero.
– nara son
Sep 9 '15 at 1:55
add a comment |
"When i run project it always set default value 0" - I don't understand what you mean by that. Do you mean that 1) the JSpinner displays "January" (index 0) and you don't want that? Or do you mean 2) that the JSpinner just displays a zero? Or maybe 3) that the JSpinner displays nothing? Please post a Short, Self Contained, Correct (Compilable), Example, so the problem becomes clearer and is actually runnable for us. (also see Minimal, Complete, and Verifiable example)
– Lukas Rotter
Sep 8 '15 at 17:37
Oh!yes the jspinner just only displays a zero.
– nara son
Sep 9 '15 at 1:55
"When i run project it always set default value 0" - I don't understand what you mean by that. Do you mean that 1) the JSpinner displays "January" (index 0) and you don't want that? Or do you mean 2) that the JSpinner just displays a zero? Or maybe 3) that the JSpinner displays nothing? Please post a Short, Self Contained, Correct (Compilable), Example, so the problem becomes clearer and is actually runnable for us. (also see Minimal, Complete, and Verifiable example)
– Lukas Rotter
Sep 8 '15 at 17:37
"When i run project it always set default value 0" - I don't understand what you mean by that. Do you mean that 1) the JSpinner displays "January" (index 0) and you don't want that? Or do you mean 2) that the JSpinner just displays a zero? Or maybe 3) that the JSpinner displays nothing? Please post a Short, Self Contained, Correct (Compilable), Example, so the problem becomes clearer and is actually runnable for us. (also see Minimal, Complete, and Verifiable example)
– Lukas Rotter
Sep 8 '15 at 17:37
Oh!yes the jspinner just only displays a zero.
– nara son
Sep 9 '15 at 1:55
Oh!yes the jspinner just only displays a zero.
– nara son
Sep 9 '15 at 1:55
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
In your constructor code, you are calling initComponents, then creating your SpinnerListModel, creating a new JSpinner, but never adding it anywhere... So it looks like the problem is that you're just not adding the JSpinner anywhere
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
But spMonth is Jspinner,sir.
– nara son
Sep 9 '15 at 2:12
spMonth is just a field within your class, which you've set to point to the JSpinner. But you still haven't added this to your GUI
– ControlAltDel
Sep 9 '15 at 11:44
Thank you for your reply.
– nara son
Sep 9 '15 at 17:12
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
In your constructor code, you are calling initComponents, then creating your SpinnerListModel, creating a new JSpinner, but never adding it anywhere... So it looks like the problem is that you're just not adding the JSpinner anywhere
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
But spMonth is Jspinner,sir.
– nara son
Sep 9 '15 at 2:12
spMonth is just a field within your class, which you've set to point to the JSpinner. But you still haven't added this to your GUI
– ControlAltDel
Sep 9 '15 at 11:44
Thank you for your reply.
– nara son
Sep 9 '15 at 17:12
add a comment |
up vote
0
down vote
In your constructor code, you are calling initComponents, then creating your SpinnerListModel, creating a new JSpinner, but never adding it anywhere... So it looks like the problem is that you're just not adding the JSpinner anywhere
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
But spMonth is Jspinner,sir.
– nara son
Sep 9 '15 at 2:12
spMonth is just a field within your class, which you've set to point to the JSpinner. But you still haven't added this to your GUI
– ControlAltDel
Sep 9 '15 at 11:44
Thank you for your reply.
– nara son
Sep 9 '15 at 17:12
add a comment |
up vote
0
down vote
up vote
0
down vote
In your constructor code, you are calling initComponents, then creating your SpinnerListModel, creating a new JSpinner, but never adding it anywhere... So it looks like the problem is that you're just not adding the JSpinner anywhere
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
In your constructor code, you are calling initComponents, then creating your SpinnerListModel, creating a new JSpinner, but never adding it anywhere... So it looks like the problem is that you're just not adding the JSpinner anywhere
public spinner(boolean CycleMonths)
initComponents();
JTextField tf=null;
String monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths)
monthModel=new CycleSpinnerList(monthStrings);
else
monthModel=new SpinnerListModel(monthStrings);
spMonth=new JSpinner(monthModel);
answered Sep 8 '15 at 18:26
ControlAltDel
21.1k53257
21.1k53257
But spMonth is Jspinner,sir.
– nara son
Sep 9 '15 at 2:12
spMonth is just a field within your class, which you've set to point to the JSpinner. But you still haven't added this to your GUI
– ControlAltDel
Sep 9 '15 at 11:44
Thank you for your reply.
– nara son
Sep 9 '15 at 17:12
add a comment |
But spMonth is Jspinner,sir.
– nara son
Sep 9 '15 at 2:12
spMonth is just a field within your class, which you've set to point to the JSpinner. But you still haven't added this to your GUI
– ControlAltDel
Sep 9 '15 at 11:44
Thank you for your reply.
– nara son
Sep 9 '15 at 17:12
But spMonth is Jspinner,sir.
– nara son
Sep 9 '15 at 2:12
But spMonth is Jspinner,sir.
– nara son
Sep 9 '15 at 2:12
spMonth is just a field within your class, which you've set to point to the JSpinner. But you still haven't added this to your GUI
– ControlAltDel
Sep 9 '15 at 11:44
spMonth is just a field within your class, which you've set to point to the JSpinner. But you still haven't added this to your GUI
– ControlAltDel
Sep 9 '15 at 11:44
Thank you for your reply.
– nara son
Sep 9 '15 at 17:12
Thank you for your reply.
– nara son
Sep 9 '15 at 17:12
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32463215%2fhow-can-i-use-general-string-in-jspinner%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"When i run project it always set default value 0" - I don't understand what you mean by that. Do you mean that 1) the JSpinner displays "January" (index 0) and you don't want that? Or do you mean 2) that the JSpinner just displays a zero? Or maybe 3) that the JSpinner displays nothing? Please post a Short, Self Contained, Correct (Compilable), Example, so the problem becomes clearer and is actually runnable for us. (also see Minimal, Complete, and Verifiable example)
– Lukas Rotter
Sep 8 '15 at 17:37
Oh!yes the jspinner just only displays a zero.
– nara son
Sep 9 '15 at 1:55