Solved

Java Swing ..Button Trick

Posted on 2006-11-09
8
1,316 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet requestdispatcher include and forward differences 1 39
java jdbc batch example 8 41
Tagging and Merging on Branch 1 29
What browser will run Java? 7 51
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

840 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