Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Output from a class shown in GUI?

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..



 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic