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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:19:43+00:00 2026-06-08T01:19:43+00:00

I’m designing a game through Java, using swing as my GUI. NetBeans is my

  • 0

I’m designing a game through Java, using swing as my GUI. NetBeans is my editor, and I’m trying to use their editor mode, however whenever I run the code, nothing appears. I tried building it into a jar, but when I run the jar nothing appears still.

Here is my code:

package kraz;
public class KrazGUI extends javax.swing.JFrame {
    public KrazGUI() {
        initComponents();
        setVisible(true);
    }
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        PathOptions = new javax.swing.ButtonGroup();
        InventoryOptions = new javax.swing.ButtonGroup();
        Settings = new javax.swing.ButtonGroup();
        GameOptions = new javax.swing.ButtonGroup();
        Holder = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        EventField = new javax.swing.JTextPane();
        PathLabel = new javax.swing.JLabel();
        Left = new javax.swing.JButton();
        Right = new javax.swing.JButton();
        Middle = new javax.swing.JButton();
        InvLabel = new javax.swing.JLabel();
        PickUp = new javax.swing.JButton();
        SetDown = new javax.swing.JButton();
        Use = new javax.swing.JButton();
        SettingLabel = new javax.swing.JLabel();
        HighScores = new javax.swing.JButton();
        EditName = new javax.swing.JButton();
        EditGame = new javax.swing.JButton();
        ProgressLabel = new javax.swing.JLabel();
        ProgressBar = new javax.swing.JProgressBar();
        HealthBar = new javax.swing.JProgressBar();
        HealthLabel = new javax.swing.JLabel();
        RestartGame = new javax.swing.JButton();
        EndGame = new javax.swing.JButton();
        Exit = new javax.swing.JButton();
        GameLabel = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setAlwaysOnTop(true);
        setType(java.awt.Window.Type.POPUP);

        jScrollPane1.setViewportView(EventField);

        PathLabel.setText("Path Options:");

        Left.setText("Go Left");
        PathOptions.add(Left);

        Right.setText("Go Right");
        PathOptions.add(Right);

        Middle.setText("Go Middle");
        PathOptions.add(Middle);

        InvLabel.setText("Inventory Options:");

        PickUp.setText("Pick Up");
        InventoryOptions.add(PickUp);

        SetDown.setText("Set Down");
        InventoryOptions.add(SetDown);

        Use.setText("Use");
        InventoryOptions.add(Use);

        SettingLabel.setText("Settings:");

        HighScores.setText("High Scores");
        Settings.add(HighScores);

        EditName.setText("Edit Name");
        Settings.add(EditName);

        EditGame.setText("Edit Game");
        Settings.add(EditGame);

        ProgressLabel.setText("Progress:");

        HealthLabel.setText("Health:");

        RestartGame.setText("Restart Game");
        GameOptions.add(RestartGame);

        EndGame.setText("End Game");
        GameOptions.add(EndGame);

        Exit.setText("Exit");
        GameOptions.add(Exit);

        GameLabel.setText("Game Options:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout HolderLayout = new javax.swing.GroupLayout(Holder);
        Holder.setLayout(HolderLayout);
        HolderLayout.setHorizontalGroup(
            HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(HolderLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(HolderLayout.createSequentialGroup()
                        .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(HolderLayout.createSequentialGroup()
                                .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(HolderLayout.createSequentialGroup()
                                        .addComponent(InvLabel)
                                        .addGap(18, 18, 18)
                                        .addComponent(PickUp)
                                        .addGap(18, 18, 18)
                                        .addComponent(SetDown)
                                        .addGap(18, 18, 18)
                                        .addComponent(Use))
                                    .addGroup(HolderLayout.createSequentialGroup()
                                        .addComponent(SettingLabel)
                                        .addGap(18, 18, 18)
                                        .addComponent(HighScores)
                                        .addGap(18, 18, 18)
                                        .addComponent(EditName)
                                        .addGap(18, 18, 18)
                                        .addComponent(EditGame))
                                    .addGroup(HolderLayout.createSequentialGroup()
                                        .addComponent(PathLabel)
                                        .addGap(18, 18, 18)
                                        .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(HolderLayout.createSequentialGroup()
                                                .addComponent(Left)
                                                .addGap(18, 18, 18)
                                                .addComponent(Right)
                                                .addGap(18, 18, 18)
                                                .addComponent(Middle)))))
                                .addGap(0, 17, Short.MAX_VALUE))
                            .addGroup(HolderLayout.createSequentialGroup()
                                .addComponent(ProgressLabel)
                                .addGap(18, 18, 18)
                                .addComponent(ProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(HealthLabel)
                                .addGap(18, 18, 18)
                                .addComponent(HealthBar, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())
                    .addGroup(HolderLayout.createSequentialGroup()
                        .addComponent(GameLabel)
                        .addGap(18, 18, 18)
                        .addComponent(RestartGame)
                        .addGap(18, 18, 18)
                        .addComponent(EndGame)
                        .addGap(18, 18, 18)
                        .addComponent(Exit)
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        HolderLayout.setVerticalGroup(
            HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(HolderLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(Right)
                        .addComponent(Middle)
                        .addComponent(Left))
                    .addComponent(PathLabel))
                .addGap(18, 18, 18)
                .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(InvLabel)
                    .addComponent(PickUp)
                    .addComponent(SetDown)
                    .addComponent(Use))
                .addGap(18, 18, 18)
                .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(SettingLabel)
                    .addComponent(HighScores)
                    .addComponent(EditName)
                    .addComponent(EditGame))
                .addGap(18, 18, 18)
                .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(ProgressLabel)
                    .addComponent(ProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(HealthBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(HealthLabel))
                .addGap(18, 18, 18)
                .addGroup(HolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(GameLabel)
                    .addComponent(RestartGame)
                    .addComponent(EndGame)
                    .addComponent(Exit))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(Holder, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(Holder, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>

    public static void main(String args[]) {
        new KrazGUI();
    }
    // Variables declaration - do not modify
    private javax.swing.JButton EditGame;
    private javax.swing.JButton EditName;
    private javax.swing.JButton EndGame;
    private javax.swing.JTextPane EventField;
    private javax.swing.JButton Exit;
    private javax.swing.JLabel GameLabel;
    private javax.swing.ButtonGroup GameOptions;
    private javax.swing.JProgressBar HealthBar;
    private javax.swing.JLabel HealthLabel;
    private javax.swing.JButton HighScores;
    private javax.swing.JPanel Holder;
    private javax.swing.JLabel InvLabel;
    private javax.swing.ButtonGroup InventoryOptions;
    private javax.swing.JButton Left;
    private javax.swing.JButton Middle;
    private javax.swing.JLabel PathLabel;
    private javax.swing.ButtonGroup PathOptions;
    private javax.swing.JButton PickUp;
    private javax.swing.JProgressBar ProgressBar;
    private javax.swing.JLabel ProgressLabel;
    private javax.swing.JButton RestartGame;
    private javax.swing.JButton Right;
    private javax.swing.JButton SetDown;
    private javax.swing.JLabel SettingLabel;
    private javax.swing.ButtonGroup Settings;
    private javax.swing.JButton Use;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration
}

Thanks again for the help here.

  • 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-08T01:19:45+00:00Added an answer on June 8, 2026 at 1:19 am

    When I run this code under JDK1.6, the window shows just fine. Although, I had to comment out the following line which is JDK1.7 API

    setType(java.awt.Window.Type.POPUP);
    

    And I think that line is the problem. You made it a pop-up window. I would suggest to try with Type.NORMAL.

    Small side-note: you should adjust your main method to trigger the UI-code on the EDT:

      public static void main(String args[]) {
        EventQueue.invokeLater( new Runnable() {
          @Override
          public void run() {
            new KrazGUI();
          }
        } );
      }
    

    See the Concurrency in Swing tutorial for more information on the why.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported

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.