• Post Reply Bookmark Topic Watch Topic
  • New Topic

help with GUI practice  RSS feed

 
tanya nash
Greenhorn
Posts: 3
Java Notepad Oracle
  • Mark post as helpful
  • send pies
  • 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:
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have to rethink my response.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • 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
Java Notepad Oracle
  • Mark post as helpful
  • send pies
  • 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

 
Wes McClintock
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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
Java Notepad Oracle
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!