Solved

Java Swing ..Button Trick

Posted on 2006-11-09
8
1,314 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
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Image decoding from Camera 3 85
micro services spring boot application error 3 183
servlet  URL Rewriting 1 36
How to determine if a string is a valid SHA value 7 28
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

813 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now