Results 1 to 7 of 7
- 07-23-2010, 03:00 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 43
- Rep Power
- 0
Problems with values that come from the JSlider
I convert the value on the JSlider to a string using String.valueOf(JSlider.getValue()); but when i run the program with a a starting value other than 0 i get this error:
Exception in thread "main" java.lang.IllegalArgumentException: invalid range properties
at javax.swing.DefaultBoundedRangeModel.<init>(Unknow n Source)
at javax.swing.JSlider.<init>(Unknown Source)♦
Also I am also setting the value on the JSlider to a float but that isn't working properly eather, even if I convert the value of the JSlider to a string then a float.
But this works fine: System.out.println(height.getValue());
Can anyone help me?Last edited by peterhabe; 07-23-2010 at 03:03 PM.
- 07-23-2010, 03:11 PM #2
What line in your source program causes this error? You left off the part of the error message showing the line number and class where the call was made.
What are the values of the args in that statement?
- 07-23-2010, 04:06 PM #3
Member
- Join Date
- Jul 2010
- Posts
- 43
- Rep Power
- 0
I've finally the solved the problem. Silly mistake which i've been trying to solve for like a week. Thanks for the reply anyway.
- 08-14-2012, 03:07 PM #4
Member
- Join Date
- Aug 2012
- Posts
- 8
- Rep Power
- 0
Re: Problems with values that come from the JSlider
Hey That problem has already been solved by the following code:-
try
{
cc=ClientCount.returncount();
}catch(Exception e)
{
cc=0;
}
ts = new JScrollBar(JScrollBar.HORIZONTAL,cc , 1, 0, cc+1);
ts.setUnitIncrement(cc-1);
ts.setBlockIncrement(1);
GridBagConstraints gbc_scrollBar = new GridBagConstraints();
gbc_scrollBar.fill = GridBagConstraints.BOTH;
gbc_scrollBar.gridwidth = gbc_scrollBar.REMAINDER;
gbc_scrollBar.insets = new Insets(0, 0, 0, 0);
gbc_scrollBar.gridx = 0;
gbc_scrollBar.gridy = 5;
contentPane.add(ts, gbc_scrollBar);
ts.addAdjustmentListener(this);
cc declared globally.
Now can you tell me how to change the parameter values of JScrollBar dynamically as these values are already set and when the program is run the bar is not visible.
Thanks
- 08-14-2012, 03:39 PM #5
Re: Problems with values that come from the JSlider
Why do they call it rush hour when nothing moves? - Robin Williams
- 08-14-2012, 04:41 PM #6
Member
- Join Date
- Aug 2012
- Posts
- 8
- Rep Power
- 0
Re: Problems with values that come from the JSlider
Thanks for the rules!
-
Re: Problems with values that come from the JSlider
Moderation: 2 year old thread closed.
Similar Threads
-
How to update JTextArea with JSlider Values
By theen3my in forum AWT / SwingReplies: 7Last Post: 10-04-2009, 08:48 AM -
Jslider changeListner
By Basit56 in forum Java AppletsReplies: 1Last Post: 09-14-2009, 04:04 PM -
Problems with hashMap, has values in it but can't find them?
By mainy in forum New To JavaReplies: 5Last Post: 07-28-2009, 10:22 PM -
How can we zoom a map using JSlider
By barney in forum AWT / SwingReplies: 5Last Post: 02-23-2009, 01:48 PM -
jmf & JSlider
By nathanr_kamal in forum AWT / SwingReplies: 6Last Post: 06-28-2008, 07:56 AM


LinkBack URL
About LinkBacks

Bookmarks