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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:38:36+00:00 2026-06-15T20:38:36+00:00

I know this is something very simple, but as a complete Java newbie I’m

  • 0

I know this is something very simple, but as a complete Java newbie I’m missing it and someone pointing it out would be infinitely helpful. I’ve stared at the screen and moved things around and still nothing.

Screenshot:
https://i.stack.imgur.com/ufCd9.png
This is all that comes up when this is run.

fullGUI.java:


import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;


public class fullGUI extends JFrame

{
    JFrame frame = new JFrame(); //creates frame

    public fullGUI() // constructor
    {
        //setLayout(new BorderLayout());
        //add(new shipGrid(), BorderLayout.NORTH);
        //add(new shipGrid(), BorderLayout.NORTH);
        add(new JRadioButton("Horizontal"), BorderLayout.WEST);
        add(new JRadioButton("Vertical"), BorderLayout.WEST);
        add(new JTextArea("Instructions to player will go here"), BorderLayout.CENTER);
        frame.setSize(400,600);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Battleship!");
        frame.pack(); //sets appropriate size for frame
        frame.setVisible(true);
    }

}

…called by…

test.java


public class test 
{

     public static void main(String[] args) 
     {

         new fullGUI();


     }


}

  • 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-15T20:38:37+00:00Added an answer on June 15, 2026 at 8:38 pm
    1. name classes in Java from a capital letter
    2. FullGUI already extends JFrame, so no need to create another JFrame inside it
    3. call getContentPane.add() to add to JFrame
    4. use SwingUtilities.invokeLater

    So overall something like this

    import java.awt.BorderLayout;
    import javax.swing.JFrame;
    import javax.swing.JRadioButton;
    import javax.swing.JTextArea;
    
    
    public class FullGUI extends JFrame
    
    {
        public FullGUI() // constructor
        {
            getContentPane().add(new JRadioButton("Horizontal"), BorderLayout.WEST);
            getContentPane().add(new JRadioButton("Vertical"), BorderLayout.WEST);
            getContentPane().add(new JTextArea("Instructions to player will go here"), BorderLayout.CENTER);
            setSize(400,600);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setTitle("Battleship!");
            pack(); //sets appropriate size for frame
            setVisible(true);
        }
    
    }
    
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
    
            @Override
            public void run() {
                new FillGU();
            }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is probably something simple but I can't seem to find anything
I know this is going to be something simple that I'm just missing somehow,
I'm sure I'm missing something very simple on this one. After banging my head
I'm sure this is something very simple that I'm screwing up, but here goes:
I'm sure someone will have a very simple answer to this but I can't
I realize this may be a very simple question but I need to know
I know this sounds a little bizarre, but there is a very simple application
I know this is a very simple question, but I'm having trouble finding the
This is something stupid I probably should know, but Googling fails me: When compiling
This is something that's I've wanted to know recently, mostly out of curiousity. I'm

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.