Java

Moderators: zibadian
Number of threads: 7836
Number of posts: 18235

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
why doesnt work this program??????? pls help Posted by lwiq on 24 Apr 2007 at 3:07 AM
i dont know how to do in class autentificare (variable logat) so this variable returne true after i press the button. the programm is::

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class autentificare extends JFrame implements ActionListener
{
JButton b1 = new JButton("Log In");
JTextField text1 = new JTextField(10);
JPasswordField psw1 = new JPasswordField();
JLabel labelUser = new JLabel("user: ");
JLabel labelPsw = new JLabel("parola: ");
boolean logat1=false;

public autentificare(JButton b2,JLabel user, JTextField text2, JLabel parola, JPasswordField psw2,boolean logat)
{
b1=b2;
text1=text2;
psw1=psw2;
labelUser=user;
labelPsw = parola;
logat=logat1;

JFrame frame = new JFrame("AUTENTIFICARE!!!");
frame.setLayout(null);
JPanel panou = new JPanel();
frame.getContentPane().setLayout(new FlowLayout());
frame.setContentPane(panou);
panou.add(b2);
panou.add(labelUser).reshape(100,100,80,30);
panou.add(text2);
panou.add(labelPsw);
panou.add(psw2);
b2.addActionListener(this);

frame.setSize(300,200);
frame.setResizable(false);
frame.setVisible(true);
}

public void actionPerformed(ActionEvent e)
{
System.out.println("hello");
logat1=true;
}
}

public class frame4 extends JFrame
{
public frame4(String titlu)
{
super(titlu);
}

public static void main(String args[])
{
JLabel labelUser = new JLabel("utilizator: ");
JTextField user = new JTextField(10);
JLabel labelParola = new JLabel("parola: ");
JPasswordField psw = new JPasswordField(10);
JButton b = new JButton("Log In");
boolean show = false;

frame4 aplicatie = new frame4("Baza de date");
JPanel panou = new JPanel();
JButton buton = new JButton("Click me");
aplicatie.getContentPane().setLayout(null);
aplicatie.setContentPane(panou);
panou.getAccessibleContext().setAccessibleName("vali");
panou.add(buton);
buton.reshape(30,80,80,30);
aplicatie.setSize(400,400);
aplicatie.show();
autentificare login = new autentificare(b,labelUser, user,labelParola,psw,show);
System.out.println(show);
labelUser.reshape(30,40,60,20);
user.reshape(120,40,140,20);
user.setFocusable(true);
labelParola.reshape(30,60,70,20);
psw.reshape(120,70,140,20);
b.reshape(100,100,80,30);
}
}




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.