Results 1 to 6 of 6
  1. #1
    ErikMartinMC is offline Member
    Join Date
    Oct 2012
    Location
    Utah
    Posts
    2
    Rep Power
    0

    Question GlassFrame/ JFrame text adventure

    I am trying to program a text adventure with JFrame, and I think that in order to let buttons update the frame with new contents that involve text, I need to use GlassFrame.
    My dilemma is both that I'm not sure, and that I don't know how to utilize GlassFrame into the program.
    Currently, I have the opening-room-text hardcoded into the paint method, but that clearly won't allow it to update and change the text.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,015
    Rep Power
    10

    Default Re: GlassFrame/ JFrame text adventure

    What exactly do you mean when you say "update the frame with new contents that involve text"? I don't think that necessarily requires a GlassPane, but if you do want to go that route, start here: A well-behaved GlassPane | Java.net
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    ErikMartinMC is offline Member
    Join Date
    Oct 2012
    Location
    Utah
    Posts
    2
    Rep Power
    0

    Default Re: GlassFrame/ JFrame text adventure

    Quote Originally Posted by KevinWorkman View Post
    What exactly do you mean when you say "update the frame with new contents that involve text"? I don't think that necessarily requires a GlassPane, but if you do want to go that route, start here: A well-behaved GlassPane | Java.net
    I want to display a paragraph of text (e.g.: What do you want to do? A. Go North. B. Go South) and have a series of buttons that will then display a different paragraph of text (e.g.: You go north and fall in a hole.). It's relatively easy to do this with "regular" java (displaying the text in command promt and getting keyboard input), but I want to do it with JFrame, and I was under the impression that GlassPane was required, but I may be wrong about that.

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,015
    Rep Power
    10

    Default Re: GlassFrame/ JFrame text adventure

    GlassPane is not required, and probably not even the best solution. Depending on what you want to do, you could extend JPanel and override paintComponent, or just use a JLabel or a JTextArea.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,455
    Rep Power
    20

    Default Re: GlassFrame/ JFrame text adventure

    Guesswork isn't fun. Start with this page and work your way through and you'll be on top of things: Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,455
    Rep Power
    20

    Default Re: GlassFrame/ JFrame text adventure

    Moved from Advanced Java. Nothing advanced about the question either.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Need help with my Text Adventure game [Please Read]
    By MastaChief11 in forum New To Java
    Replies: 23
    Last Post: 04-26-2014, 04:03 AM
  2. Working on an Open Source text adventure / RPG
    By CodeMonkeyAlx in forum Java Gaming
    Replies: 3
    Last Post: 09-07-2012, 05:02 PM
  3. Newton Adventure
    By java software in forum Java Software
    Replies: 0
    Last Post: 12-29-2011, 06:46 PM
  4. Text adventure setup
    By xsimsyx in forum New To Java
    Replies: 8
    Last Post: 03-17-2010, 12:32 AM
  5. Replies: 0
    Last Post: 07-07-2009, 07:22 AM

Tags for this Thread

Posting Permissions

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