Results 1 to 2 of 2
  1. #1
    phearless is offline Member
    Join Date
    Jan 2011
    Posts
    3
    Rep Power
    0

    Default How to open new JFrame with clicking on button?

    Hi, I have another question. I need to create a "log in" window. I created username text field, password field button ok and button cancel. My question is:

    What I need to do if I want that after a user enters username and password and then click button ok, that the application opens new window with some other options, new JFRame. What I need to write in buttons' ok listener?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    This second window will be acting as a dialog not a separate stand-alone application, so you shouldn't be showing a second JFrame but rather a dialog window such as a JOptionPane or a JDialog. Please check out the Swing tutorials as it will explain how to create and display these better than anyone here can together with sample code.

Similar Threads

  1. Replies: 3
    Last Post: 08-07-2010, 08:06 PM
  2. Replies: 3
    Last Post: 06-27-2010, 02:57 AM
  3. Get source web page after clicking next Button
    By noob in forum New To Java
    Replies: 1
    Last Post: 03-05-2010, 09:01 PM
  4. Open JFrame
    By AndersBjörnör in forum AWT / Swing
    Replies: 2
    Last Post: 12-01-2009, 09:03 PM
  5. Right-clicking a rectangle on a JFrame to remove it
    By busdude in forum New To Java
    Replies: 4
    Last Post: 02-20-2009, 02:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •