Solved

Images in AWT

Posted on 2006-06-29
14
393 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
  • 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 43 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 41 total points
ID: 17008860
change the mouse cursor to hand
http://javaalmanac.com/egs/java.awt/SetCursor.html
0
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 41 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java and GPO 11 66
eclipse shortcuts 9 45
Java Options in Zimbra Server 2 44
fibonacci ten numbers 4 22
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…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

947 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