Solved

Java Swing ..Button Trick

Posted on 2006-11-09
8
1,311 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 9

Expert Comment

by:matthew016
Comment Utility
What's the problem
0
 

Assisted Solution

by:harislukman
harislukman earned 83 total points
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
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 how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

762 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

6 Experts available now in Live!

Get 1:1 Help Now