Results 1 to 2 of 2
Thread: launch a browser with a button
- 07-04-2008, 01:42 PM #1
Member
- Join Date
- Jul 2008
- Posts
- 3
- Rep Power
- 0
launch a browser with a button
Hi, i just started java and try to make a button that launches
a web-browser with a predefined url... in netbeans. does anyone
knows how to do that?
i imported java.awt.Desktop, and tried to put some method
in the button when it clicks.. but i dont get it to work..
does anyone know where to put the classes and methods
and what they should look like
can anyone help me??
this is my first java program btw
thanks, and good luck
- 07-07-2008, 05:49 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
This is not specific to NetBeanse either.
First you have to add a button to a container(It's your choice, you can use a JFrame, JDialo, etc.) On NetBeans adding a button is so easy.
Then add a click even to the button. Simply double click on the already added button. You can see that auto generated click event.
As the final step what you have to do is, execute the browser with the specified URL. This implementation already discussed few times here in our community. Search the forum.
Good luck.
Similar Threads
-
Launch native app inside a JFrame???
By benedums in forum Advanced JavaReplies: 6Last Post: 02-25-2011, 03:23 PM -
Browser
By Jessie Madman in forum AWT / SwingReplies: 20Last Post: 02-17-2009, 01:56 PM -
how to get url from browser
By srinivas reddy in forum New To JavaReplies: 0Last Post: 02-08-2008, 07:46 AM -
launch a desktop icon program command
By avaj987 in forum New To JavaReplies: 3Last Post: 08-03-2007, 11:40 AM -
stop button in the browser
By Peter in forum Java ServletReplies: 2Last Post: 07-04-2007, 07:21 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks