Rebecca Weber

Greenhorn
+ Follow
since Apr 06, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rebecca Weber

Writing a guessing game program. The user is to guess a number between 1 - 1000. Every time the user guesses too low, the background color of the JFrame is to change to blue, if the user guesses too high, it changes to red. I cannot get the background color to change at all. Everything else seems to running ok with the program. Any help would be appreciated. Thanks. Here is my code:

12 years ago

Darryl Burke wrote:Hi Rebecca, and welcome to the Ranch! Whenever you post here, please use the code tags -- highlight your code and click the Code button above the editing area. Since you're new here, I've added the tags for you and you can see how much more readable the code is now.

You have a CirclesPanel class that isn't used in the GUI, where you add a simple JPanel with its background set to WHITE. That isn't going to automagically run the painting code in your custom class -- to use that, you have to actually construct an instance of the class and display it in the GUI.





Darryl,

Thank you for the advice. I apologize about the code tags, I will remember for next time.
Rebecca
12 years ago
Hey guys,
I am taking a beginning course in Java. I am working on a simple program to draw circles. I have to create a JFrame and embed a JPanel into the JFrame. I am not sure if I have this set up properly, but when I run the program nothing appears in the JPanel. I just need some help getting the circle to appear in the JPanel. Here is my code:


Any help is appreciated. Thanks.
12 years ago