Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
JTable header problem
Anand Loni
Ranch Hand
Posts: 150
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
I am using JTable with three columns and I want ot align text of second column header to left. Any Idea how to do this.
Thanks,
Anand
~ Anand,
SCJP 1.5, SCWCD 1.5
Michael Dunn
Ranch Hand
Posts: 4632
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
table.getTableHeader().setDefaultRenderer(new DefaultTableCellRenderer(){ public Component getTableCellRendererComponent(JTable table,Object value, boolean isSelected,boolean hasFocus,int row,int column){ JLabel lbl = (JLabel)super.getTableCellRendererComponent(table,value,isSelected,hasFocus,row,column); if(column == 1) lbl.setHorizontalAlignment(JLabel.LEFT); else lbl.setHorizontalAlignment(JLabel.CENTER); lbl.setBorder(UIManager.getBorder("TableHeader.cellBorder")); return lbl; } });
Anand Loni
Ranch Hand
Posts: 150
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks Michael.
~ Anand,
SCJP 1.5, SCWCD 1.5
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JTable Header
JTable
JTable
JTable
JTable
More...