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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:51:32+00:00 2026-05-16T07:51:32+00:00

What are the parameters that can be passed in setAlignment Function. Also what does

  • 0

What are the parameters that can be passed in setAlignment Function. Also what does this button1.setAlignment(1f) mean .

For Example

public class TwoButtons extends JFrame {

    public TwoButtons() {

        setTitle("Two Buttons");

        JPanel basic = new JPanel();
        basic.setLayout(new BoxLayout(basic, BoxLayout.Y_AXIS));
        add(basic);

        basic.add(Box.createVerticalGlue());

        JPanel bottom = new JPanel();
        bottom.setAlignmentX(1f);
        bottom.setLayout(new BoxLayout(bottom, BoxLayout.X_AXIS));

        JButton ok = new JButton("OK");
        JButton close = new JButton("Close");

        bottom.add(ok);
        bottom.add(Box.createRigidArea(new Dimension(5, 0)));
        bottom.add(close);
        bottom.add(Box.createRigidArea(new Dimension(15, 0)));

        basic.add(bottom);
        basic.add(Box.createRigidArea(new Dimension(0, 15)));

        setSize(300, 250);

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
        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-16T07:51:32+00:00Added an answer on May 16, 2026 at 7:51 am

    I think you are talking about setAlignmentX(1f) method. This method is defined in JComponent class. It sets the the vertical alignment.

    http://download.oracle.com/javase/1.5.0/docs/api/javax/swing/JComponent.html#setAlignmentX(float)

    Possible values for setAlignmentX are 
    
    Component.CENTER_ALIGNMENT  0.5f
    Component.LEFT_ALIGNMENT    0.0f
    Component.RIGHT_ALIGNMENT   1.0f
    

    In your case it is “1f” so this component has (Component.RIGHT_ALIGNMENT) Right vertical alignment

    Box.createRigidArea
    Creates an invisible component that’s always the specified size.

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

Sidebar

Related Questions

Is there a PhP function that can count the number of parameters passed to
I just want a function that can take 2 parameters: the URL to POST
I am trying to write a function that can take three parameters: an SqlDataReader,
How do I write a function that can accept unlimited number of parameters? What
I know that multiple parameters can be passed to COALESCE , but when you
The Kynetx Docs describe the parameters that can be passed to the email:forward() and
I remember reading somewhere that captured parameters in the url can be passed to
I have a static javascript function that can take 1, 2 or 3 parameters:
I have a .NET function that does some complex calculation. Depending on the parameters
I have a Python3 script that can take optional command line parameters which the

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.