-
can anyone tell me what is wrong with this code!!
the compiler does not find any errors but the window doesnt appears when i execute the code.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class BankTEST extends JFrame {
public BankTEST() {
super("a");
Container logincontainer=getContentPane();
logincontainer.setLayout( new FlowLayout() );
JLabel Username=new JLabel("username");
JLabel Password=new JLabel("password");
JTextField UsernameText=new JTextField(10);
JTextField PasswordText=new JPasswordField(10);
JButton Login=new JButton("LOGIN");
logincontainer.add(Username);
logincontainer.add(Password);
logincontainer.add(UsernameText);
logincontainer.add(PasswordText);
logincontainer.setSize( 500, 170 );
logincontainer.setVisible(true);
}
public static void main(String args[]){
BankTEST b=new BankTEST();
b.setDefaultCloseOperation(
JFrame.EXIT_ON_CLOSE );
}
}
-
maybe you should add the setVisible(true); to the window not the Container
try to add just> setVisible(true); //on constructor
Similar Threads
-
By Sunil Menon in forum .NET
Replies: 2
Last Post: 03-27-2002, 02:15 PM
-
Replies: 150
Last Post: 03-04-2002, 05:40 PM
-
By Rob Teixeira in forum .NET
Replies: 5
Last Post: 11-27-2001, 06:12 PM
-
Replies: 1
Last Post: 11-01-2000, 03:11 AM
-
Replies: 0
Last Post: 10-31-2000, 10:20 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|