How to use JSlider to adjust Text in a JPanel
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
guys,
maybe you can help me on this...
my application uses a JSlider... I want to be able to adjust the size of the text to give a zooming in/out effect.
I have the initial code... but the JSlider doesnt work...
Here is the link of the intended output...
http://www.geocities.com/louiebagz/files/jslider.jpg
maybe you can help me on this...
my application uses a JSlider... I want to be able to adjust the size of the text to give a zooming in/out effect.
I have the initial code... but the JSlider doesnt work...
Here is the link of the intended output...
http://www.geocities.com/louiebagz/files/jslider.jpg
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hello Louie, and welcome to JavaRanch!
You just need to tie the JSlider value to a font size, and reset the font on your component when it changes. For instance, this ChangeEvent on a JSlider gets its value, and uses it to set the Font size:
Just set the min and max values of the slider to your min and max font sizes.
Hope that helps!
Darrin
You just need to tie the JSlider value to a font size, and reset the font on your component when it changes. For instance, this ChangeEvent on a JSlider gets its value, and uses it to set the Font size:
Just set the min and max values of the slider to your min and max font sizes.
Hope that helps!
Darrin
Life is good on the Ponderosa,<br />but mind where you step.
Louie Bagz
Greenhorn
Posts: 3
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi Darrin,
thanks for the inputs... for newbies like me, I really appreciate that...
But I have one thing more to ask... When I run the code, the initial size of the text displayed is not the same as what I declared.
Please provide feedback. Thanks!
Here is the code...
thanks for the inputs... for newbies like me, I really appreciate that...
But I have one thing more to ask... When I run the code, the initial size of the text displayed is not the same as what I declared.
Please provide feedback. Thanks!
Here is the code...
Darrin Cartwright
Ranch Hand
Posts: 107
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi again,
Even JPanels have a default Font associated, you just need to set the Font when you first create the TextSpace(). Example:
Good luck!
Even JPanels have a default Font associated, you just need to set the Font when you first create the TextSpace(). Example:
Good luck!
Life is good on the Ponderosa,<br />but mind where you step.
Louie Bagz
Greenhorn
Posts: 3
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi Darrin,
Thank you so much! That's just what I need...
Louie
Thank you so much! That's just what I need...
Louie
| Consider Paul's rocket mass heater. |









