Problem with Link To website with my Java Appliaction

Problem with Link To website with my Java Appliaction

Hello Sir Here is Main Menu Form,I want to open website on Visit US Button Click
Plz Give Me Source Code,I have Completed Follownig Code,plz add Visit US Button Code in that Form.
//MAIN MENU FORM
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
public class menu5 extends JFrame //implements ActionListener
{
//coursefrm pro=new coursefrm();
JFrame j;
JPanel j2;
JTabbedPane tp;
JLabel l1,l2,l3,l4,l5;
JTextField t1,t2,t3,t4,t5;
JButton courbtn,facbtn,admin,hebtn,visit;
menu5()
{
j=new JFrame("Main Menu");
j2=new JPanel(new GridLayout(3,2));
admin=new JButton("Addmission");
courbtn=new JButton("Course Details");
facbtn=new JButton("Faculty");
hebtn=new JButton ("Help");
visit=new JButton ("Visit Us");
j2.add(admin);
j2.add(courbtn);
j2.add(facbtn);
j2.add(hebtn);
j2.add(visit);
j.add(j2);
courbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
coursefrm pro=new coursefrm();
pro.dis();
}
});
facbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
faculty1 f=new faculty1();
f.dis();
}
});
}
public void dis()
{
j.setSize(300,150);
j.setVisible(true);
j.setResizable(true);
}

public static void main(String z[]){
menu5 pro=new menu5();
pro.dis();
}
}










View Answers

March 27, 2010 at 11:33 AM

Hi Friend,

We have modified your code.

import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
public class menu5 extends JFrame //implements ActionListener
{
//coursefrm pro=new coursefrm();
JFrame j;
JPanel j2;
JTabbedPane tp;
JLabel l1,l2,l3,l4,l5;
JTextField t1,t2,t3,t4,t5;
JButton courbtn,facbtn,admin,hebtn,visit;

public void openURL(String url) {
String osName = System.getProperty("os.name");
try {
if (osName.startsWith("Windows"))
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
else {
String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
String browser = null;
for (int count = 0; count < browsers.length && browser == null; count++)
if (Runtime.getRuntime().exec(new String[] {"which", browsers[count]}).waitFor() == 0)
browser = browsers[count];
Runtime.getRuntime().exec(new String[] {browser, url});
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error in opening browser" + ":\n" + e.getLocalizedMessage());
}
}
menu5()
{
j=new JFrame("Main Menu");
j2=new JPanel(new GridLayout(3,2));
admin=new JButton("Addmission");
courbtn=new JButton("Course Details");
facbtn=new JButton("Faculty");
hebtn=new JButton ("Help");
visit=new JButton ("Visit Us");
j2.add(admin);
j2.add(courbtn);
j2.add(facbtn);
j2.add(hebtn);
j2.add(visit);
j.add(j2);
courbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
coursefrm pro=new coursefrm();
pro.dis();
}
});
facbtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
faculty1 f=new faculty1();
f.dis();
}
});
visit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae){
openURL("http://www.roseindia.net";);

}
});
}
public void dis()
{
j.setSize(300,150);
j.setVisible(true);
j.setResizable(true);
}

public static void main(String z[]){
menu5 pro=new menu5();
pro.dis();
}
}

Thanks









Related Tutorials/Questions & Answers:
Problem with Link To website with my Java Appliaction - Java Beginners
Problem with Link To website with my Java Appliaction  Hello Sir Here is Main Menu Form,I want to open website on Visit US Button Click Plz Give Me Source Code,I have Completed Follownig Code,plz add Visit US Button Code
Link to a website
Link to a website  I have created a mobile application.Now I want to insert a link to a website so that when mobile user selects that link he is directed to that website
Advertisements
Javascript coding for link a website to another upon verify the form - Java Beginners
Javascript coding for link a website to another upon verify the form  Pls tell me javascript coding for " open a website when we click the verify button in the form? ( after verifying the form go to the desired website). 
How to add nofollow in website link?
How to add nofollow in website link?  Hi, I want to add nofollow in my outgoing links. What is the code? Thanks   Hi, Here is the code: <a rel="nofollow" href="http://">Click Here to visit</a>
please do respond to my problem sooooon sir - Java Beginners
please do respond to my problem sooooon sir  Hello sir, Sir i have... on the link in my browser the link is opened in the internet explorer.i need to open the link also in my own browser.Hope you will help me out.And also sir i need
Problem to print from my properties file - Java Server Faces Questions
Problem to print from my properties file  Hi, I am a new user of this site. It is very interesting. So this is my problem: I have a jsp file where i try to print some messages from my properties file but when i execute
Hello Sir I Have problem with My Java Project - Java Beginners
Hello Sir I Have problem with My Java Project  Hello Sir I want Ur Mail Id To send U details and Project Source Code, plz Give Me Ur Mail Id
change cursor on my website - WebSevices
change cursor on my website  i want to change cursor on website. i am new in php. Please tell me it is possible to php.   Hi friend, Code to help in solving the problem : Test function cursor_wait
Paypal integration to my website - Struts
that payment details in paypal website....I should get that details to my website...Paypal integration to my website  Hi there, I am working... Buy Now and if I click that it will redirect to paypal website,that is fine I
Problem to print from my properties file - Java Server Faces Questions
Problem to print from my properties file  Hi, I am a new user of this site. It is very interesting. So this is my problem: I have a jsp file where i try to print some messages from my properties file but when i execute
sir plz do respond to my problem immediately - Java Beginners
sir plz do respond to my problem immediately  Hello sir, Iam very happy that you have responded to my problem.The code u sent for the progree bar is a separate program. sir i need to put it in my web browser.sir iam
I need to display parts of my own website on another website in an iframe
I need to display parts of my own website on another website in an iframe  I need to display parts of my own website on another website in an iframe. please refer me how do i do
Charset problem upon publishing PHP + MySQL website
Charset problem upon publishing PHP + MySQL website  Charset problem upon publishing PHP + MySQL website
I have problem in my Project
I have problem in my Project  Dear Sir, i have problem in my project about Jtable i have EDIT JButton whenevery i was click on edit he is display all data from database but i want to select any row
My Eclipse deployed problem. - Struts
My Eclipse deployed problem.  Dear All, I am facing a problem. When First time I am deploying a web project in eclipse in jboss its fine but, when I am changing the project name by pressing 'f2' and then deploying
how gave security of my pages in website????
how gave security of my pages in website????  how gave security of my pages in website
Problem in my code - Development process
Problem in my code  Plz go thru this code. I want to check login and pwd with database. Backend MsAccess , Table name : Reg , Dsn Name: JJ While executing code am getting 404 error User Name Password
I need web developer to upgrade my website
I need web developer to upgrade my website  Hi, I have a website... to upgrade my website. My website is wordpress website and developer should be able to use existing data while upgrading it for new design. My website is for UK
Please Help To Solve My Problem
Please Help To Solve My Problem  PHP I Have 6 Textbox and 1 ok button. 6 Textbox to Add the 6 Team Name. Each Team Name In String(Like- A,B,C,D,E,F... This Problem With If...Else If...Else Statement But When the More Team
How to embed an executable plugin in my website?
How to embed an executable plugin in my website?  I want to embed an executable plugin in my website that will return client's Mac address run time. I am working with jsp/servlet. Please Help
how to send sms from my website to mobile of particular user.
how to send sms from my website to mobile of particular user.  i had created a website and aim of pjt is whoever the client register for site..... so can u tell the process and how to implemnt this using java
How to add "View more results" kind of functionality in my PHP based website?
How to add "View more results" kind of functionality in my PHP based website?   Hi, I want to make a website which will recommend users books.... The problem is that there will me almost more than 100 books for a particular genre. I
How to track how many hits my website gets?
How to track how many hits my website gets?  Hi, Tracking a website... the website traffic. Tell me How to track how many hits my website gets? Thanks... traffic. Check the tutorial How do I track how many hits my website gets. Thanks
Link List proble, - Java Beginners
Link List proble,  i have a problem about programming... this is the problem.. -create an application using Linked List this application can add Node to your list and Delete to your list...... my brain is bleeding can you
For my website,As soon as the user is able to succesfully login, a Testimonial form appears.
For my website,As soon as the user is able to succesfully login, a Testimonial form appears.  For my website,As soon as the user is able to succesfully login, a Testimonial FORM appears in the same page. How to do. Please Help
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website' How...-my-coop-loan-website After the installation of odoo12-addon-easy-my-coop
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website' How...-my-coop-loan-website After the installation of odoo12-addon-easy-my-coop
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website' How...-my-coop-loan-website After the installation of odoo12-addon-easy-my-coop
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website' How...-my-coop-loan-website After the installation of odoo12-addon-easy-my-coop
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website' ...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website' ...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-loan-website' How...-my-coop-loan-website After the installation of odoo12-addon-easy-my-coop
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal' How... odoo12-addon-easy-my-coop-website-portal After the installation of odoo12-addon-easy
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal' How... odoo12-addon-easy-my-coop-website-portal After the installation of odoo12-addon-easy
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website' ...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal'
ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal...: ModuleNotFoundError: No module named 'odoo12-addon-easy-my-coop-website-portal' How... odoo12-addon-easy-my-coop-website-portal After the installation of odoo12-addon-easy
i have problem in that program to my assignment sir - JavaMail
i have problem in that program to my assignment sir   Develop a programmer's editor in Java that supports syntax-highlighting, compilation support, debugging support, etc
link
link  hey frnds can anyone plz tell me how can i store my videos as link in my database and can retrive the video using servlet by clicking on to that link .it may be confusing sorry about that and if someone can than plz help me
problem in creating create .ipa file in my iPhone app
problem in creating create .ipa file in my iPhone app  Hi, does anyone have idea on how to create a .create .ipa file for my iPhone / iPad application? Also do i need to delete the previous build to create .ipa file? Thanks
I have a small problem in my datagridview - Design concepts & design patterns
I have a small problem in my datagridview  i have datagridviewer in c... be for example 5(integer!) if in my datagridwiewer Will be 5(whatwhich should be take in my... the backcolor of individual cells please help me. Sorry for My English.(I am
link
the link the table is displayed and other links were hidden if i want to click the next link i have to refresh the page instead i want to do is when i click the link the table should display and again when i click the link the table should
LINK
LINK  Thank you friend.cant we use single click instead of double click and also for four link u has given the example but i have 14 links in that case wat i should do
link
link  how can we give hyperlinks on data retrieved from the database and when a particular option is clicked it should be saved in another database and details related to that link should be diaplay and stored in the database
Interview question link - Java Beginners
Interview question link  Hi, I want JAVA+J2EE interview question and answer please suggesion me link
LINK
LINK  I have four links which link to a table,if i click one link... i want to ask is when i click the link the table is displayed and other links were hidden if i want to click the next link i have to refresh the page instead i
resolution problem in java
resolution problem in java  I designed project in java in my PC when run the same project in some other PC i can't fully view my java forms.Some said that it is resolution problem
this is my code but i cant able to run it wt is the problem
this is my code but i cant able to run it wt is the problem  import java.io.*; class createthread { int thread=4,i; class thread1 extends createthread { public void run() { for(i=0;i
this is my code but i cant able to run it wt is the problem
this is my code but i cant able to run it wt is the problem  import java.io.*; class createthread { int thread=4,i; class thread1 extends createthread { public void run() { for(i=0;i
I want to change my user name on your website ,how can i do this
I want to change my user name on your website ,how can i do this  I want to change my user name on your website ,how can i do this   You can create another account very easily with different username
java Problem
java Problem  I want to create a binary tree for displaying members in Downline. i am creating a site for MLM(Multi-Level MArketing). tree must be dynamically populated from database. is there any help for me. Thanks in advance

Ads