It's not a secret anymore!
The moose likes Beginning Java and the fly likes Scroll Bars Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Scroll Bars" Watch "Scroll Bars" New topic

Scroll Bars

Rose Evans
Ranch Hand

Joined: Oct 14, 2004
Posts: 195
Ok you's me again.
I'm trying to make these scroll bar things, and so far I have them working, but I need to do some type of coding somewhere so that the user can pick to where he or she wants scroll bars, always, never, or as needed.
When the user makes a choice the scroll bars are displayed according to their choice.
I created a 'Scroll Bar Menu', but I know it needs some type of coding somewhere to give the user a choice....

Please do you have any suggestions...and remember tell me in 'small talk'.

Here's my code...

) ) ) )
Jeff Tian

Joined: Jan 06, 2005
Posts: 12
Hi there Rose.

I think this is kinda what U R looking for. The submenu lets user choose b/n the always and never modes.

I had a submenu, with radio buttons and action listeners for them.

Put some of the variables as instance instead of local so action listener can reuse them.

Then I just set them according to listeners.

And I dunno what windowDestroyer is. Must be some weapon against bill gates.

It's messy. But here it is.

[ April 12, 2005: Message edited by: Jeff Tian ]

The magic of believing in yourself is to risk all that you have for a dream <br />that nobody sees but you. (Million Dollar Baby)<br /> <br />SCJP 1.4
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
There are a number of ways you could go about this. One might be to launch
a JOptionPane to get the users choice in scrollbar policy. Another might be
to add a submenu to the "Scroll Bars" menu item and list the three choices
for scrollbar policy, perhaps as JRadioButtonMenuItems. In actionPerformed
you could call a method that makes the desired/selected changes, perhaps
sending along a member variable flag to indicate the selection. And to
facilitate the changes you could move the declaration for the JScrollPane
into class scope, ie, make scrolledText a member variable instead of
a local variable. In java this might look like:

[ April 12, 2005: Message edited by: Craig Wood ]
Rose Evans
Ranch Hand

Joined: Oct 14, 2004
Posts: 195
Well I tried something else....and I get these errors...

F:\Java II\14.2\ int cannot be dereferenced
F:\Java II\14.2\ int cannot be dereferenced
2 errors

Tool completed with exit code 1
Rose Evans
Ranch Hand

Joined: Oct 14, 2004
Posts: 195 the destroyer ...destroys the window when the user is finished with it....I guess you can say it like that.
I agree. Here's the link:
subject: Scroll Bars
jQuery in Action, 3rd edition