Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 9th, 2008, 06:19 PM
Registered User
Join Date: Apr 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default using two frames

Hi All,

i am a mature student who is having difficulties with gui's.
Im working on a project that requires a login screen (which i have working) but on success i need to open a new frame that is already created.

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
        // TODO add your handling code here:

       String secretWord="Hello";
       String userInput=password.getText();
           System.out.println("password correct");
          //I want to open frame here
           System.out.println("password incorrect");

The login system is simple i know but not that important can jazz it up later when i learn about databases(god help me give me cobol!!!!)

Thanks a confused learner

Kevin Nally
Old September 2nd, 2008, 10:50 PM
Authorized User
Join Date: Sep 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts


Change the code to your need:

//I want to open frame here

//1. Create the frame.
JFrame frame = new JFrame("FrameDemo");
//2. Optional: What happens when the frame closes?
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
//3. Create components and put them in the frame.
//...create emptyLabel...
frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
//4. Size the frame.
//5. Show it.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Frames Simmy73 ASP.NET 2.0 Basics 1 May 26th, 2006 07:26 AM
Frames ricardo_s HTML Code Clinic 1 April 27th, 2006 02:37 PM
FRAMES twinkle Javascript 2 March 30th, 2004 02:04 AM
i frames and all that Adam H-W HTML Code Clinic 2 November 5th, 2003 12:24 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.