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 8638279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:41:22+00:00 2026-06-12T10:41:22+00:00

Hi guys I am writing a little program in java and it’s my first

  • 0

Hi guys I am writing a little program in java and it’s my first try at anything with an interface/picture.

It makes the frame for me but when I click the close button X, it doesn’t close it just treats it like nothing happened…any ideas?

class Graph extends Canvas{

    public Graph(){
        setSize(200, 200);
        setBackground(Color.white);
    }

    public static void main(String[] args){

        Graph gr = new Graph();  

        Frame aFrame = new Frame();
        aFrame.setSize(300, 300);       
        aFrame.add(gr);       
        aFrame.setVisible(true);

    }
  • 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-06-12T10:41:24+00:00Added an answer on June 12, 2026 at 10:41 am

    Is that java.awt.Frame? I think you need to explicitly add the handler for so:

    frame.addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent we){
        System.exit(0);
      }
    }
    

    I used this source for so.

    If it were swing it would be something like jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

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

Sidebar

Related Questions

Ok guys so a little background... I'm writing a small application that will assign
Hey guys I'm writing a simple web program to get my feet wet in
Hey guys, Im working with wpf 3d, im currently writing a program that will
Guys, I’ve been writing code for 15+ years, but managed to avoid Web Development
Hello guys I'm writing a test file for a program. where all the possible
How are you doing? am having a little difficulty writing my first HTML website!
Hl Guys, I am busy writing a backend administrative program for a system that
Hey guys, I'm writing a word wrap function to format console text in C++.
guys. I have a strange problem. I try to write unit-tests to web-app. I
I need a little help writing a query. I have this data... vDir iNumber

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.