DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007
    Posts
    4

    Unhappy 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 );
    }

    }

  2. #2
    Join Date
    Feb 2007
    Posts
    60
    maybe you should add the setVisible(true); to the window not the Container

    try to add just> setVisible(true); //on constructor

Similar Threads

  1. Whats wrong with this code?
    By Sunil Menon in forum .NET
    Replies: 2
    Last Post: 03-27-2002, 02:15 PM
  2. .NET equals Efficiency
    By Kevin in forum .NET
    Replies: 150
    Last Post: 03-04-2002, 05:40 PM
  3. Code security
    By Rob Teixeira in forum .NET
    Replies: 5
    Last Post: 11-27-2001, 06:12 PM
  4. Whats wrong with this code
    By Viji in forum XML
    Replies: 1
    Last Post: 11-01-2000, 03:11 AM
  5. Whats wrong with this code
    By Viji in forum XML
    Replies: 0
    Last Post: 10-31-2000, 10:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links