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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:08:54+00:00 2026-06-08T16:08:54+00:00

I am using netbeans compiler ver 7.11. I am trying to create a GridLayout

  • 0

I am using netbeans compiler ver 7.11.
I am trying to create a GridLayout but it showing an error
in the lines where I write the code to create buttons for the Layout.

It gives the below errors

no suitable constructor found for JButton(Java.lang.String.java.lang.String)
Constructor javax.swing.JButton.JButton(java.lang.String,javax.swing.Icon)is not applicable
(actual argument Java.lang.String cannot be converted to javax.swing.Icon by method
 invocation conversion)
Constructor javax.swing.JButton.JButton(javax.swing.Action)is not applicable
(actual and formal argument lists differ in length)
Constructor javax.swing.JButton.JButton(java.lang.String)is not applicable
(actual and formal argument lists differ in length)
Constructor javax.swing.JButton.JButton(javax.swing.Icon)is not applicable
(actual and formal argument lists differ in length)
Constructor javax.swing.JButton.JButton()is not applicable
(actual and formal argument lists differ in length)

It shows these error from line 7 to line 11. Below is the code That I entered into Java Netbeans compiler.

import java.awt.*;
import javax.swing.*;
public class Griddemo extends JFrame{
public Griddemo()
{
  setLayout(new GridLayout(3,2));
  add(new JButton("Row-1","Col-1")); ---- line7
  add(new JButton("Row-1","Col-2")); ---- line8
  add(new JButton("Row-2","Col-1")); ---- line9
  add(new JButton("Row-2","Col-2")); ---- line10
  add(new JButton("Row-3","Col-1")); ---- line11
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  pack();
  setVisible(true);
}
public static void main(String args[])
 {
   new Griddemo();
 }
}
  • 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-08T16:08:55+00:00Added an answer on June 8, 2026 at 4:08 pm

    The problem you seem to be facing is that you are passing into JButton 2 Strings, and there is no constructor with that signature. try this

    add(new JButton("Row-1, Col-1")); ---- line7
    add(new JButton("Row-1, Col-2")); ---- line8
    add(new JButton("Row-2, Col-1")); ---- line9
    add(new JButton("Row-2, Col-2")); ---- line10
    add(new JButton("Row-3, Col-1")); ---- line11
    

    making each button label as descriptive, but with a single String.

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

Sidebar

Related Questions

i tried using cygwin gcc compiler along with netbeans to create dll files it
I'm have horrendous problems trying to get a JOGL program compiling using Netbeans 6.9.
I am using gradle as project dependency manager but since I like netbeans better
I'm trying to help another developer who is using Netbeans. When he runs or
I am trying to develop OpenGL programs with C++ on Mac using Netbeans, and
Problem Frequently (but not every time) when using CVS to check in files like:
Using Netbeans 6.8 and metro 2.0 I have written a simple application that makes
I'm using Netbeans IDE for developing a web applications, and I've some JARs available
I'm trying to set up my Netbeans IDE so that it is capable of
I try to compile a ( LWJGL ) Java project using NetBeans . I

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.