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.
posted 6 years ago
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.