Solved

Adding a splitpane / divider between coulmns in JTable

Posted on 2004-04-25
5
473 Views
Last Modified: 2008-02-26
Hi!

I would like to add split pane or divider between columns with a single scroll pane for JTable. Is their any way to do this?

0
Comment
Question by:joshidin
  • 3
5 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10915665
not really, but column widths are user adjustable anyways. what is it u r trying to achieve exactly?
0
 

Author Comment

by:joshidin
ID: 10915739
I would like to differentiate between two columns, i want to add some thing like a divider..a thik line deiffrentitation between columns.

Any way to do it.
0
 
LVL 92

Accepted Solution

by:
objects earned 150 total points
ID: 10915761
0
 
LVL 15

Expert Comment

by:Javatm
ID: 10915881
> I would like to add split pane or divider between columns with a single scroll pane for JTable. Is their any way to do this?

Yes basically you need to add the 2 panels on the splitpane and add a JTable w/ a JScrollpane to the splitpane.
Its just basically like :

// Declare the panels . . .
JPanel p1 = new JPanel();
JPanel p1 = new JPanel();

// Declare a JTable . . .
JTabel t1 = new JTable();

//Add the Table w/ a ScrollPane to the Panel . . .
p1.add(new JScrollPane(t1));

// Add the p1 & p2 panels to the SplitPane . . .
JSplitPane s2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, p1, p2);

// Declare the controls . . .
s2.setMinimumSize(new Dimension(100, 50));
s2.setDividerLocation(260);
s2.setResizeWeight(0.5);
s2.setOneTouchExpandable(true);
s2.setContinuousLayout(true);

Here is a sweet tutorial of JSplitPane :
http://java.sun.com/docs/books/tutorial/uiswing/components/splitpane.html

Hope that helps . . .
Javatm
0
 
LVL 92

Expert Comment

by:objects
ID: 10954610
:)
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

Suggested Solutions

Title # Comments Views Activity
compre toata in where clue oracle 4 57
github account with ecipse 1 42
Cipher Configuration on Apache HTTPD 4 53
eclipse argument 14 53
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…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

867 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

20 Experts available now in Live!

Get 1:1 Help Now