This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Display and select Images in JApplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Display and select Images in JApplet" Watch "Display and select Images in JApplet" New topic
Author

Display and select Images in JApplet

anusha das
Greenhorn

Joined: Sep 12, 2007
Posts: 1
Hi

I want to display around 10 images in a JApplet and let the user select some of them for further actions like rotation. I am using JLabels inside a JPanel to display the images. But how do I let the user select(highlight the image) and deselect multiple images using Ctrl+Click?

Any suggestions please....

Thanks
Anusha
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41124
    
  45
Welcome to JavaRanch.

Handling control-clicks is just a matter of attaching a MouseListener, and checking whether the control key is down during the click.

The highlighting could be done by setting (or removing) a LineBorder for that JLabel.


Ping & DNS - my free Android networking tools app
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by anusha das:
I want to display around 10 images in a JApplet and let the user select some of them for further actions like rotation. I am using JLabels inside a JPanel to display the images. But how do I let the user select(highlight the image) and deselect multiple images using Ctrl+Click?


You can use JButton (or JToggleButton or JRadioButton) instead of JLabel. You can create them with an Icon and no text, just like JLabel. And there are methods that you can call to give them a less buttonlike appearance:

b.setFocusPainted(false);
b.setBorderPainted(false);
b.setContentAreaFilled(false);


bitguru blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display and select Images in JApplet
 
Similar Threads
Custom message box using Swings
problem in browser-using swing
Menu is getting hidden behind the applet
image uploading and selection an image from many images?
Applets to Server Communication with Objects