Solved

Displaying images as Jbutton

Posted on 2010-11-08
7
564 Views
Last Modified: 2012-06-27
Hi All,

Can someone please suggest how can I make my images to be a button?

I am trying to show just an image and no borders etc. and want it to work as button.

Thanks!
0
Comment
Question by:hipal
7 Comments
 

Author Comment

by:hipal
ID: 34090214
I am not trying to display a picture in JButton but trying to make an image itself a button.
0
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 34090262
you can use an image as a JButton icon
then you need to remove all extra painting round the edges. Look for a look and feel that supports that (or write your own)
you could also try subclassing and overriding paintComponent()/paint()
0
 

Author Comment

by:hipal
ID: 34090598
Can you please give a very simple example overriding paintCOmponent to replace a circle as a button.

Hope I am not asking for too much. It that needs too much code, please ignore ..

thank you !
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 26

Assisted Solution

by:ksivananth
ksivananth earned 125 total points
ID: 34090706
check this for creating round button, http://www.javanb.com/java/2/19561.html
0
 
LVL 16

Assisted Solution

by:Valeri
Valeri earned 125 total points
ID: 34090899
you can extend AbstractButton and to paint exactly what you need /in other words only the image/
Also you can use the JButton without border and set only image in it. like in this example :
http://www.esus.com/javaindex/j2se/jdk1.2/javaxswing/atomiccontrols/jbutton/jbuttonnoborder.html
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 34091436
0
 
LVL 1

Assisted Solution

by:GenroseSusai
GenroseSusai earned 125 total points
ID: 34093610
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 36
backtracking recursion  code 19 41
Currency Conversion? 1 39
C# DataGridView_RowsAdded event not firing 1 40
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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.

760 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