Why is this JFrame dead?

Posted on 2012-08-24
Last Modified: 2012-08-25

Why is this attached JFrame dead?
It should show 10 blue circles, randomly

Question by:beavoid
    LVL 86

    Accepted Solution

     public void paint() {

    Open in new window

    Will never be called as it has the wrong prototype. Should be

     public void paint(Graphics G) {

    Open in new window

    but variable names should begin lower case

    Author Comment

    Thank you

    Below is the living JFrame

    import java.awt.*;

    import javax.swing.*;

    public class gameWindow extends JFrame {
          public gameWindow() {
                this.setSize(400, 400);
          public void paint(Graphics G) {
                G.fillRect(0, 0, 400, 400);
          public static void main( String args[]) {
                new gameWindow();
    LVL 86

    Expert Comment


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    upcasting down casting object remains same but refernece changes 8 47
    bunnyEars challenge 6 46
    countX 22 53
    allStar challenge 1 27
    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now