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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:34:03+00:00 2026-06-13T03:34:03+00:00

public class Primary extends JFrame { public Primary(String title) { super(title); JLabel Label1 =

  • 0
public class Primary extends JFrame { 
    public Primary(String title) {
        super(title);
        JLabel Label1 = new JLabel("hello");
        Container c= getContentPane();
        c.add(Label1, new AbsoluteConstraints(117,15));
    }
}

I have written this code having invoked runnable JFrame in the main class.
However although no errors are showing, I’m getting lots of errors when trying to compile.
The error is long but here is a sample of it:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException:
    cannot add to layout: constraint must be a string (or null)
        at java.awt.BorderLayout.addLayoutComponent(BorderLayout.java:426)
        at javax.swing.JRootPane$1.addLayoutComponent(JRootPane.java:531)
        at java.awt.Container.addImpl(Container.java:1120)"
  • 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-13T03:34:04+00:00Added an answer on June 13, 2026 at 3:34 am

    – First of all i want to point it out that BorderLayout is the default layout for JFrame.

    – And you need to explicitly change the Layout to be used, if you don’t want the default BorderLayout.

    – If possible use the Group Layout developed by NetBeans Team back in 2005, Its simply awesome. Use the Windows Builder Pro tool which is now freely available from Google.

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

Sidebar

Related Questions

public class Test { public static void main(String[] args) { DemoAbstractClass abstractClass = new
This is my MySqlLiteHelper: public class MySQLiteHelper extends SQLiteOpenHelper { public static final String
public class tryAnimActivity extends Activity { /** * The thread to process splash screen
public class MyClass { public string MyProperty{ get; set; } Now, I would like
public class A { private A(int param1, String param2) {} public static A createFromCursor(Cursor
public class HttpPostTask extends AsyncTask<Void, Integer, Void> { TextView txtStatus = (TextView)findViewById(R.id.txtStatus); @Override protected
public class ListsSQLiteOpenHelper extends SQLiteOpenHelper { public static final int VERSION = 1; public
public class ListsSQLiteOpenHelper extends SQLiteOpenHelper { public static final int VERSION = 1; public
public class ImportContactsActivity extends Activity { /** Called when the activity is first created.
here is my code, package com.mjzone.project; public class MyDatabase extends Activity { final protected

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.