aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes one button enabled/disabled when some other button pressed/not pressed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "one button enabled/disabled when some other button pressed/not pressed" Watch "one button enabled/disabled when some other button pressed/not pressed" New topic
Author

one button enabled/disabled when some other button pressed/not pressed

Castor Tack
Ranch Hand

Joined: Dec 06, 2010
Posts: 31
Hi there:

How can I do what the title says?

For example, I create three buttons: "Edit Mode", "Watch Mode", "Draw Shape"

I know that I need to use toggle button for the first two (user can be in only one mode at a time).

What I want is, all three buttons are shown on a GUI, but the third button is activated (for users to press) ONLY when the first toggle button is pressed.

What button type should I use to define "Draw Shape"? And How?

If there's any link to how I do it, it's also appreciated.

Thank you.


The BEST user interface design I've ever seen? --- A flush toilet.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18909
    
    8

An ordinary JButton would be fine for the "Draw Shape" button. It should initially be turned off, but you should have an ActionListener on the other buttons which turns it on and off depending on what state is set for them.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4658
    
    5

More about that here:
http://download.oracle.com/javase/tutorial/uiswing/components/button.html


luck, db
There are no new questions, but there may be new answers.
Castor Tack
Ranch Hand

Joined: Dec 06, 2010
Posts: 31
Thanks guys. I got it done.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: one button enabled/disabled when some other button pressed/not pressed