[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 531
  • Last Modified:

Why is this JFrame dead?

Hi,

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

Thanks
gameWindow.java
0
beavoid
Asked:
beavoid
  • 2
1 Solution
 
CEHJCommented:
 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
0
 
beavoidAuthor Commented:
Thank you

Below is the living JFrame




import java.awt.*;

import javax.swing.*;




public class gameWindow extends JFrame {
      
      public gameWindow() {
            
            
            this.setSize(400, 400);
            
            this.setVisible(true);
            
            
      }
      
      public void paint(Graphics G) {
            
            G.setColor(Color.blue);
            G.fillRect(0, 0, 400, 400);
            
      }
      
      
      public static void main( String args[]) {
            
            new gameWindow();
      }
      
      
}
0
 
CEHJCommented:
:)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now