File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes calling a class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "calling a class" Watch "calling a class" New topic

calling a class

Ariane Bogain

Joined: Apr 25, 2003
Posts: 15
I have a password box that will be linked to a database. Once the users enter their password they will have another panel where they can register their hobbies. It is not for the net but simply on JBuilder for the moment. I had no problem setting up the GUI for both the password and the other panel (the database link will be for later!) but as I'm a very novice programmer I don't know how to link the two so that on a user's screen there is a smooth transition between the password and the hobby panel. The password class looks like this:
import java.awt.*;
import java.awt.event.*;
class Staffpass extends Panel implements ActionListener {
private TextField name=new TextField(20);
private TextField pass=new TextField(20);

private Button submit=new Button("submit");
private Label instruction=new Label ("please enter your name and password");
public void setEchoChar(char c)
public Staffpass()
public void actionPerformed(ActionEvent e)
if (e.getSource() == submit)
the ??? refers to my question, how do I then invoke my hobby class so that its GUI appears instead of the password GUI?
Thank you very much!
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
hi Ariane
(1)Your hobby class had created or
(2)you want in the actionPerform method to create the hobby class.
It is because the coding is differ when you have different design
Which type is the hobby class?(Jpanel,JFrame,or..)
And one more question is that you want to show the hobby class only?
Please reply which situation you do

Francis Siu
Ariane Bogain

Joined: Apr 25, 2003
Posts: 15
Hi Siu,
Yes my question wasn't very clear! I manage to sort it out by creating an instance of the hobby class and then calling its methods.
I agree. Here's the link:
subject: calling a class
It's not a secret anymore!