This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to link JComboBox item with a webpage Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "How to link JComboBox item with a webpage" Watch "How to link JComboBox item with a webpage" New topic
Author

How to link JComboBox item with a webpage

Shubhanshu Gupta
Greenhorn

Joined: Dec 14, 2011
Posts: 3
Hello,

I wanted to ask how to link JComboBox item with a webpage....to be more specific, say if i have inserted a drop-down menu bar in my GUI, so what i was thinking was how to open a webpage whose opening is triggered by the selection of an item of that drop-down menu bar.

It would be really helpful for you all to contribute useful answers..

Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

Check out which listeners you can add to a JComboBox. Then choose the right one and use its events.

You can use java.awt.Desktop to open the URL in the default browser.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Shubhanshu Gupta
Greenhorn

Joined: Dec 14, 2011
Posts: 3
Thanks Rob , using the desktop class and using URI, my problem solved.
Actually, i wanted to route my JComboBox item to a webpage when it's selection is made.
Thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

You're welcome.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to link JComboBox item with a webpage
 
Similar Threads
enable and disable a menu item in a menu bar
How to Disbale ViewSource and SaveAs
Swing Menu item with no children?
Ajax: how to achieve
JComboBox