Solved

Java Swing ..Button Trick

Posted on 2006-11-09
8
1,323 Views
Last Modified: 2008-01-09
Hi,
I have a 3 Buttons(B1,B2,B3)  on my JPanel(pane).Button B1 is with Help icon

How to Implement below stuff:
If I click on Button B1 nothing will happen ,at the same if I click on some other buttons(B2,B3) JDialog or some window will open related to information about those buttons(B2,B3).

At this time when I click on Button B1 ,Button B2 ,B3 will not do their assign tasks

again Rephrase the Question...

If I click on Button B1 and after that I click on Button B2 a help dialog box or some text window will open.
If I click on Button B1 and after that I click on Button B3 a help dialog box or some text window will open.

Thanks

0
Comment
Question by:gauravflame
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 9

Accepted Solution

by:
matthew016 earned 84 total points
ID: 17905705
create a boolean b1clicked,
when u click on b1, put b1clicked to true
when u press b2, check if b1clicked is true and if it is true, display the JDialog, then put b1clicked to false
0
 

Expert Comment

by:harislukman
ID: 17905750
yes, i agree with matthew... just store the state if button has been clicked....

what do u mean by
At this time when I click on Button B1 ,Button B2 ,B3 will not do their assign tasks

my assumption is if the help dialog open u cannot do anything with the initial JPanel.. in this case you could use myPanel.setEnabled(false)
0
 

Author Comment

by:gauravflame
ID: 17905921
Button B2 and Button 3 already assign with the tasks like open some other JDialog windows.

Their behaviour changes after we click the Button b1
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:matthew016
ID: 17916545
What's the problem
0
 

Assisted Solution

by:harislukman
harislukman earned 83 total points
ID: 17918701
Logically, U must store the state of your B1, see if its clicked

if B1 is not clicked
Do B2 and/or B3 initial action by calling the initial function (passing event parameter)
else
Do B2 and/or B3 alternative action by calling the alternative function (passing event parameter)

0
 
LVL 6

Assisted Solution

by:SamsonChung
SamsonChung earned 83 total points
ID: 17932448
Take what everyone else was saying..

B1 toggle 'helpmode' on or off.

b2, if helpmode is on, display help info, else do its tasks.
b3, similar.

(basically, a big if statement that check whether a primary variable is true or false..)

don't forget to change helpmode back to off after help info ....
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question