Solved

Left justify JCheckBos in GBL

Posted on 2004-03-31
4
453 Views
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();
    sinDataPanel.setLayout(layout);

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

  JLabel label = new JLabel("need put 4 JLabels and 4 JTextFields");
  label1.setHorizontalAlignment(JLabel.CENTER);
  TitledBorder titled = new TitledBorder("Title");
  label.setBorder(titled);

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

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

 
  }
0
Comment
Question by:dkim18
[X]
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
4 Comments
 
LVL 37

Accepted Solution

by:
zzynx earned 70 total points
ID: 10730224
add

         constraints.anchor = GridBagConstraints.WEST;

before you call

         sinDataPanel.add(sinCheckBox, constraints);
0
 
LVL 9

Assisted Solution

by:mmuruganandam
mmuruganandam earned 30 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.
0
 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 70 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.***
0
 
LVL 37

Expert Comment

by:zzynx
ID: 10755190
Thank you
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to implement Singleton Design Pattern in Java.

734 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