Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 501
  • Last Modified:

Adding a splitpane / divider between coulmns in JTable

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
joshidin
Asked:
joshidin
  • 3
1 Solution
 
objectsCommented:
not really, but column widths are user adjustable anyways. what is it u r trying to achieve exactly?
0
 
joshidinAuthor Commented:
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
 
JavatmCommented:
> 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
 
objectsCommented:
:)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now