We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

checkbox and border on one tab

dkim18
dkim18 asked
on
Medium Priority
634 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,
Comment
Watch Question

zzynxSr. Software engineer
CERTIFIED EXPERT

Commented:
You make your sinDataPanel to have a titled border like this:

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



zzynxSr. Software engineer
CERTIFIED EXPERT

Commented:
Sometimes java is rather straightforward, huh?
;-)

Author

Commented:

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

Commented:
Add the checkbox and a NEW JPanel to the tab. Then set the border of the NEW JPanel
Sr. Software engineer
CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
zzynxSr. Software engineer
CERTIFIED EXPERT

Commented:
Thank you
:)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.