Results 1 to 14 of 14
  1. #1
    neosnokia is offline Member
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

    Default Help with displaying new information on an applet

    For those of you who have helped me in my last creation, i thank you :-), however now i have managed to get the login working and sucesfuly talking to a database to query a user name and password, what i want to know, is that once this has done, how do you refresh the screen so that it is blank and you can have new things put on it?

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

    Default

    You might want to look into using a CardLayout here. The Sun Swing tutorials will show you how.

  3. #3
    neosnokia is offline Member
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

    Default

    yeah someone suggested using a card layout, however it seems a bit complex to implement.

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

    Default

    Nah, it's a piece of cake. Why not give it a try, and if it doesn't work for you, post your attempt here. The tutorial is pretty complete though, so you should go through it first before trying anything. You can find it here: CardLayout Tutorial

  5. #5
    neosnokia is offline Member
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

    Default

    Ok, i have had a look at the tutorials, but how would i go around putting the items such as textboxes and buttons on to one card, would it just be a case of wrapping this around like one pannel, and if the user login is ok, show panel 2?

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

    Default

    Quote Originally Posted by neosnokia View Post
    ...but how would i go around putting the items such as textboxes and buttons on to one card,...
    You place your components on a JPanel using whatever layout manager(s) that you need. This is no different from other Swing apps you'll make.

    ... would it just be a case of wrapping this around like one pannel, and if the user login is ok, show panel 2?
    I think so, but I'm not 100% sure what you're trying to say here.

  7. #7
    Singing Boyo is offline Senior Member
    Join Date
    Mar 2009
    Posts
    552
    Rep Power
    6

    Default

    To clear the entire screen just call setVisible(false) on your JFrame(or Frame). If you still want the frame visible, but you want it empty, call removeAll() on it.
    If the above doesn't make sense to you, ignore it, but remember it - might be useful!
    And if you just randomly taught yourself to program, well... you're just like me!

  8. #8
    neosnokia is offline Member
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

    Default

    What i want to do, is after the person has logged in, clear the user name and password box, and then display a few drop down menus and stuff

  9. #9
    Join Date
    Mar 2009
    Posts
    25
    Rep Power
    0

    Default

    call the removeAll() method, then rebuild the GUI then call validate().

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

    Default

    Quote Originally Posted by hawaiian robots View Post
    call the removeAll() method, then rebuild the GUI then call validate().
    Don't forget to also call repaint() lest all the removed junk will remain painted on the app. Still my recommendation is to use a CardLayout and just show an empty JPanel here.

  11. #11
    neosnokia is offline Member
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

    Default

    So can i just put this at the end of the code?

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

    Default

    Based on the information that we know, I have no idea at all. My laptop currently lacks the ability to reach through the internet and see what your code looks like. I'm planning on upgrading soon though.

  13. #13
    neosnokia is offline Member
    Join Date
    Feb 2009
    Posts
    27
    Rep Power
    0

    Default

    Basicaly there is a border layout which has a user name, password and a response field. It will query this ok, but what i want to know is how to then move on to another form as it were

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

    Default

    Again, use a CardLayout. It really is the best solution to this problem though I'm not sure what else to say to convince you of this.

Similar Threads

  1. Replies: 4
    Last Post: 03-22-2009, 12:43 AM
  2. Security Information
    By saty_32016 in forum CLDC and MIDP
    Replies: 0
    Last Post: 03-05-2009, 09:14 AM
  3. Replies: 0
    Last Post: 03-10-2008, 03:36 PM
  4. how to send information from applet?
    By christina in forum Java Applets
    Replies: 1
    Last Post: 08-06-2007, 05:11 AM
  5. Information about Struts
    By Felissa in forum Web Frameworks
    Replies: 2
    Last Post: 07-02-2007, 05:40 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
  •