473,434 Members | 1,559 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,434 software developers and data experts.

How to reset JTable header

madhoriya22
252 100+
Hi,
I am setting the JTable header using setModel() method. Before that I am setting method setAutoCreateColumnsFromModel(boolean) to false. After this I want to change the column header names for localization. But method setAutoCreateColumnsFromModel(boolean) is not allowing to change the column headers, If I change it to true then it changes the layout of the table.

Please suggest any way to change the column header names without changing the layout.

Thanks in advance.

regards,
Amit
Feb 2 '09 #1
3 5795
JosAH
11,448 Expert 8TB
Given the table get the TableColumnModel; given that object get the TableColumns and use the setHeaderValue() method to set the new column headers.

kind regards,

Jos
Feb 2 '09 #2
madhoriya22
252 100+
Hi,
I tried your suggestions, it solved the problem but when I added the new data using addColumn() method. ... it added two new columns in the Jtable but I want to replace the existing columns with the new columns and I am not able to find the way to do it ... Please suggest ?

thanks and regards,
Amit.
Feb 2 '09 #3
JosAH
11,448 Expert 8TB
@madhoriya22
That is an entirely different problem; you can only append or remove columns; you can't directly replace them. Better install an entirely new TableModel.

kind regards,

Jos
Feb 2 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ben Munday | last post by:
Hi all, I have a problem with a Checkbox in a JTable. When i add the Checkbox into the JTable it displays the String representation of the Checkbox, which is not what i want. So, i created a...
1
by: asd | last post by:
I need to make the cells in the 1st column look like the column header. I tried the following code but it didn't change anything: private void rendererTest() { TableColumn column =...
1
by: raysaun | last post by:
I am trying to set a TableCellEditor for a JTable, however, the editor never seems to get called. I can not even get a simplified version (below) to work. When I put a breakpoint on the return...
0
by: sivaprasad06 | last post by:
Hi, I have a editable combo box editor as a cell editor for JTable. I want use only key board to enter data into jtable. so i am using ALT+Down comobination for making cell editiable in the...
0
by: nuria | last post by:
hi, I have an editable JTable, when you are editing it and press F8 shows a dialog and then go again to the JTable window but the focus goes to a JtextField component, go with the tab for the...
1
by: Nelson Joseph | last post by:
Hi all, could you please tell me how to add a chechbox in the JTable column header since I am new to Swing please help me.
7
blazedaces
by: blazedaces | last post by:
Hi guys, what I'm I have is a jtable with boolean variables in the first column and text in the next two (checkboxes). I want my tableChanged method to make it so when I check one of the checkboxes...
5
by: moizpalitanawala | last post by:
Hello friends, How to add data to JTable from a .txt file. I had seen this code from one of the tutorial from java.com. This code doesnt take any input. But shows what is written in the array....
3
by: JHuman | last post by:
Hi all. I've defined a custom TableModel so I can use custom types for my JTable. However, because of this, the table's TableColumnModel is totally out of sync with the model (ie. it isn't populated...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.