?
Solved

checkbox and border on one tab

Posted on 2004-03-31
6
Medium Priority
?
597 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 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…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

741 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