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

  • Home
  • SEARCH
  • 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 7847593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:57:07+00:00 2026-06-02T17:57:07+00:00

Every time I try and run the program, only an empty window appears and

  • 0

Every time I try and run the program, only an empty window appears and I cannot figure out why. I was able to have everything appear in the window previously when I had pretty much everything inside the main method, but now when I try something different, it just won’t appear and closing it won’t stop the program from running even though I thought I accounted for that in my code. There may be other problems with the code but the only one I really need help with is this one.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

class AirplaneSeats extends JFrame implements ActionListener{

private static final int FRAME_WIDTH    = 400;
private static final int FRAME_HEIGHT   = 300;
private static final int FRAME_X_ORIGIN = 150;
private static final int FRAME_Y_ORIGIN = 250;

private JLabel reservetype = new JLabel("Select Reservation Type:");
private JLabel greenseat = new JLabel("Select availiable (green numbered) seat:");

private JButton firstclass;
private JButton coach;

private JButton one;
private JButton two;
private JButton three;
private JButton four;
private JButton five;
private JButton six;
private JButton seven;
private JButton eight;
private JButton nine;
private JButton ten;
private JButton eleven;
private JButton twelve;
private JButton nothing;

public static void main(String [] args){
    JFrame frame = new JFrame("Island Airlines");
    frame.setVisible(true);
    }

public AirplaneSeats(){
    Container contentPane;

    contentPane= getContentPane();
    contentPane.setLayout(null);
    contentPane.setBackground(Color.white);

    setTitle("JMenuFrame: Testing Swing Menus");
    setSize(FRAME_WIDTH, FRAME_HEIGHT);
    setResizable(false);
    setLocation(FRAME_X_ORIGIN,FRAME_Y_ORIGIN);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    reservetype.setBounds(10, 10, 200, 20);
    greenseat.setBounds(10, 100, 250, 20);

    contentPane.add(reservetype);
    contentPane.add(greenseat);

    firstclass = new JButton("first class");
    coach = new JButton("coach");

    contentPane.add(firstclass);
    contentPane.add(coach);

    firstclass.setBounds(60, 40, 80, 35);
    coach.setBounds(150, 40, 80, 35);

    firstclass.addActionListener(this);
    coach.addActionListener(this);

    one = new JButton("1");
    two = new JButton("2");
    three = new JButton("3");
    four = new JButton("4");
    five = new JButton("5");
    six = new JButton("6");
    seven = new JButton("7");
    eight = new JButton("8");
    nine = new JButton("9");
    ten = new JButton("10");
    eleven = new JButton("11");
    twelve = new JButton("12");
    nothing = new JButton("");

    one.setBounds(20, 120, 30, 30);
    three.setBounds(60, 120, 30, 30);
    five.setBounds(100, 120, 30, 30);
    seven.setBounds(150, 120, 30, 30);
    nine.setBounds(190, 120, 30, 30);
    eleven.setBounds(230, 120, 30, 30);
    two.setBounds(20, 160, 30, 30);
    four.setBounds(60, 160, 30, 30);
    six.setBounds(100, 160, 30, 30);
    eight.setBounds(150, 160, 30, 30);
    ten.setBounds(190, 160, 30, 30);
    twelve.setBounds(230, 160, 30, 30);

    contentPane.add(one);
    contentPane.add(two);
    contentPane.add(three);
    contentPane.add(four);
    contentPane.add(five);
    contentPane.add(six);
    contentPane.add(seven);
    contentPane.add(eight);
    contentPane.add(nine);
    contentPane.add(ten);
    contentPane.add(eleven);
    contentPane.add(twelve);
    contentPane.add(nothing);

    one.addActionListener(this);
    two.addActionListener(this);
    three.addActionListener(this);
    four.addActionListener(this);
    five.addActionListener(this);
    six.addActionListener(this);
    seven.addActionListener(this);
    eight.addActionListener(this);
    nine.addActionListener(this);
    ten.addActionListener(this);
    eleven.addActionListener(this);
    twelve.addActionListener(this);


}

@Override
public void actionPerformed(ActionEvent event) {
    // TODO Auto-generated method stub

}

 }
  • 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-02T17:57:09+00:00Added an answer on June 2, 2026 at 5:57 pm

    Change your main method to

    public static void main(String [] args){
       AirplaneSeats airplaneSeats = new AirplaneSeats();
       airplaneSeats.setVisible(true);
    }
    

    You have JFrame frame = new JFrame("Island Airlines"); which just creates a blank jframe.

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

Sidebar

Related Questions

I have a Visual Studio 2005 solution. Every time I try to run the
I'm using VS2008 (with windows XP). Every time I try to run a unit
I have one particular FLA that is crashing every time I try to compile
I have an array of double pointers, but every time I try do print
I've tried to connect to my local machine every time I try and run
I've tried to connect to my local machine every time I try and run
Every time try to set the value of any variable in my model object,
Every time I try to post to twitter in my rails app, the first
For some reason every time I try to count the number of rows in
I am getting a conversion error every time I try to submit a date

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.