Solved

arranging checkbox and border vertically

Posted on 2004-03-31
2
384 Views
Last Modified: 2010-03-31
hi!

I need to arrange checkbox and border vertically, but mine does arrange horizontally.
how do I correct it?

****************************************

 public void createSinDataPanel() {
    //super(new GridLayout(1, 0));
    sinDataPanel = new JPanel();
    GridBagLayout layout = new GridBagLayout();
    sinDataPanel.setLayout(layout);

    constraints = new GridBagConstraints();
    //setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    sinCheckBox = new JCheckBox("Sine plot");
    //sinCheckBox.LEFT_ALIGNMENT();
    sinDataPanel.add(sinCheckBox);


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

//----------------------
    JPanel inputPanel = new JPanel();
    sinDataPanel.add(inputPanel);//---------
    inputPanel.setLayout(layout);
    TitledBorder title = new TitledBorder("Sine Parameters");
    inputPanel.setBorder(title);
    //inputPanel.seth

    JLabel ampLabel = new JLabel("Amplitude: ");
    JLabel periodLabel = new JLabel("Period: ");
    JLabel minXLabel = new JLabel("Min X: ");
    JLabel maxXLabel = new JLabel("Max X: ");
    JLabel cgcLabel = new JLabel("Current Graph Color: ");

    ampTField = new JTextField("1.0", 5);
    periodTField = new JTextField("1.0", 5);
    minXSinTField = new JTextField("0.0", 5);
    maxXSinTField = new JTextField("1.0", 5);

    arrageComponent(ampLabel, 0, 0, 1, 1);
    inputPanel.add(ampLabel, constraints);

    arrageComponent(ampTField, 1, 0, 1, 1);
    inputPanel.add(ampTField, constraints);

    arrageComponent(periodLabel, 0, 1, 1, 1);
    inputPanel.add(periodLabel, constraints);

    arrageComponent(periodTField, 1, 1, 1, 1);
    inputPanel.add(periodTField, constraints);

    arrageComponent(minXLabel, 0, 2, 1, 1);
    inputPanel.add(minXLabel, constraints);

    arrageComponent(minXSinTField, 1, 2, 1, 1);
    inputPanel.add(minXSinTField, constraints);

    arrageComponent(maxXLabel, 0, 3, 1, 1);
    inputPanel.add(maxXLabel, constraints);

    arrageComponent(maxXSinTField, 1, 3, 1, 1);
    inputPanel.add(maxXSinTField, constraints);

    arrageComponent(cgcLabel, 0, 4, 1, 1);
    inputPanel.add(cgcLabel, constraints);

    arrageComponent(cgcLabel, 1, 4, 1, 1);
    inputPanel.add(cgcLabel, constraints);

    arrageComponent(cgcLabel, 0, 5, 1, 1);
   inputPanel.add(cgcLabel, constraints);

    arrageComponent(cgcLabel, 1, 5, 1, 1);
    inputPanel.add(cgcLabel, constraints);

    //JPanel sinInputPanel = new JPanel();
    //GridBagLayout insideLayout = new GridBagLayout();
    // sinInputPanel.setLayout(insideLayout);

  }
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
  • 2
2 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 10730095
cf. my answer in your other question.

You could also use a BorderLayout and place the checkbox in the north and the titledborder panel in the center
0
 
LVL 37

Accepted Solution

by:
zzynx earned 250 total points
ID: 10730115
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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:

724 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