Re: JTextField and JPasswordField question
- From: "Jeremy" <jltuck81@xxxxxxxxxxx>
- Date: Tue, 29 May 2007 18:02:11 -0500
I realized i sent it to individual not to the group. In response to the
question that i was asked.
JPasswordField passwordField;
JTextField UsernameField;
int j = 0;
I'll fix the variable name in a moment. so If i do the if statement..
that shoudl fix the problem am I correct?
previously i had this
public void actionPerformed(ActionEvent e)
{
// JTextField inputs = (JTextField)e.getSource();
JPasswordField input = (JPasswordField)e.getSource();
char []password= input.getPassword();
char []name= UsernameField.getPassword();
...............}
"hiwa" <cardinal_ring@xxxxxxxxxxx> wrote in message
news:1180405304.121766.266580@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On May 29, 10:28 am, "Jeremy" <jltuc...@xxxxxxxxxxx> wrote:
I hope all is well with you guys Here's my question:
If I have this set up as :
JLabel label1 = new JLabel(" Enter Username: ");
UsernameField = new JTextField(10);
JLabel label2 = new JLabel("Enter the password: ");
passwordField = new JPasswordField(10);
then how come I have error pointing to my usernameField = new
JTextField(10); (incompaitble type) I suspect that the action event
is
misfiring somewhat... do I have to create two different function for text
or
something like that?
public void actionPerformed(ActionEvent e)
{
JTextField inputs = (JTextField)e.getSource();
JPasswordField input = (JPasswordField)e.getSource();
char []password= input.getPassword();
char []name= UsernameField.getPassword();
.................................
What is the declaration of your UsernameField variable? usernameField
is a better name, though.[
For actionPerformed() method, do like this:
if (e.getSource() == userNamefield){
...
}
else if (e.getSource() == passwordField){
...
}
.
- References:
- JTextField and JPasswordField question
- From: Jeremy
- Re: JTextField and JPasswordField question
- From: hiwa
- JTextField and JPasswordField question
- Prev by Date: Re: Frustrated by AWT..need some help
- Next by Date: Re: Frustrated by AWT..need some help
- Previous by thread: Re: JTextField and JPasswordField question
- Next by thread: problem with running synth example file
- Index(es):
Relevant Pages
|
|