Action evernt in applet

hi,

i have created an applet and when someone clicks a button i would like it to go to a frame i have created but i get the foloowing error can somone please help

C:\My Documents\logina>javac Login.java

Login.java:240: cannot access logina.Frame15

bad class file: C:\mydocu~1\logina\Frame15.class

class file contains wrong class: Frame15

Please remove or make sure it appears in the correct subdirectory of the classpa

th.

Frame15 f15 = new Frame15();

^

Note: Login.java uses or overrides a deprecated API.

Note: Recompile with -deprecation for details.

1 error

the code in my applet is as follows

else if(e.getSource() == button6) {

Frame15 f15 = new Frame15();

f15.setSize(500,400);

f15.setVisible(true);

}

help me plz !!!

thanks

[889 byte] By [kingfahad786] at [2007-9-26 2:39:47]
# 1

can you post the code for frame15 too? it looks like the code for frame15 might be in a package logina. if you delete that line from the top of the java file and recompile it it should work. if you do not have the source you could move the frame15.class file to the logina directory and put import logina.Frame15; in the import section of you code.

glicious at 2007-6-29 10:12:53 > top of Java-index,Desktop,Core GUI APIs...
# 2

here is the code for Frame15. it lies in this directory C:\mydocu~1\logina and i have set my classpath to C:\mydocu~1. is the problem b/c i am accessing the frame from an applet or something else. thanks anyway

import logina.*;

import java.awt.*;

import java.awt.event.*;

public class Frame15 extends Frame{

private Label label1;

private Label label2;

private Label label3;

private void buildConstraints(GridBagConstraints gbc, int gx, int gy,

int gw, int gh,

double wx, double wy,

int px, int py) {

gbc.gridx = gx;

gbc.gridy = gy;

gbc.gridwidth = gw;

gbc.gridheight = gh;

gbc.weightx = wx;

gbc.weighty = wy;

gbc.ipadx = px;

gbc.ipady = py;

}

public Frame15() {

try {

init();

}

catch(Exception e) {

e.printStackTrace();

}

}

public void init() {

GridBagLayout gridbag = new GridBagLayout();

GridBagConstraints constraints = new GridBagConstraints();

this.setLayout(gridbag);

// 1 help label

buildConstraints(constraints, 0, 0, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets= new Insets(13, 13, 0, 0);

label1 = new Label("Help");

label1.setFont(new java.awt.Font("Dialog", 3, 18));

gridbag.setConstraints(label1, constraints);

this.add(label1);

// 2 DIS label

buildConstraints(constraints, 2, 0, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.EAST;

constraints.insets= new Insets(13, 0, 0, 13);

label2 = new Label("DIS");

label2.setFont(new java.awt.Font("Dialog", 3, 18));

gridbag.setConstraints(label2, constraints);

this.add(label2);

// 3 explaination label

buildConstraints(constraints, 1, 1, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets= new Insets(97, 15, 135, 0);

label3 = new Label("This help section explains all the differnet components");

gridbag.setConstraints(label3, constraints);

this.add(label3);

}

}

kingfahad786 at 2007-6-29 10:12:53 > top of Java-index,Desktop,Core GUI APIs...
# 3

also all my classes (ie frames) are all in the same directory so how i an i access them. i dont know what i am doing wrong!!! thanks

heres my applet class:

import logina.*;

import java.awt.*;

import java.awt.event.*;

import java.applet.*;

public class Login extends java.applet.Applet implements ActionListener {

private Label label1;

private Label label2;

private Label label3;

private Label label4;

private Label label5;

private Label label7;

private Label label8;

private TextField textfield1;

private TextField jpasswordfield1;

private Button button1;

private Button button2;

private Button button3;

private Button button4;

private Button button5;

private Button button6;

private boolean compare(String t, String p) {

if(t.compareTo("") == 0 && p.compareTo("") == 0)

return true;

else

return false;

}

private void buildConstraints(GridBagConstraints gbc, int gx, int gy,

int gw, int gh,

double wx, double wy,

int px, int py) {

gbc.gridx = gx;

gbc.gridy = gy;

gbc.gridwidth = gw;

gbc.gridheight = gh;

gbc.weightx = wx;

gbc.weighty = wy;

gbc.ipadx = px;

gbc.ipady = py;

}

public void init() {

GridBagLayout gridbag = new GridBagLayout();

GridBagConstraints constraints = new GridBagConstraints();

this.setLayout(gridbag);

this.setBackground(Color.white);

// 1 Login label

buildConstraints(constraints, 0, 0, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets = new Insets(0, -1, 0, 53);

label1 = new Label("Login");

label1.setFont(new java.awt.Font("Dialog", 3, 18));

gridbag.setConstraints(label1, constraints);

this.add(label1);

// 2 DIS label

buildConstraints(constraints, 2, 0, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.EAST;

constraints.insets = new Insets(0, 45, 0, 19);

label2 = new Label("DIS");

label2.setFont(new java.awt.Font("Dialog", 3, 18));

gridbag.setConstraints(label2, constraints);

this.add(label2);

// 3 username label

buildConstraints(constraints, 0, 2, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets = new Insets(12, 39, 0, 0);

label3 = new Label("Username:");

gridbag.setConstraints(label3, constraints);

this.add(label3);

// 4 password label

buildConstraints(constraints, 0, 3, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets = new Insets(22, 39, 0, 0);

label4 = new Label("Password:");

gridbag.setConstraints(label4, constraints);

this.add(label4);

// 5 invalid pass label

buildConstraints(constraints, 0, 1, 3, 1, 0.0, 0.0, 20, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets = new Insets(8, 38, 0, 17);

label5 = new Label("Invalid username/password, please try again or click help.");

label5.setForeground(Color.red);

gridbag.setConstraints(label5, constraints);

this.add(label5);

label5.setVisible(false);

// 7 - to observe dis ex label

buildConstraints(constraints, 1, 6, 2, 1, 0.0, 0.0, 16, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets = new Insets(19, 8, 0, 5);

label7 = new Label("- To observe a DIS exercise");

gridbag.setConstraints(label7, constraints);

this.add(label7);

// 8 - to register for an ex

buildConstraints(constraints, 1, 7, 2, 1, 0.0, 0.0, 10, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets = new Insets(20, 7, 7, 0);

label8 = new Label("- To register for an DIS exercise");

gridbag.setConstraints(label8, constraints);

this.add(label8);

// 1 username text field

buildConstraints(constraints, 1, 2, 1, 1, 1.0, 0.0, 92, 0);

constraints.fill = GridBagConstraints.HORIZONTAL;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets = new Insets(9, 9, 0, 0);

textfield1 = new TextField();

gridbag.setConstraints(textfield1, constraints);

this.add(textfield1);

// 2 jpassword field

buildConstraints(constraints, 1, 3, 1, 1, 1.0, 0.0, 185, 0);

constraints.fill = GridBagConstraints.HORIZONTAL;

constraints.anchor = GridBagConstraints.WEST;

constraints.insets = new Insets(18, 8, 0, 0);

jpasswordfield1 = new TextField();

gridbag.setConstraints(jpasswordfield1, constraints);

jpasswordfield1.setEchoCharacter('*');

this.add(jpasswordfield1);

// 1 sign in Button

buildConstraints(constraints, 2, 3, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.CENTER;

constraints.insets = new Insets(13, 10, 0, 11);

button1 = new Button("Sign In");

gridbag.setConstraints(button1, constraints);

this.add(button1);

button1.addActionListener(this);

// 2 visitors Button

buildConstraints(constraints, 0, 6, 1, 1, 0.0, 0.0, 7, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.CENTER;

constraints.insets = new Insets(10, 11, 0, 8);

button2 = new Button("Visitors");

gridbag.setConstraints(button2, constraints);

this.add(button2);

button2.addActionListener(this);

// 3 register Button

buildConstraints(constraints, 0, 7, 1, 1, 0.0, 0.0, 2, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.CENTER;

constraints.insets = new Insets(16, 11, 0, 7);

button3 = new Button("Register");

gridbag.setConstraints(button3, constraints);

this.add(button3);

button3.addActionListener(this);

// 4 forgot your password? Button

buildConstraints(constraints, 1, 4, 1, 1, 0.0, 0.0, 26, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.CENTER;

constraints.insets = new Insets(16, 9, 0, 0);

button4 = new Button("Forgot Your Password?");

gridbag.setConstraints(button4, constraints);

this.add(button4);

button4.addActionListener(this);

// 5 need to register click here Button

buildConstraints(constraints, 1, 5, 1, 1, 0.0, 0.0, 2, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.CENTER;

constraints.insets = new Insets(8, 9, 0, 0);

button5 = new Button("Need to register click here");

gridbag.setConstraints(button5, constraints);

this.add(button5);

button5.addActionListener(this);

// 6 help Button

buildConstraints(constraints, 2, 5, 1, 1, 0.0, 0.0, 0, 0);

constraints.fill = GridBagConstraints.NONE;

constraints.anchor = GridBagConstraints.CENTER;

constraints.insets = new Insets(8, 13, 0, 20);

button6 = new Button("Help");

gridbag.setConstraints(button6, constraints);

this.add(button6);

button6.addActionListener(this);

}

public void actionPerformed(ActionEvent e) {

if(e.getSource() == button1) {

String textfd = textfield1.getText();

String passfd = jpasswordfield1.getText();

boolean yesorno = compare(textfd, passfd);

if(yesorno == false) {

label5.setVisible(true);

textfield1.setText("");

jpasswordfield1.setText("");

}

else if(yesorno == true){

/* Frame12 f12 = new Frame12();

f12.setSize(500,400);

f12.setVisible(true);*/

}

}

else if(e.getSource() == button2) {

/*Frame8 f8 = new Frame8();

f8.setSize(500,400);

f8.setVisible(true);*/

}

else if(e.getSource() == button3) {

/*Frame13 f13 = new Frame13();

f13.setSize(500,400);

f13.setVisible(true);*/

}

else if(e.getSource() == button4) {

/*Frame10 f10 = new Frame10();

f10.setSize(500,400);

f10.setVisible(true);*/

}

else if(e.getSource() == button5) {

/*Frame4 f4 = new Frame4();

f4.setSize(500,400);

f4.setVisible(true);*/

}

else if(e.getSource() == button6) {

Frame15 f15 = new Frame15();

f15.setSize(500,400);

f15.setVisible(true);

}

}

}

kingfahad786 at 2007-6-29 10:12:53 > top of Java-index,Desktop,Core GUI APIs...