Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Scroll Bars

 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok you guys...it'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...

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I tried something else....and I get these errors...

F:\Java II\14.2\MemoGUI.java:115: int cannot be dereferenced
scrolledText.setHorizontalScrollBarPolicy(
^
F:\Java II\14.2\MemoGUI.java:117: int cannot be dereferenced
scrolledText.setVerticalScrollBarPolicy(
^
2 errors

Tool completed with exit code 1
 
Rose Evans
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeff...by the way...windows destroyer ...destroys the window when the user is finished with it....I guess you can say it like that.
 
reply
    Bookmark Topic Watch Topic
  • New Topic