• Post Reply Bookmark Topic Watch Topic
  • New Topic

click ' a picture'  RSS feed

 
Larry Lai
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I had posted it before, but now I understand what I need to ask is 'how to make a handling event that click a picture as like a button.
Then, the picture is sent to the JTextField as well.
So , is it really possible clicking 'a picture'?

thanks
Larry
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the Constructor JButton(Icon). give it a ImageIcon with your image as argument. then attach an ActionListener to it and react on clicks.
I don't understand what you mean with: "the picture is sent to the JTextField as well".
cheers
 
Larry Lai
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guy,
Thanks your hlep,
and I mean that when the icon button is clicked, the image photo would be shown on another panel as well, isn't it?
Larry
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JLabel(Icon) (same as with the button)
 
Larry Lai
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chantal,
thanks a lot, I understand what you mean...
thanks
Larry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!