Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7572513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:56:41+00:00 2026-05-30T15:56:41+00:00

My question is where did i go wrong. it is supposed to make a

  • 0

My question is where did i go wrong. it is supposed to make a frame where i can control an oval, move it around back forth left and right, and then make it move with the arrows. but right now i cant even make the oval, or even insert a word into it.

import java.awt.Graphics;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;


public class JavaGame extends JFrame{
    int x, y;
    public class AL extends KeyAdapter {
        public void keyPressed(KeyEvent e){
            int keyCode = e.getKeyCode();
            if(keyCode ==e.VK_LEFT){
            x--;
        }
        if(keyCode ==e.VK_RIGHT){
            x++;
        }
        if(keyCode ==e.VK_DOWN){
            y--;
        }
        if(keyCode==e.VK_UP){
                y++;
        }
    }
    public void keyReleased(KeyEvent e){

    }
}
public JavaGame (){
    addKeyListener(new AL());
    setTitle("Game");
    setSize(250,250);
    setResizable(false);
    setVisible(true);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
}
public void Paint(Graphics g){
    x = 150;
    y = 150;
    g.fillOval(x, y, 15, 15);
    repaint();
}
public static void main(String[] Args){
new JavaGame();
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:56:42+00:00Added an answer on May 30, 2026 at 3:56 pm

    Probably because Paint isn’t a standard Java paint method. I don’t see anything resembling an event loop, either–have you considered checking out any Swing tutorials/etc.?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know it is a strange question did someone have had a case where
As part of another question that did involve programming (I assure you), someone suggested
I searched and found this question but did not like the answer. Is there
I did some googling to try to answer this question but even after that
I did search the forum and did not find a similar question. I'm looking
I posted this question on Reddit Programming and did not get a single response.
I was asked a question in C last night and I did not know
There was an interesting question in a practice test that I did not understand
Since my question from yesterday was perhaps not completely clear and I did not
My question is essentially the same as the following one but the answer did

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.