?
Solved

Invisible JButton does not stay invisible when pressed.

Posted on 2004-11-08
10
Medium Priority
?
624 Views
Last Modified: 2008-02-01
I have an invisible JButton on top of an image.  The problem is... when the button is pressed it turns to gray.
I would like the button to stay invisible when clicked.  Ideally, only the border would change.

Note that I do need an invisible button (to long to explain why) so a solution that proposes to build the JButton with
JButton( Icon icon) would not be acceptable for me.

Presently the only thing I'm doing is to set setOpaque(false);

Thank you in advance for you help and advices.
0
Comment
Question by:SolangeRichard
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 92

Expert Comment

by:objects
ID: 12528561
how is your button invisible?
0
 
LVL 6

Expert Comment

by:expertmb
ID: 12530093
>>The problem is... when the button is pressed it turns to gray.
button is there on container, it is receiving events(action/click). if the button is invisble it will not recieve any events.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12530747
yourButton.setVisible(false);
To make it visible again you can not click the invisible button,
but something else of course.
<*>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:SolangeRichard
ID: 12532769
ohhhh I'm so sorry (my primary is french not english).  
I really meant "tranparent".   Only the border appears but we can see the image under the button.
I hope this is a little more helpfull?  In fact it is just NOT opaque.  And I want the button to be not opaque still when it's pushed.  

Thank you and sorry for the confusion.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12533165
You mean transparent.
You want the button to go transparent when it's pushed?
Why not give it an icon-when-pressed.
That icon might be a white picture, made entirely transparent by the microsoft photoeditor.
<*>
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12533360
YourButton.setPressedIcon(Icon pressedIcon);
Hope it works for you.
<*>
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 12539805
try:

button.setContentAreaFilled(false);
0
 

Author Comment

by:SolangeRichard
ID: 12558166
objects: It was so simple!
Thank you very much it worked.

sciuriware: Sorry,  I tried your proposed solution but it did not work.
Thank you anyway for taking time to try to help me.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12558211
You don't have to be sorry.
<*>
0
 
LVL 92

Expert Comment

by:objects
ID: 12560529
(:
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month16 days, 13 hours left to enroll

862 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