Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

checkbox and border on one tab

Posted on 2004-03-31
6
Medium Priority
?
599 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
[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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

597 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