The Artima Developer Community
Sponsored Link

Java Answers Forum
how to connect two Japplet pages using a button?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
mansi barodia

Posts: 2
Nickname: mansi
Registered: Jan, 2007

how to connect two Japplet pages using a button? Posted: Jan 3, 2007 4:32 AM
Reply to this message Reply
Advertisement
i hav made two file using extends JApplet. 1st is login n another is inventory. now wen i login n click on OK button in login file then it should open the inventory file made using extends login, but i m not able to do it. plz help me for it. pls send me the code for it or plz solve it for me. i m putting my files over here.

Login1 file:

import java.net.*;
import javax.swing.*;
import java.awt.*;
import java.io.*;
import java.applet.*;

/*
<applet code = "Login1.class" width = 800 height = 500>
</applet>*/
public class Login1 extends JApplet
{

static JFrame fobj ;
static JPanel pobj;
GridBagLayout g1;
GridBagConstraints g2;
JLabel Login;
JLabel Password;
JTextField Log;
JPasswordField Pass;
JButton b1;
JButton b2;

public void init()
{

g1 = new GridBagLayout();
g2 = new GridBagConstraints();
pobj = (JPanel)getContentPane();
pobj.setLayout(g1);

JLabel Login = new JLabel("Login");
JLabel Password = new JLabel("Password");

JTextField Log = new JTextField(10);
JPasswordField Pass = new JPasswordField(10);

JButton b1 = new JButton("Submit");
Login1 login=new Login1();
JButton b2 = new JButton("Reset");


g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 1;
g2.gridy = 0;
g1.setConstraints(Login,g2);
pobj.add(Login);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 1;
g2.gridy = 3;
g1.setConstraints(Password,g2);
pobj.add(Password);



g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 0;
g1.setConstraints(Log,g2);
pobj.add(Log);



g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 3;
g1.setConstraints(Pass,g2);
pobj.add(Pass);


g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 1;
g2.gridy = 210;
g1.setConstraints(b1,g2);
pobj.add(b1);


g2.anchor = GridBagConstraints.SOUTHEAST;
g2.gridx = 2;
g2.gridy = 210;
g1.setConstraints(b2,g2);
pobj.add(b2);

}
}


Inventory file:

import java.awt.*;
import javax.swing.*;
import java.applet.*;
import java.io.*;
import java.lang.String;

/*
<applet code = "mansi.class" width = 800 height = 500>
</applet>*/

public class mansi extends JApplet
{

static JFrame fobj;
static JPanel pobj;
GridBagLayout g1;
GridBagConstraints g2;

JLabel SuppID;
JLabel Quantity;
JLabel Supplier;
JLabel Date;
JLabel Month;
JLabel DenID;
JLabel Quality;
JLabel ShadeID;
JLabel Shade;
JLabel Ambig;
JLabel Batch;
JButton Add;
JButton View;
JButton Delete;
JButton Edit;
JTextField textSuppID;
JTextField textQuantity;
JTextField textSupplier;
JTextField textDate;
JTextField textDenID;
JTextField textQuality;
JTextField textShadeID;
JTextField textShade;
JTextField textAmbig;
JTextField textBatch;
JComboBox comboDate;
JComboBox comboMonth;


public void init()
{
g1 = new GridBagLayout();
g2 = new GridBagConstraints();
pobj = (JPanel)getContentPane();
pobj.setLayout(g1);




SuppID = new JLabel("SuppID:");
Quantity = new JLabel("Quantity:");
Supplier = new JLabel("Supplier:");
Date = new JLabel("Date:");
Month = new JLabel("Month:");
DenID = new JLabel("DenID:");
Quality = new JLabel("Quality:");
ShadeID = new JLabel("ShadeID:");
Shade = new JLabel("Shade:");
Ambig = new JLabel("Ambig:");
Batch = new JLabel("Batch:");

textSuppID = new JTextField(10);
textQuantity = new JTextField(5);
textSupplier = new JTextField(10);
textDenID = new JTextField(10);
textQuality = new JTextField(10);
textShadeID = new JTextField(10);
textShade = new JTextField(10);
textAmbig = new JTextField(10);
textBatch = new JTextField(10);

Add = new JButton("Add");
View = new JButton("View");
Edit = new JButton("Edit");
Delete = new JButton("Delete");

String packages[] = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","1 8","19","20","21",
"22","23","24","25","26","27","28","29","30","31"};
comboDate = new JComboBox(packages);
String package1[] = {"Jan","Feb","Mar","Apr","May","Jun","July","Aug","Sep","Oct","Nov","Dec"};
comboMonth = new JComboBox(package1);


/*g2.fill = GridBagConstraints.BOTH;*/
g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 2;
/*g2.gridheight = 3;
g2.gridwidth = 1;*/
g2.weightx = 0;
g2.weighty = 0;
g1.setConstraints(SuppID,g2);
pobj.add(SuppID);


g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 10;
/*g2.gridheight = 60;
g2.gridwidth = 20;*/
g1.setConstraints(Supplier,g2);
pobj.add(Supplier);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 18;
g1.setConstraints(Quantity,g2);
pobj.add(Quantity);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 26;
g1.setConstraints(Date,g2);
pobj.add(Date);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 3;
g2.gridy = 26;
g1.setConstraints(Month,g2);
pobj.add(Month);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 34;
g1.setConstraints(DenID,g2);
pobj.add(DenID);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 42;
g1.setConstraints(Quality,g2);
pobj.add(Quality);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 50;
g1.setConstraints(ShadeID,g2);
pobj.add(ShadeID);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 58;
g1.setConstraints(Shade,g2);
pobj.add(Shade);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 66;
g1.setConstraints(Ambig,g2);
pobj.add(Ambig);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 0;
g2.gridy = 74;
g1.setConstraints(Batch,g2);
pobj.add(Batch);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 2;
g2.gridheight = 3;
g2.gridwidth = 1;
g1.setConstraints(textSuppID,g2);
pobj.add(textSuppID);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 10;
g1.setConstraints(textQuantity,g2);
pobj.add(textQuantity);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 18;
g1.setConstraints(textSupplier,g2);
pobj.add(textSupplier);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 26;
g1.setConstraints(comboDate,g2);
pobj.add(comboDate);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 4;
g2.gridy = 26;
g1.setConstraints(comboMonth,g2);
pobj.add(comboMonth);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 34;
g1.setConstraints(textDenID,g2);
pobj.add(textDenID);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 42;
g1.setConstraints(textQuality,g2);
pobj.add(textQuality);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 50;
g1.setConstraints(textShadeID,g2);
pobj.add(textShadeID);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 58;
g1.setConstraints(textShade,g2);
pobj.add(textShade);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 66;
g1.setConstraints(textAmbig,g2);
pobj.add(textAmbig);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 74;
g1.setConstraints(textBatch,g2);
pobj.add(textBatch);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 1;
g2.gridy = 500;
/*g2.weightx = 2;
g2.weighty = 1;*/
g1.setConstraints(Add,g2);
pobj.add(Add);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 2;
g2.gridy = 500;
/*g2.weightx = 2;
g2.weighty = 1;*/
g1.setConstraints(View,g2);
pobj.add(View);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 4;
g2.gridy = 500;
/*g2.weightx = 1;
g2.weighty = 1;*/
g1.setConstraints(Edit,g2);
pobj.add(Edit);

g2.anchor = GridBagConstraints.NORTHWEST;
g2.gridx = 5;
g2.gridy = 500;
/*g2.weightx = 1;
g2.weighty = 1;*/
g1.setConstraints(Delete,g2);
pobj.add(Delete);
}
}

Topic: how to connect two Japplet pages using a button? Previous Topic   Next Topic Topic: interview quesion

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use