• Post Reply Bookmark Topic Watch Topic
  • New Topic

Output from a class shown in GUI?

 
Hugh Mclaughlin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there I was wondering if any kind soul could help me out, I have a class which when run outputs a lot of output strings etc. I have a second class which runs a simple GUI with a JButton to open another GUI, in that new GUI I am trying to get the output from my class file to appear in a JTextArea/Field something like that....could anyone point me in the right direction? Many thanks..



 
Sam Codean
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pathetic Code

Anyways i could do only this much to help you



Now you modify the print() and print(int, int , int) methods to return the String that is to be printed instead of writing it out to console.
Once that is done then you can call the
cube.print() below
CubeArray cube = CubeArray();

and get the string that is needed. Do not understand the whole idea though
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We usually have only one top–level container, eg, JFrame, at a time in a gui
application. To show data you can use the convenience class methods in JOptionPane
(shown below) or make up a JDialog and show/dispose it as needed.
 
Hugh Mclaughlin
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That seems to work rather well Craig, cheers for the help! So is the output for the 2nd GUI in the public String getValues method? I'm going to mess about with it a bit, because I need it to output the reverse binary addresses from the original class matched to the random colours (like the original output did). That should be simple enough should it not? Thanks for your help chaps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!