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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:03:04+00:00 2026-06-01T21:03:04+00:00

Whenever I add my jbutton to my container it’s really huge. I thought using

  • 0

Whenever I add my jbutton to my container it’s really huge. I thought using the label.setBounds() function would work but it didn’t

public Liability_Calculator(String s)
{
    super(s);
    setSize(325,200);
    Color customColor = Color.WHITE;

    c = getContentPane();
    c.setLayout(new BorderLayout());


    //the button
    ok = new JButton("OK");

    //ok.setSize(50, 50);

    //HERE IS WHERE I TRY AND RESIZE!
    ok.setBounds(30,30,50,50);

    c.add(ok, BorderLayout.SOUTH);

    setVisible(true);
} 
  • 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-01T21:03:05+00:00Added an answer on June 1, 2026 at 9:03 pm

    Suggestions:

    • You will want to read up on the layout managers to
    • understand why your GUI is behaving this way
    • and to see how to use the layout managers to your advantage to create better looking GUI’s in an easy way.
    • You’ll also want to avoid setting bounds on any gui components.

    For instance, a JPanel uses FlowLayout(FlowLayout.CENTER)) by default, and you can use that to your advantage by placing your ok JButton into a JPanel and then the JPanel into the contentPane:

      ok = new JButton("OK");
      // ok.setBounds(30, 30, 50, 50);
    
      JPanel southPanel = new JPanel();
      southPanel.add(ok);
    
      c.add(southPanel, BorderLayout.SOUTH);
    

    This will change the first image to the second:

    enter image description here enter image description here

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

Sidebar

Related Questions

I have a PHP application using an Oracle XE database. Whenever I add a
in java i tried using getComponentAt(x, y) method from container class. but for given
Whenever I add a new viewController my ObjectAlloc jumps up really high and never
im using core data i have an entity called questions whenever i add my
I am using below code to add strings to NSMutableArray . But the issue
Whenever I add something to the SQLiteDatabase , the ListView doesn't show it, but
Okay So I create a ListView and my own ListAdapter but whenever I add
This is strange, whenever I add using namespace ... to a header file it
Whenever I add dataset in my class library project using the wizard it gives
I'm using Crystal 9, and whenever I add a new section to a report,

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.