• 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

help with GUI practice

 
Greenhorn
Posts: 3
Oracle Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am attempting to rework the code from java head first using some of the things taught in a beginner/intermediate online self paced training course.
it compiles (eclipse)
and the console displays the results but the GUI actually does not,
I want the user to enter a number and then the "beersong' to start counting down from that number (hope this makes sense)

here is the code:
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have to rethink my response.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

tanya nash wrote:the console displays the results but the GUI actually does not



1. You'll get better help sooner if you post an SSCCE. Your posted code has just too many lines that are totally unrelated to the posted problem.

2. Programming isn't magic. I don't see any code that might attempt to show the result in a GUI component.

3. Even when you sort that out, tying up the EDT with a tight loop will likely prevent any intermediate updates to the GUI. For more, read Concurrency in Swing.

Now if you want more help, get rid of all the dross and post an abbreviated (but compilable/executable) code that is limited to your stated problem.
 
tanya nash
Greenhorn
Posts: 3
Oracle Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Db thank you for taking the time to respond,

I will work on posting code that is SSCCE as I figure out what part of the code that should be

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well, Im not entirely sure, but i think the problem is that your using System.out.println() to display your text, which only works in the terminal. I using JTextArea.append(String) to display things in gui.
 
tanya nash
Greenhorn
Posts: 3
Oracle Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thank you Wes

Yes. that is exactly it along with a couple more adjustments that I had to make it runs and displays now.

I'm adding a scroll pane for the text area and exploring more enhancements now.
 
reply
    Bookmark Topic Watch Topic
  • New Topic