Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Applet
i used the code given below to redirect from 1 applet to another
i want that when i click on button view details it will show the output of 2 applet
 
here pp.html is 2nd applet which i want to open on button click.
and in url i specified the path where the applet pp.html is present
 

but 2 applet is not visible on button click
it works for view output in web browser
and i want to view output in appletviewer not in broswer
 
please suggest me?????????????
 

import java.io.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
import java.net.*;
public class home extends Applet implements ActionListener
{
Container c1;
Label l1,l2,l3,l4;
TextField t1;
Button b1,b2;
ImageIcon icon;
Panel p1;
URL order;
 
public void init()
{
// Tell the applet not to use a layout manager.
setLayout(null);
 

 
l1=new Label("MINDSOFT CONSULTANTS");
Font fg=new Font("Times new roman",Font.BOLD,50);
add(l1);
l1.setFont(fg);
l1.setBounds(20,20,800,70);
 
l2=new Label("Strength of 5000 employees");
fg=new Font("Times new roman",Font.BOLD,25);
l2.setFont(fg);
l2.setBounds(180,120,500,30);
add(l2);
 
l3=new Label("Specialised in IT and computing services");
l3.setFont(fg);
l3.setBounds(90,180,500,30);
add(l3);
 
l4=new Label("A total of 10 different departments");
l4.setFont(fg);
l4.setBounds(140,240,500,30);
add(l4);
 
b1=new Button("VIEW DETAIL");
b1.setBounds(150,320,150,40);
add(b1);
b1.addActionListener(this);
 
b2=new Button("ADD DETAIL");
b2.setBounds(450,320,150,40);
add(b2);
 
try
{
order =new URL("file:\\C:\\Program Files\\Java\\jdk1.6.0_13\\bin\\pp.html");
}
catch(MalformedURLException e){
System.out.println(e.getMessage());
}
 

}
 
public void actionPerformed(ActionEvent e)
{
 
if(e.getSource()==b1)
{
getAppletContext().showDocument(order);
System.out.println("HI");
}
 
}
}
Posted 16-Aug-12 2:58am
Edited 16-Aug-12 11:44am
(no name)231K
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,853
1 Sergey Alexandrovich Kryukov 7,107
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 16 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100