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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:18:51+00:00 2026-05-28T05:18:51+00:00

I have the following code but I’d like to structure several buttons of certain

  • 0

I have the following code but I’d like to structure several buttons of certain sizes. I’m just wondering how to do this as I’ve Googled it and found several different methods but none seem to work. Any advice?

import javax.swing.*;

public class GUI {

    public static void main(String[] args) {

        JFrame window = new JFrame();
        window.setSize(500, 500);
        window.setTitle("My Application");

        JButton button = new JButton("click me");
        window.add(button);

        window.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-05-28T05:18:52+00:00Added an answer on May 28, 2026 at 5:18 am

    It looks like you are taking your first steps into swing. The questions that you are asking belong to an area of gui design called layout. Exactly how you set the position of your button depends hea ily on the layout. I would suggest that you find a swing tutorial and run through it. I started with the Java Swing Trail: http://download.oracle.com/javase/tutorial/uiswing

    In the Java api documents look for BorderLayout and GridLayout. They are the easiest to start with.

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

Sidebar

Related Questions

I have the following code but it seems to not connect, just wondering whether
I have following code which works for radio buttons but need to be changed
I have the following code (in this case for two images - but in
I have the following code but I get an error on this line userSpinner.setAdapter(adapter);
hi folks I have this following code but it gives me invalid argument error
I have the following code but it doesnt seem to work: <td align=center style=padding-bottom:52.5px>
I have the following code but the lon/lat seems to be returning null; package
I have the following code but I am unsure how I would adjust it
I have following asp.net code but it gives error when I change dropdown selected
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,

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.