Solved

checkbox and border on one tab

Posted on 2004-03-31
6
591 Views
Last Modified: 2008-03-17
hi!

I have an applet and there are JTabbedPane with 6 tabs.
One of them needs to contain one checkbox and titled border and the checkbox should be out side of titled border.

I have func that starts like this:

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

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

My question is do I need to create another panel for checkbox?
I tried but no border appeared.

What layout do I have to use?

For sample, visit the following site, scroll down a bit, and select "Sin Data" tab.
http://webdev.apl.jhu.edu/~rbe/java/Homework4/index.html

Thanks,
0
Comment
Question by:dkim18
  • 4
6 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 10727145
You make your sinDataPanel to have a titled border like this:

     sinDataPanel = new JPanel();
     sinDataPanel.setBorder( BorderFactory.createTitledBorder("Your title") );
     ...



0
 
LVL 37

Expert Comment

by:zzynx
ID: 10727203
Sometimes java is rather straightforward, huh?
;-)
0
 

Author Comment

by:dkim18
ID: 10727728

>>One of them needs to contain one checkbox and titled border and the checkbox should be out side of titled border.
I need to create checkbox out side of border...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Expert Comment

by:fave_17
ID: 10729549
Add the checkbox and a NEW JPanel to the tab. Then set the border of the NEW JPanel
0
 
LVL 37

Accepted Solution

by:
zzynx earned 250 total points
ID: 10730083

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

    sinCheckBox = new JCheckBox("Sine plot");
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        sinDataPanel.add(sinCheckBox, gridBagConstraints);

     sinParameterPanel = new JPanel();
     sinParameterPanel.setBorder( BorderFactory.createTitledBorder("Sine parameters") );
     gridBagConstraints.gridy = 1;
     sinDataPanel.add(sinParameterPanel, gridBagConstraints);

     than add inside the sinParameterPanel the labels + text fields the way I already told you in another Q.
     
     
     

   
0
 
LVL 37

Expert Comment

by:zzynx
ID: 10732145
Thank you
:)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

863 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now