• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

text based java game needs gui help

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So i have taken my brothers code for a game he calls HEX, a simple low power type of rpg from 1k monkeys 1k typewriters.com. i am trying to create a window that will allow
his game to be played in a scrolling window, buttons for choosing actions, and making it a jar so its distributable. i am tired of using my ide (BlueJ) as the only way to do things.

when i call the main method it just starts the game, nothing different than what it used to do, and it needs to create the GUI printing the game code in the text area. if someone could point me in the write direction, its safe to say i dont really get how gui works well enough to do it on my own.

should i give you all the game code as well?
the starter of the game.








GUI CODE
 
Ranch Hand
Posts: 686
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Think of it this way...

In your main GUI class, you declare a JTextArea object like you would declare any other object. By doing so, you give the JTextArea a name, that name is accessible by other code in this class, and maybe also other classes.

Now the JTextArea class has methods that allow you to specify text to be displayed. So somehwhere in your code will be a command that combines the name of the JTextArea object, with the name of the appropriate method and a variable containing the text you want to display.

That is a general explanation, to find the specifics, you will need to research the JTextArea class, and maybe Swing GUIs and Object Oriented Programming in general, in order to get the job done.

Does that help?

edited for clarity
 
reply
    Bookmark Topic Watch Topic
  • New Topic