Results 1 to 4 of 4
Thread: help needed
- 05-29-2010, 11:51 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 72
- Rep Power
- 0
help needed
i am designing a login form on swing where the user has to enter name and password and submit via button
if the user enters wrong password i want to display a pop window to show his login failure just like the alert() funtion of javascript...is there any way of doing it.....
any reply will be highly appreciated
- 05-29-2010, 01:00 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,413
- Blog Entries
- 7
- Rep Power
- 17
- 05-29-2010, 01:35 PM #3
Member
- Join Date
- May 2010
- Location
- china
- Posts
- 7
- Rep Power
- 0
I don't what are you say.
- 05-29-2010, 09:47 PM #4
Member
- Join Date
- May 2010
- Location
- Florida
- Posts
- 68
- Rep Power
- 0
Check this code
Hi
I am not sure if I understood your question, but I wrote this code
I donot know if this is what you want:
Regards.Java Code:import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class NFrame extends JFrame{ JButton submit=new JButton("submit"); JLabel lUser=new JLabel("username"); JTextField user=new JTextField(8); JLabel lPass=new JLabel("password"); JPasswordField password=new JPasswordField(8); JPanel panel=new JPanel(); public NFrame(){ panel.add(lUser); panel.add(user); panel.add(lPass); panel.add(password); panel.add(submit); submit.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String userr=user.getText(); String passs=password.getText(); // suppose user name is pop and password is 123456 if(userr.equals("pop") && (passs.equals("123456"))){ JOptionPane.showMessageDialog(null," your user and password are accepted"); } else JOptionPane.showMessageDialog(null,"sorry wrong user and pass"); } }); add(panel); setSize(400,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setAlwaysOnTop(true); setVisible(true); } public static void main(String [] args){ new NFrame(); } }
Similar Threads
-
Help needed
By saibru in forum CLDC and MIDPReplies: 0Last Post: 03-23-2009, 09:40 AM -
help needed!!! :S
By mark-mlt in forum NetworkingReplies: 1Last Post: 04-14-2008, 09:27 AM -
Help needed.
By necro-1000 in forum AWT / SwingReplies: 2Last Post: 01-12-2008, 11:37 AM -
Help Needed
By pks in forum New To JavaReplies: 1Last Post: 01-09-2008, 12:07 AM -
help needed.
By dirtycash in forum New To JavaReplies: 3Last Post: 12-03-2007, 09:17 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks