|
-
problem with Jtable column headings length(code given)
Hi,
I am having a JTable with 6 column headings. I am creating a table model
with these headings and data. I am adding this table to a Jscrollpane. Everything
is fine. I get the data and columns displayed on the ecreen. but, the problem
is the length of all the columns is less than the Jscrollpane and when the
table is displayed the width of all the columns is not reaching the entire
width of the Jscrollpane and I find a gap between the two, which looks very
ackward. I made setResizeMode to be true as in the code below
inportedTable = new JTable(((SubscriberReassignmentModel)model).getInportedTableModelSC0());
addSelectionListener(inportedTable);
outportedTable = new JTable(((SubscriberReassignmentModel)model).getOutportedTableModelSC0());
addSelectionListener(outportedTable);
inportedTable.getTableHeader().setReorderingAllowed(false);
outportedTable.getTableHeader().setReorderingAllowed(false);
inportedTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
outportedTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
inportedTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
outportedTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// scrollpane and set scrollpane properties
spInportedTable = new JScrollPane(inportedTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
spInportedTable.getViewport().putClientProperty("EnableWindowBlit",
Boolean.TRUE);
spOutportedTable = new JScrollPane(outportedTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
spOutportedTable.getViewport().putClientProperty("EnableWindowBlit",
Boolean.TRUE);
spInportedTable.setPreferredSize(new Dimension(950, 450));
spOutportedTable.setPreferredSize(new Dimension(950, 450));
the code for clumns is shown below
private final String[] outportedHeaders = { // Table headers
tablelblobj.getString("LowerLimit "),
tablelblobj.getString("UpperLimit "),
tablelblobj.getString("DestinationIP(A) "),
tablelblobj.getString("DestinationIP(B) "),
tablelblobj.getString("NodeID "),
tablelblobj.getString("Mode "),
};
private final String[] inportedHeaders = { // Table headers
tablelblobj.getString("LowerLimit "),
tablelblobj.getString("UpperLimit "),
tablelblobj.getString("OriginationIP(A) "),
tablelblobj.getString("OriginationIP(B) "),
tablelblobj.getString("NodeID "),
tablelblobj.getString("Mode "),
};
private SubscriberReassignmentTableModel inportedTableModelSC0 = null;
private SubscriberReassignmentTableModel inportedTableModelSC1 = null;
private SubscriberReassignmentTableModel outportedTableModelSC0 = null;
private SubscriberReassignmentTableModel outportedTableModelSC1 = null;
Object[] [] outportedDataSC0;
Object[] [] outportedDataSC1;
Object[] [] inportedDataSC0;
Object[] [] inportedDataSC1;
private Object[] [] inportedErrorList = null;
private Object[] [] outportedErrorList = null;
Please help me if anyone understiid the problem and there is a solution to
it ?
Regards
Satish
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks