?
Solved

Java Swing ..Button Trick

Posted on 2006-11-09
8
Medium Priority
?
1,328 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 336 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
LVL 9

Expert Comment

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

Assisted Solution

by:harislukman
harislukman earned 332 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 332 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

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!

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 …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 6 hours left to enroll

777 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