Locking the Width of a Column in a JTable Component : Table Column « Swing JFC « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » Swing JFC » Table ColumnScreenshots 
Locking the Width of a Column in a JTable Component


import javax.swing.JTable;
import javax.swing.table.TableColumn;

public class Main {
  public static void main(String[] argvthrows Exception {
    int rows = 3;
    int cols = 3;
    JTable table = new JTable(rows, cols);

    TableColumn col = table.getColumnModel().getColumn(0);
    col.setMinWidth(100);
    col.setMaxWidth(100);
    col.setPreferredWidth(100);

  }
}

 
Related examples in the same category
1. Combine TableModel and ColumModelCombine TableModel and ColumModel
2. JTable with a custom column modelJTable with a custom column model
3. A row header column with the TableColumnModelA row header column with the TableColumnModel
4. Install Table Column to TableColumnModelInstall Table Column to TableColumnModel
5. Swing Table Column ToolTip SampleSwing Table Column ToolTip Sample
6. Table ColumnModel and TableColumnModelListenerTable ColumnModel and TableColumnModelListener
7. Table header: Label Header with iconTable header: Label Header with icon
8. Table Headerless SampleTable Headerless Sample
9. Multiline table headerMultiline table header
10. Row Number Table Header
11. Frozen Column Table Header
12. Packing a Column of a JTable Component according to the header text
13. Packing a Column of a JTable Component according to the row data
14. Set column width based on cell renderer
15. Set table column auto-resize off
16. Get the columns from TableColumnModel in the order that they appear in the view
17. Get column count
18. Returns the TableColumn associated with the specified column index in the model
19. Setting the Width of a Column in a JTable Component
20. Disable auto resizing, Set the first visible column to 100 pixels wide
21. Setting the Column Resize Mode of a JTable Component: Disable auto resizing
22. When the width of a column is changed, the width of the right-most column is changed
23. When the width of a column is changed, all columns to the right are resized
24. When the width of a column is changed, only the columns to the left and right of the margin change
25. When the width of a column is changed, the widths of all columns are changed
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.