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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:02:51+00:00 2026-06-17T06:02:51+00:00

I am trying to insert the Puzzle Game text circled in red in the

  • 0

I am trying to insert the “Puzzle Game” text circled in red in the attached image.

I have already placed the 4 blue buttons and the textfields all in 1 GridLayout.

I tried inserting the text together with the GridLayout as a non-clickable button, but it didn’t work as the sizes per cell in GridLayout is the same throughout.

Trying to use setBounds as well, but it doesn’t even show up in the JFrame =/ .

image

    // create a new panel - panel1
    JPanel panel1 = new JPanel();   
    // set layout of panel1
    panel1.setLayout(new GridLayout(3,2));
    panel1.setPreferredSize(new Dimension(500,200));

    // create new buttons - button1 to button4
    JButton button1  = new JButton("Start Game");
    JButton button2  = new JButton("Get History");
    JButton button3  = new JButton("Reset Game");
    JButton button4  = new JButton("Exit Game");

    // create label and text field for entering of player's names 
    JLabel label1 = new JLabel("Enter Player's name:",JLabel.CENTER);
    JTextField field1 = new JTextField();

    // add the labels and text field to panel1
    panel1.add(label1);
    panel1.add(field1);

    // adds button1 to button4 to panel1
    panel1.add(button1);
    panel1.add(button2);
    panel1.add(button3);
    panel1.add(button4);

    // create a new general panel to contain all panels containing components placed at the bottom
    JPanel btmGenP = new JPanel();
    this.add(btmGenP,BorderLayout.SOUTH);
    btmGenP.add(panel1,FlowLayout.LEFT);

    // create a new panel - panel2
    JPanel panel2 = new JPanel();
    panel2.setLayout(null);
        panel2.setBounds(50,50,50,50);
        this.add(panel2);     

    // add Jlabel text to panel2
    JLabel puzgame = new JLabel("~~Puzzle Game~~");
    panel2.add(puzgame);
  • 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-17T06:02:52+00:00Added an answer on June 17, 2026 at 6:02 am

    Try this:

    panel1.setBorder(BorderFactory.createTitledBorder("~~Puzzle Game~~"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Obj-C, and I have a little problem here. I'm trying insert
Im trying to insert some text that a Label has, and it wont insert
I have code from my ad network that I am trying insert into an
I'm trying to insert in the following table ABC(user text, num int), Where user
Trying to insert 315K Gif files into an Oracle 10g database. Everytime I get
im trying to insert this query with mysql_query INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1)
Am trying to insert XML into XML Column.. getting following error: . Msg 6819,
While trying to insert data to my SQl db i get the following error
I'm trying to insert the current date/time to the database as the last time
I'm trying to insert into an array at a certain point: $hi = test;

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.