Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Problem with Link To website with my Java Appliaction
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sushant
Problem with Link To website with my Java Appliaction
1 Answer(s)      4 years and 7 months 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();
}
}











Advertisement
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>
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
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
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
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 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 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
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 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
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
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 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
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
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
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
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
Interview question link - Java Beginners
Interview question link  Hi, I want JAVA+J2EE interview question and answer please suggesion me link
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
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
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
Link To Database with JComboBox - Java Beginners
Link To Database with JComboBox  sir As ur Source Code i have Load course names from Access Database in to JComboBox but now I want to do ,when i... SwingFrame(); } public SwingFrame(){ JFrame f = new JFrame("Frame in Java Swing
 

 

 

DMCA.com