operation on image

F

focode

i have to create a graphical menu with images , for this i have
created a form , set the layout to grid type (2,2)( their are 4 items
only ) i have placed the images in them perfectly, now i want to know
how i can trigger an event based on that images which i have placed in
that form , previously i used button with images but i was not able to
eliminate the boundary of the button, actually it is little bit
urgent , pls try to answer as soon as possible

thanks
 
L

Lew

focode said:
i [sic] have to create a graphical menu with images , [sic] for this i [sic] have
created a form , [sic] set the layout to grid type (2,2)( [sic] their [sic] are 4 items
only ) i [sic] have placed the images in them perfectly, now i [sic] want to know
how i [sic] can trigger an event based on that images which i [sic] have placed in
that form , [sic] previously i [sic] used button with images but i [sic] was not able to
eliminate the boundary of the button, actually it is little bit
urgent , [sic] pls [sic] try to answer as soon as possible

What is the trigger for the event? That is not clear in your post.

Is it placement of the image in its cell? Clicking on the image?
 
J

John B. Matthews

focode said:
i have to create a graphical menu with images , for this i have
created a form , set the layout to grid type (2,2)( their are 4 items
only ) i have placed the images in them perfectly, now i want to know
how i can trigger an event based on that images which i have placed
in that form , previously i used button with images but i was not
able to eliminate the boundary of the button, actually it is little
bit urgent, pls try to answer as soon as possible

I'd extend AbstractButton, override paintBorder() [1], and add an
ActionListener.

Alternatively, consider the ratio of mouse coordinates to tile
coordinates in each of two dimensions [2, 3]. Assuming integer
arithmetic and coordinates from a MouseListener,

tileColNumber = mousePt.x / tileWidth;
tileRowNumber = mousePt.y / tileHeigth;

[1]<http://java.sun.com/javase/6/docs/api/javax/swing/
AbstractButton.html#paintBorder(java.awt.Graphics)>
[2]<http://robotchase.svn.sourceforge.net/viewvc/robotchase/
trunk/src/org/gcs/robot/RCTile.java>
[3]<http://robotchase.sourceforge.net/org/gcs/robot/RCTile.html>
 
R

Roedy Green

i have to create a graphical menu with images , for this i have
created a form , set the layout to grid type (2,2)( their are 4 items
only ) i have placed the images in them perfectly, now i want to know
how i can trigger an event based on that images which i have placed in
that form , previously i used button with images but i was not able to
eliminate the boundary of the button, actually it is little bit
urgent , pls try to answer as soon as possible

thanks

Best to stick with JButton. First check out the myriad methods for
tweaking them. See http://mindprod.com/jgloss/jbutton.html

If that fails, subclass JButton rather than starting from scratch or
peek to see how JButton does it.
--
Roedy Green Canadian Mind Products
http://mindprod.com

"I mean, source code in files; how quaint, how seventies!"
~ Kent Beck (born: 1961 age: 48), evangelist for extreme programming.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top