Problem with Link To website with my Java Appliaction

Ads

 
 

Share on Google+Share on Google+

sushant
Problem with Link To website with my Java Appliaction
1 Answer(s)      7 years ago
Posted in : Java Beginners
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();
}
}










Ads
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

Ads









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
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
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
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
how gave security of my pages in website????
how gave security of my pages in website????  how gave security of my pages in website
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
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 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
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
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
Charset problem upon publishing PHP + MySQL website
Charset problem upon publishing PHP + MySQL website  Charset problem upon publishing PHP + MySQL website
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
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
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
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 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
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
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
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
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
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
Interview question link - Java Beginners
Interview question link  Hi, I want JAVA+J2EE interview question and answer please suggesion me link
java website downloadert - Java Beginners
java website downloadert  Hello, I am working on website downloaded based on java it works on few website only. and it give exception after downloading few pages Exception in thread "main" java.util.NoSuchElementException
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
PLEASE HELP WITH MY JAVA
PLEASE HELP WITH MY JAVA  Hey my name is Gavin and im a student at school that takes IT. my teacher has gave me a problem and i can't figure it out please help!!!!!!!! it is a for-loop question: Display the first 5 multiples

Ads

 
Advertisement null

Ads