?
Solved

arranging checkbox and border vertically

Posted on 2004-03-31
2
Medium Priority
?
386 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 1000 total points
ID: 10730115
0

Featured Post

Industry Leaders: 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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

770 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