Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Left justify JCheckBos in GBL

Posted on 2004-03-31
Medium Priority
Last Modified: 2012-05-04
The followinig code right  justifies checkbox.
how do I left justifies checkbox?

public void createSinDataPanel() {
      sinDataPanel = new JPanel();
    GridBagLayout layout = new GridBagLayout();

    constraints = new GridBagConstraints();
    sinCheckBox = new JCheckBox("Sine plot");

  JLabel label = new JLabel("need put 4 JLabels and 4 JTextFields");
  TitledBorder titled = new TitledBorder("Title");

  arrageComponent(sinCheckBox, 0, 0, 1, 1);
  sinDataPanel.add(sinCheckBox, constraints);

  arrageComponent(label, 0, 1, 1, 1);
  sinDataPanel.add(label, constraints);

Question by:dkim18
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 37

Accepted Solution

zzynx earned 280 total points
ID: 10730224

         constraints.anchor = GridBagConstraints.WEST;

before you call

         sinDataPanel.add(sinCheckBox, constraints);

Assisted Solution

mmuruganandam earned 120 total points
ID: 10731042
constraints.anchor = GridBagConstraints.LINE_START

would be right one to be used at this occasion.  As the labels are going to be in the line.
LVL 37

Assisted Solution

zzynx earned 280 total points
ID: 10731093
java help of BorderLayout.LINE_START:

The component goes at the beginning of the line direction for the layout.
***For Western, left-to-right and top-to-bottom orientations, this is equivalent to WEST.***
LVL 37

Expert Comment

ID: 10755190
Thank you

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question