• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please help with my project

 
Raimid Xu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
i need help for my java netbeans project
i have 2 form : 1. Login form  2. Input form
the problem is.....
i want to show the user data that login from login form at the input form

i'm a former delphi user and start 2 learnig java, in delphi i just add this code( form2.edit1.text:=edit1.text;) in the login button
and i really confuse how 2 do it in java netbeans

thank you 
 
Maneesh Godbole
Saloon Keeper
Posts: 11327
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

i want to show the user data that login from login form at the input form

This has me absolutely confused!
Maybe you can rephrase to help us understand better?

In the meanwhile I will add this to the IDE forums where questions related to IDE are discussed
 
Stephan van Hulst
Bartender
Pie
Posts: 6503
83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want to create a desktop application? A web application? A console application? Where do you want to show the user the input?

I'm assuming that you want a desktop application; if so, have you checked out the Swing tutorials?
 
Raimid Xu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to make dekstop application
Lets say,It is a book shop application
Sorry if my typing confuse you all
I cant speak eanglish well
What i want to make is...
1.login form
2.transaction form

   The user is the employer(cashier)
   When they logged in
   The transaction form is showing and the login Form is hiding or closing
In the transaction form i want to call
The identity of the employer her name and
Her picture basEd on the input from login form
 
Maneesh Godbole
Saloon Keeper
Posts: 11327
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Create User object to hold all required all details
2) Display login form and ask for user name/password
3) Authenticate. On successful authenticate create a User object (#1 above)
4) To switch between Login panel and Transaction Panel use CardLayout
5) Pass the user object to the Transaction panel via it's constructor
 
Raimid Xu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
between login and transaction form
i'm not using jpanel. i'm using jframe
is card layout able to do that??
 
Maneesh Godbole
Saloon Keeper
Posts: 11327
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm not using jpanel. i'm using jframe


I don't know what you mean by that, but if you are using multiple JFrame instances it is a bad idea.
Your application ideally should have only one JFrame instance. JFrame is the top level ancestor
The contents should be contained inside a container, which is exactly what a JPanel is.
This container should in turn be added to the single JFrame instance

1) LoginPanel extends JPanel
Set proper layout
Add all child components like JTextField for user name, JPasswordField for password, JButton to submit etc

2) Same for your Transaction panel

3) Create a JFrame instance and add LoginPanel to it

4) On successful authentication switch the frame contents from login panel to transaction panel

Check out https://docs.oracle.com/javase/tutorial/uiswing/layout/card.html on how to use card layout. It also has example code of switching panels which is exactly similar to what you need
 
Raimid Xu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've tried using card layout
but i got some trouble here
i made 1 menu_panel(set to border layout) and i put LoginMenu(button) there
then 1 content_panel(set to card layout) and i put 2 more panel(login_panel and transaction_panel)

1.here is the code of LoginMenu function for showing the login panel and it worked



2.i input all the id and the password then i click the login button(used to showing Transaction_panel inside login_panel but after that, all content inside content_panel is gone. here is the code of login button



what's wrong with this code??
or maybe because i put the login button inside content_panel??

thank you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic