Column Spanning JTable Headers
can anyone help me to create spanning column header as excel / HTML?
Look [url http://www.crionics.com/products/opensource/faq/swing_ex/JTableExamples1.html]here for the multi-width header example, which is one of the old gol.com examples.
: jay
Similar Messages
-
Hi,
Is anyone else facing this kind of problem? I have a page with various columns (three). The columns are hosting a narrow, but long table. The introductory paragraphs (title and legend) are spanned across the columns.
Each time I do any edit (applying a text style, deleting a line) InDesign freezes. I get this kind of error in the Console:
12/06/10 13:45:18 [0x0-0x36d36d].com.apple.Safari[30282] Sat Jun 12 13:45:18 MacBook-Pro-di-PaoloT.local Safari[30282] <Error>: CGImageDestinationCreate destination parameter is nil
12/06/10 13:45:18 [0x0-0x36d36d].com.apple.Safari[30282]
12/06/10 13:46:56 /usr/sbin/spindump[91509] process 91490 is being monitored
12/06/10 13:46:57 /usr/sbin/spindump[91509] process 91490 is being force quit
12/06/10 13:46:59 kernel IOHIDSystem::relativePointerEventGated: Capping VBL time to 20000000 (was 26824595)
12/06/10 13:47:03 com.apple.launchd[169] ([0x0-0x528127c].com.adobe.InDesign[91490]) Exited: Terminated
12/06/10 13:47:29 SubmitReport[91514] missing kCRProblemReportProblemTypeKey
12/06/10 13:47:31 /usr/sbin/ocspd[91517] starting
12/06/10 13:47:33 SubmitReport[91514] Submitted compressed hang report for Adobe InDesign CS5
12/06/10 13:50:32 /usr/sbin/spindump[91527] process 91518 is being monitored
12/06/10 13:50:34 /usr/sbin/spindump[91527] process 91518 is being force quit
12/06/10 13:50:38 com.apple.launchd[169] ([0x0-0x5287282].com.adobe.InDesign[91518]) Exited: Terminated
I reported this to Adobe, but I would see if anyoady has a workaround. I solved using the old way (separated text frames), but this prevents one of the features of CS5.
PaoloI tried to reproduce the crashing that Eugene reported, and could not. I have a decent C2D with 4 gigs of RAM, and with those specs all I could do was experience slightly-slower-than-expected performance when working with column-spanning headers. However, when I start my Ubuntu VM, and start the processes that cause it to consume about 2 gigs of RAM, then my system specs degrade to the minimum RAM acceptable to ID (just more than 2 gigs) and I start experiencing multi-second delays.
My hunch is that this particular feature requires more resources than the minimum spec from Adobe... or that a buggy plugin is crashing when it doesn't do garbage collection quick enough to prevent the host system from running out of available RAM. Just a hunch, I'm not a developer at all, but the whole thing smells like a memory leak to me. I could never get it to crash, though, so perhaps I'm only muddying the path with my posts about my attempts to reproduce it. -
Hiding a column in jtable made from DefaultTableModel.
I have made my jtable from DefaultTableModel.
I want to keep one column in the jtable as hidden storing some data containing neccessary information like the "path of the file"
which need not be shown to the user.
Please tell me how I can hide one column in the Jtable.
please provide siome link or code for the same.
Tia,
Sarwadayanandabv wrote:
[http://search.sun.com/search/onesearch/index.jsp?qt=hide+column%2B+JTable&rfsubcat=&col=developer-forums]
My thought exactly.
db -
How to set different renderers to different cells in same column of JTable?
Hello Friends,
I need your help again...
Does any body knows, how to set different renderer's for different cells of same column in JTable..??
For ex.
Col1 Col2 Col3 Col4
A A A A
A A A B
A A A C
A A A D
Where A B C D would be different Renderers. I want set exactly same ,,, ie. one column with different renderer at different cell positions..
Right now i m setting renderer using statement bellow :
table.getColumnModel().getColumn(int).setCellRenderer(rederer_Instance);But with this, effect in the last renderer is applicable whole column....
Can any body help me out ?????????
please refer this thread for similar kind of discussion...
http://forums.sun.com/thread.jspa?forumID=57&threadID=571445Thanks
SuyogPlease refer to the first reply of [this thread|http://forums.sun.com/thread.jspa?forumID=57&threadID=571445] for the answer. If you have a specific problem implementing it, post you code with a specific question.
-
Add and remove columns from JTable
Help me please!
A try to remove column from JTable. It's removed, but when I try to add column in table, then I get all old (removed early) columns + new column....
I completely confused with it.....
Here is my code for remove column:
class DelC implements ActionListener
public void actionPerformed (ActionEvent e )
int [] HowManyColDelete = table.getSelectedColumns();
if (HowManyColDelete.length !=0)
TableColumnModel tableCModel = table.getColumnModel();
for (int i = HowManyColDelete.length-1; i>-1; i--)
table.getColumnModel().removeColumn (tableCModel.getColumn (HowManyColDelete [ i ]));
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
}It's little ex for me, I just try understand clearly how it's work (table models i mean). Here is code. All action with tables take place through menu items.
My brain is boiled, I've try a lot of variants of code, but did't get right result :((
It's code represent problem, which I've describe above. If you'll try remove column and then add it again, it will be ma-a-a-any colunms...
I understand, that my code just hide columns, not delete from table model....
But now I have not any decision of my problem...
Thanks a lot for any help. :)
import javax.swing.*;
import java.awt.*;
import javax.swing.table.*;
import java.awt.event.*;
import javax.swing.table.DefaultTableModel;
class JTableF extends JFrame
Object [] [] data = new Object [0] [2];
JTable table;
DefaultTableModel model;
String [] columnNames = {"1", "2"};
TableColumnModel cm;
JTableF()
super("Table features");
setDefaultLookAndFeelDecorated( true );
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
JMenuBar MBar = new JMenuBar();
JMenu [] menus = {new JMenu("A"), new JMenu("B")};
JMenuItem [] menu1 = {new JMenuItem("Add row"), new JMenuItem("Delete row", 'D'), new JMenuItem("Add column"), new JMenuItem("Delete column")};
menu1 [ 0 ].addActionListener(new AddL());
menu1 [ 1 ].addActionListener(new DelL());
menu1 [ 2 ].addActionListener(new AddC());
menu1 [ 3 ].addActionListener(new DelC());
for (int i=0; i<menu1.length; i++)
menus [ 0 ].add( menu1 [ i ]);
for (int i=0; i<menus.length; i++)
MBar.add(menus );
JPanel panel = new JPanel ();
model = new DefaultTableModel( data, columnNames );
table = new JTable (model);
cm = table.getColumnModel();
panel.add (new JScrollPane(table));
JButton b = new JButton ("Add row button");
b.addActionListener(new AddL());
panel.add (b);
setJMenuBar (MBar);
getContentPane().add(panel);
pack();
setLocationRelativeTo (null);
setVisible (true);
class DelC implements ActionListener
public void actionPerformed (ActionEvent e )
int [] HowManyColDelete = table.getSelectedColumns();
if (HowManyColDelete.length !=0)
TableColumnModel tableCModel = table.getColumnModel();
for (int i = HowManyColDelete.length-1; i>-1; i--)
int vizibleCol = table.convertColumnIndexToView(HowManyColDelete [ i ]);
tableCModel.removeColumn (tableCModel.getColumn (vizibleCol));
//cm = tableCModel;
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
class AddC implements ActionListener
public void actionPerformed (ActionEvent e)
//table.setColumnModel(cm);
Object NewColumnName = new String();
NewColumnName = JOptionPane.showInputDialog ("Input new column name", "Here");
int i = model.getRowCount();
int j = model.getColumnCount();
Object [] newData = new Object [ i ];
model.addColumn ( NewColumnName, newData);
class AddL implements ActionListener
public void actionPerformed (ActionEvent e)
int i = model.getColumnCount();
Object [] Row = new Object [ i ];
model.addRow ( Row );
class DelL implements ActionListener
public void actionPerformed (ActionEvent e)
int [] HowManyRowsDelete = table.getSelectedRows();
if (HowManyRowsDelete.length !=0)
for (int k = HowManyRowsDelete.length-1; k>-1; k--)
model.removeRow (HowManyRowsDelete[k]);
else
JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Row is not selected!");
public static void main (String [] args)
javax.swing.SwingUtilities.invokeLater(new Runnable()
public void run()
JTableF inst = new JTableF(); -
Keyboard Access For a Column in JTable with default editor as JComboBox
I want to get Key board access for a column in JTable.
The user should be able to select from a drop down list for the column with default
editor set as JComboBox.
Presently,it works fine with mouse,also I am able to focus it with Keyboard using
ALT+Up keys,but how to make drop down list appear.
Plz help,it's urgent.
Thanks in AdvanceHi,
In addition to setting DO_SUM = 'X' you need to specify function in H_FTYPE field. It should be set to 'AVG' in your case.
ls_fielcat-do_sum = 'X'.
ls_fieldcat-h_ftype = 'AVG. -
Dynamically set number-columns-spanned
Hi all,
I have a cross tab which has a dynamic number of columns. Each column has a header "Location" (which is determined by the data), but the table also has a master header "Volume" which should span all of the locations. How can I acheive this?
I currently have:
<xsl:attribute xdofo:ctx="block" name="number-columns-spanned">2</xsl:attribute> Volumne
But this is obviously static.
Many Thanks
AndyHi lmd2,
Attached is a quick example of one way to do what you are asking. This is only a general example, and there may be a bettter implementation depending on the architecture of your application. The link here also has information on setting the number of sockets for a specific sequence file. Hope this helps.
Regards,
Ebele O.
National Instruments
Attachments:
ParallelModel.seq 455 KB -
Serial number column in Jtable
Apologies for this distraction.
I read at this forum about a year ago how to add a s/n column in Jtable such that all the nos are automatically updated/adjusted when a row is added/deleted. the count starts from the top down serially and unaffected by sorting.
pls help!thanks a million BaltimoreJohn and especially camickr whose solutions to problems have been most helpful. applying the referenced post, i worked around the problem by resetting the values of the column having the serial number, based on table rowCount every time there is an operation on it(deleting, addition etc)
-
Problem with Hiding Columns in JTable
Hi.
Who knows how to hide column in JTable.
I try to get column:
MyTab.getColumnModel().getColumn(i)But there is no methods like SetVisible(false)
What to DO???http://www.google.com/search?hl=en&q=%2Bhide+%2Bcolumn+%2Bjtable&btnG=Google+Search
-
Programmatically Sorting columns in JTable
Hi,
How can I programmatically sort a particular column in JTable without having to click on column header.
Thanks.to sort the desired column w/o click on header
int columnIndexToSort = 1;
RowSorter.SortKey sortKey = new RowSorter.SortKey(columnIndexToSort,SortOrder.ASCENDING);
ArrayList alist = new ArrayList(1);
alist.add(sortKey);
((DefaultRowSorter)table.getRowSorter()).setSortable(columnIndexToSort , true);
((DefaultRowSorter)table.getRowSorter()).setSortKeys(alist);
((DefaultRowSorter)table.getRowSorter()).sort();expecting dukestars.. -
Hai Friends,
i need suggestions for the following,
How to freeze the columns in swing JTable.?????????????
I need to freeze 3 columns in JTable... how it can be done?
eg: its like the option used in excel for freezing the panes. like that, i need to freeze the column in JTable. so that, it wont be scrolled while scrolling the records, it should also be done in colmns of jtable for horizontal scroll n row for vertical scroll. is this can be done in JTable. Can u pls help me out in this...?
Regards,
Ciya.Did you actually try the code which was pointed out to you when you [url http://forum.java.sun.com/thread.jspa?threadID=701198]asked this question before? It does just what you want...
-
I wont to hide a elected column in JTable.
how it to doTableColumnModel tcm = table.getColumnModel();
TableColumn column = tcm.getColumn( modelIndex );
tcm.removeColumn( column );
Next time, search the forum first. There are at least a dozen posts asking this question. -
Show/hide a column in JTable
I want to show/hide columns in JTable
How is this possible
Note that columns that are hidden may be showed later
thanks in advance
RenjithI tried out for this:TableColumn col = jTable.getColumnModel().getColumn( colnum );
if( col != null )
col.setPreferredWidth( 0 );
col.setMaxWidth( 0 );
}But the column seems to have minimum width which you can't even change with col.setMinWidth( 0 ); -
Dear all,
I want to hide a column in JTable object, I already tried resize it to 0 but the effect is not good, I also cannot remove the column, since I need this column for other process.
So, any other good idea besides resizes and remove?
Thank you very much!I have tried that too, but the column isn't hide, the size is not actually come to 0,...That's because JTable has a default minimum width of 15.... if you want to hide the column, you must set the minwidth as well. For example:
myTable.getColumnModel().getColumn(column_to_hide).setMinWidth(0);
myTable.getColumnModel().getColumn(column_to_hide).setPreferredWidth(0);;o)
V.V. -
To setup scrollbars for individual columns in JTable
Hi,
I need to setup individual scrollbars for the
columns in JTable.
Can anybody help?
Thanks in advance.
Rgds,
sitaHi,
I need to setup individual scrollbars for the
columns in JTable.If i understand you correctly, you want to have a scrollbar for every column. If so, you will need a new instance of JTable and JScrollPane for every column, but that's a lot of work if you want to do it fancy.
The good news, is you can reuse the table model.
You could do something like that.
for (int i= 0; i < model.getColumnCount(); i++) {
JTable table = new JTable();
table.setAutoCreateColumnsFromModel(false);
//container
someContainer.add(new ScrollPane(table), null/* or some layout constrains*/);
TableColumn tc = new TableColumn(i, 120);
tc.setHeaderValue(model.getColumnName(i));
table.addColumn(tc);
Can anybody help?
Thanks in advance.
Rgds,
sita
Maybe you are looking for
-
How do I get Logic to sync to external audio device?
Here is what I am trying to do: I have a Big Ben which I want to use to sync everything together. I have Lynx Aurora converters on the way but for now I need to use a 002 rack with a Presonus DigiMax for audio i/o. So basically, I want to connect BIg
-
From Which table Title is coming ?
Hi Experts, Am currently learning hr abap, while fetching employee personnel details, am not getting from where title(Mr and Mrs) is coming, in screen pa30 it showing that is coming from Q0002 but it is a structure. plz help me to know this. Thanks a
-
LCD dim uneven display on startup-safe to replace or have it diagnosed 1st?
I have a 5 year old G4 12" Powerbook that is well worn and used daily. On startup yesterday, the screen seemed dim- almost too dim to use, and more dim on the left side than the right. I am running a back up just to play it safe, but would it be safe
-
Disappear pavilion dv4 DVD ROM into My Computer
HI Experts I have Pavilion Dv4 Laptop HP, Recently my DVD Rom drive disappear into My Computer TAB. how to recover the same. RGds Pankaj Agarwal
-
HT201364 MacBook Pro 2009 will not down OS X Mavericks -cannot be installed on this computer
I have an MacBook Pro 2009 running 10.6.8 with 3 GB memory and plenty of disk space. So why the error message: OS X Mavericks cannot be installed on this computer??