Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Images in AWT

Posted on 2006-06-29
14
Medium Priority
?
410 Views
Last Modified: 2013-12-29
Suppose i have an image in a Panel. On clicking the Image some event occurs . How can I make the Image appear clickable to the User like say projected out or any others.   meaning if the user sees the screen he should feel that the image is clickable.
I am using AWT only.
--------------------------------------------------------------------------------
0
Comment
Question by:paramu83
[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
  • 4
  • 3
  • 2
  • +2
14 Comments
 
LVL 9

Expert Comment

by:riaancornelius
ID: 17008709
Maybe put a raised etchedBorder on the Panel. That should make it look more like a button?
0
 
LVL 8

Accepted Solution

by:
colr__ earned 172 total points
ID: 17008809
Or even better, a blue border similar to those hyperlinsk you see in your browser, with a rollover effet that changes the colour.

colr__
0
 
LVL 14

Assisted Solution

by:hoomanv
hoomanv earned 164 total points
ID: 17008860
change the mouse cursor to hand
http://javaalmanac.com/egs/java.awt/SetCursor.html
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 

Author Comment

by:paramu83
ID: 17009296
I think etchedBorder is provided by swing . I am not using swing , just plain AWT .

Correct me if I am wrong.
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 17009326
you are correct
0
 
LVL 8

Expert Comment

by:colr__
ID: 17009754
You could use a JEditorPane, with the contents being html with the image defiend as a link:

http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 17009827
the asker asserted no swing solution
paramu83, why do you not set the mouse cursor to hand ? like when you hover an html link
0
 
LVL 8

Expert Comment

by:colr__
ID: 17009866
Sorry, I was working on an old version of this page. ;-(
0
 
LVL 10

Assisted Solution

by:mukundha_expert
mukundha_expert earned 164 total points
ID: 17015284
One thing is you can give a border to that image,

put the image in the panel, set the background colour to blue or black,

in the paint method,
give  (Graphics) g.drawImage ( image, 2,2,width,height,this ) ;

you will get a border on the left and the top,

to get the border on the othersides, add component listener to this panel,

implement the componentResized() method,
in that  get the size of the panel and set the size of the image sightly less than the panel size.

0
 
LVL 9

Expert Comment

by:riaancornelius
ID: 17362587
fine by me :)
0
 
LVL 8

Expert Comment

by:colr__
ID: 17362672
Me too ;-)
0

Featured Post

Industry Leaders: 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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
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:
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

722 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