aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Display and select Images in JApplet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply 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: 35237
    
    7
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.


Android appsImageJ pluginsJava web charts
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 852
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://zeroturnaround.com/jrebel
 
subject: Display and select Images in JApplet
 
Similar Threads
Custom message box using Swings
problem in browser-using swing
Applets to Server Communication with Objects
image uploading and selection an image from many images?
Menu is getting hidden behind the applet