Column names not visible in JTable
Hello everyone,
i have an Object array columns that i pass to the constructor of JTable, but for some reason the column names are not visible in my table.
private final Object[] columns = {"Zeit", "Termin"};
private Object[][] rows;
//the next line fills the two-dimensional rows-array
fillRows();
//here the constructor
JTable table = new JTable(rows, columns);
table.setColumnSelectionAllowed(false);
table.setDragEnabled(false);
table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
TableColumnModel colModel = table.getColumnModel();
TableColumn column = colModel.getColumn(1);
column.setCellRenderer(new BookedCellRenderer(new int[] {3,4}));What are possible reasons/sollutions for this problem?
Gosh, thanks! Usually i always use a jscrollpane for
jtables and was about to use it too, but i got
confused because of the headers when i tried to see
whether the data in the table was right.You're welcome. The JTableHeaders object can be displayed in, say,
the NORTH part of a BorderLayout while the JTable itself is displayed
int the CENTER part. You can even display the headers SOUTH of
the table itself if you like. A JTable object is quite flexible.
kind regards,
Jos
Similar Messages
-
How to know column name (not an expression) used by function-based index?
Hi guys,
Is there any way to know exact column name used by FBI? If I correct, there is SYS.ICOLDEP$ table that has mapping between index/table columns, but I don't see how it could be uniquely joined with the rest. I know about USER_IND_EXPRESSIONS, but the task is to know exact column name, not it's expression.
This required by our so-called SQL preprocessing of DB schema update utility, which parses stmt (INSERT in our case) and should check against PK/UNIQUE key values.
Thanks!I don't think this is possible in 10g or 11g because :
1. dictionary keeps track of column number in index and not in table
2. the expression used in CREATE INDEX is a system generated column
You would have to parse the expression from USER_IND_EXPRESSIONS:
SQL> create table t(x int, y int);
Table created.
SQL> create index fbi on t(y+1);
Index created.
SQL> column index_name format a10
SQL> column column_name format a20
SQL> column column_expression format a10
SQL> select i.index_name, ic.column_name, ic.column_position as iccn, ie.column_position as iecn, ie.column_expression
2 from user_indexes i , user_ind_columns ic, user_ind_expressions ie
3 where i.index_name = ic.index_name
4 and i.index_name = ie.index_name
5 and i.index_name = 'FBI';
INDEX_NAME COLUMN_NAME ICCN IECN COLUMN_EXP
FBI SYS_NC00003$ 1 1 "Y"+1 -
Strange error "Invalid column name 'not applicable'
When I am trying this piece of code on Solaris 10 having sybase ASE 12.5 installed :
ResultSet rs = stmt.executeQuery("sp_helpdb master");
while(rs.next()){
System.out.println(rs.getString(1));
I am getting the following error:
Invalid column name 'not applicable'
This query returns multiple result sets.
I am able to print all values in the first result set only.
Its failing in rs.next();
I am using jConnect 5.2 driver.
The same query is executing fine on Solaris 8 having ASE 12.0 installed.
If i use :
ResultSet rs = stmt.executeQuery("sp_helpdb master");
then there is no problem in Solaris 10
Plz help me.
Its urgentYou need to use execute() not executeQuery() in the scenario below and use the multi-result set logic
If you are using jConnect, see the samples for an example. -
Setting tooltip when the content of the cell is not visible in jtable
hello,
i want to set a tooltip when the content of the cell is not visible in jtable
please guide me.
thanks
dayathanks for your replay,
i did in this way
final TableColumn colTableColumn = getColumnModel().getColumn(vColIndex);
if (colTableColumn.getWidth() < this.getPreferredSize().width)
setToolTipText(value.toString());
else
setToolTipText(null);
}thanks
daya -
Error in COLMAP clause. Column name not found
Hi guys,
I must be missing something extremely simple here but I can't figure it out. I have a very simple test I am trying to perform. Remap a column from 1 table into another on replicat.
I have created the defgens file.
* Definitions created/modified 2013-02-12 13:08
* Field descriptions for each column entry:
* 1 Name
* 2 Data Type
* 3 External Length
* 4 Fetch Offset
* 5 Scale
* 6 Level
* 7 Null
* 8 Bump if Odd
* 9 Internal Length
* 10 Binary Length
* 11 Table Length
* 12 Most Significant DT
* 13 Least Significant DT
* 14 High Precision
* 15 Low Precision
* 16 Elementary Item
* 17 Occurs
* 18 Key Column
* 19 Sub Data Type
Definition for table BILLING.B1
Record length: 92
Syskey: 0
Columns: 2
B_ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
B_F_NAME 64 30 56 0 0 1 0 30 30 0 0 0 0 0 1 0 0 0
End of definition
Definition for table BILLING.B2
Record length: 92
Syskey: 0
Columns: 2
B_ID 64 50 0 0 0 1 0 50 50 50 0 0 0 0 1 0 1 2
B_L_NAME 64 30 56 0 0 1 0 30 30 0 0 0 0 0 1 0 1 0
End of definition
I have setup the replicat to read the sourcedefs and remap the column
-- Identify the Replicat group:
REPLICAT rxtest
-- State that source and target definitions are identical:
--ASSUMETARGETDEFS
SOURCEDEFS /u12/oracle/golden_gate_11_rep/dirsql/defgen_billing.sql
--Discard Setup
DISCARDFILE /u12/oracle/golden_gate_11_rep/dirout/rxtest.txt , PURGE
SETENV (NLS_LANG="AMERICAN_AMERICA.WE8MSWIN1252")
-- Specify database login information as needed for the database:
USERID gg, PASSWORD
-- Specify error handling rules:
REPERROR (DEFAULT, ABEND)
DDL EXCLUDE ALL
MAP billing.b1, TARGET billing.r1,
COLMAP (
B_ID = id,
b_f_name = f_name);
Now when I try and start the rxtest replicat I get this error in the report.
MAP resolved (entry BILLING.B1):
MAP BILLING.B1, TARGET billing.r1, COLMAP ( B_ID = id, b_f_name = f_name);
...( B_ID = id, b_f_name = f_name...
^
Error in COLMAP clause. Column name not found.
Any ideas? Thanksdesc billing.r1 - does that table have columns that you've included in the map clause?
But, check the ordering of the columns in colmap - it goes target_column_name = source_column_name, looks like you have that reversed.
I don't know why people insist on using SQL file extensions on def files, and placing them in the dirsql directory. What was wrong with using the (already created for you) dirdef directory? And naming the file with an extension like def or defs? It is not a SQL file. -
JTable, column names not appearing!
I am using the following code:
Vector columnNames = new Vector();
Vector data = new Vector();
try
// Connect to the Database
Common.Data.DataAccesser da = new Common.Data.DataAccesser();
Connection connection = da.getConnection();
// Read data from a table
String sql = "Select * from schedule1";
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery( sql );
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
// Get column names
for (int i = 1; i <= columns; i++)
columnNames.addElement( md.getColumnName(i) );
// Get row data
while (rs.next())
Vector row = new Vector(columns);
for (int i = 1; i <= columns; i++)
row.addElement( rs.getObject(i) );
data.addElement( row );
rs.close();
stmt.close();
catch(Exception e)
System.out.println( e );
// Create table with database data
JTable table = new JTable(data, columnNames);
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel2.add(table, BorderLayout.CENTER);I know its a bit messy, wat im tryin to do is add the table to the panel. the rows are showing perfectly but the column names do not show! Can anyone help?1) Please ask Swing questions in the Swing forum.
2) Don't forget to specifically make the table header display. You do this by adding the table header to the jpanel in the borderlayout NORTH position, and you get the table header by calling getTableHeader. Have a look here for instance:
http://forum.java.sun.com/thread.jspa?threadID=5235339&tstart=0 -
JTable Column Names Not Displaying
Hi there
I create a JTable by passing the JTable constructor my custom TableModel which extends AbstractTableModel.
For column names I have a String[] containing the column names in my custom TavleModel and have coded the TableModel methods accordingly.
For some reason when I run the code the table is displayed, but the column names are not!?!
Any advance is appreciated!Sorted!
After looking at sample code in the JTable tutorial, it seems the table likes/needs to be added to a JScrollPane, as once I did this the column headings started appearing.
e.g. JScrollPane scrollPane = new JScrollPane(table); -
JScrollPane scroll setting first column is not visible?
Hi All,
i am using jtable and jscrollpane. in this my first column of 70 pixal width and rest 125 pixal width.set focus is on 1 cell(1 row, 1 column) in table. but due to this scrollbar is slightly on right side whice coz first column not visible.(need to drag for visibility). i am trying to make it visible without dragging.
how to do this? HELP.
i tried with tableScroll.scrollRectToVisible(table.getCellRect(0,0,true )); & -1,-1
but it didnt worked.
Code is like this..........
table = new JTable(64,65){
table.setName("Table");
((DefaultTableModel)table.getModel()).setColumnIdentifiers(vectName.getColumnIdentifiers());
for(int i = 0;i<table.getRowCount();i++) {
table.setValueAt((i+1)+"",i,0);
table.setGridColor(Color.black);
table.setSelectionBackground(new Color(125,255,144));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setCellSelectionEnabled(true);
table.addKeyListener(listener);
table.addMouseListener(listener);
table.getSelectionModel().addListSelectionListener(this);
table.getColumnModel().addColumnModelListener(this);
table.getColumnModel().getColumn(0).setResizable(false);
table.getColumnModel().getColumn(0).setMinWidth(70);
table.getColumnModel().getColumn(0).setMaxWidth(70);
JScrollPane tableScroll = new JScrollPane(table);
Dimension minimumSize = new Dimension(100,25);
tableScroll.setMinimumSize(minimumSize);
add(tableScroll);Hi weebib ,
pls find some working code which shous my problame .
you can see its coming to column 'B'. but i want it to show from column 'A' .
sample working code : =
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.table.*;
import java.util.*;
public class myTable extends JFrame{
JTable table;
JScrollPane jsp;
JPanel p1;
int NO_OF_ROWS = 64;
int NO_OF_COLUMNS = 65;
Vector vColumnNames ;
myTable(){
Container con = getContentPane();
p1 = new JPanel();
table = new JTable(NO_OF_ROWS,NO_OF_COLUMNS){
public boolean isCellEditable(int row, int column) {
if(column == 0){
return false;
else{
return true;
setTableProperties();
jsp = new JScrollPane(table);
p1.add(jsp);
con.add(p1);
setSize(400,500);
show();
//System.out.println("Hello there");
public Vector getColumnIdentifiers(){
vColumnNames = new Vector();
for(int i=65;i<129;i++) {
vColumnNames.add(new String((char)i+""));// setting the alphabets for the column names //orig
return vColumnNames ;
public void setTableProperties(){
((DefaultTableModel)table.getModel()).setColumnIdentifiers(getColumnIdentifiers());
for(int i = 0;i<table.getRowCount();i++) {
table.setValueAt((i+1)+"",i,0);// Set the names of the row
table.setGridColor(Color.black);
table.setSelectionBackground( Color.RED);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
table.setCellSelectionEnabled(true);
table.addMouseListener(new myMouseListener());
table.addKeyListener(new myKeyListener());
// table.getColumnModel().getColumn(0).setPreferredWidth(125);
// table.getColumnModel().getColumn(0).setResizable(false);
// table.getColumnModel().getColumn(0).setMinWidth(70);
// table.getColumnModel().getColumn(0).setMaxWidth(70);
for(int u =0 ;u<64;u++){
if(u==0){
table.getColumnModel().getColumn(u).setPreferredWidth(70);
else{
table.getColumnModel().getColumn(u).setPreferredWidth(200);
table.changeSelection(0,1,false,false);
static public void main(String[] args){
myTable test = new myTable();
test.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){System.exit(0);}
public class myMouseListener extends MouseAdapter{
public void mousePressed(MouseEvent me){
table.repaint();
public class myKeyListener extends KeyAdapter{
public void keyPressed(KeyEvent ke){
if(table.getSelectedColumn() == 0){
ke.consume();
================
pls do reply back if i am doing something wrong.
== Gavin -
APEX 4.0 "Use Generic Column Names" not working
Hi,
I have a report which is a SQL query (PL/SQL function body returning SQL query) in APEX 4.0. For this region i have selected the option "Use Generic Column Names (parse query at run time only)".
For some reason when I run the page the browser just shows the error "The requested URL /apex/f was not found on this server". This happens only for the region type "SQL query (PL/SQL function body returning SQL query)" . If I choose the report region as SQL query and select the option "Use Generic Column Names (parse query at run time only)" That works fine. This happens only in APEX 4. Is it an apex 4 bug or am I missing something?
Thanks
Sashika.Hi,
Just managed to get it running. The Apex 4.0 SQL query (PL/SQL function returning SQL) works just fine. I had a small error in the query itself. In the PL/SQL function I had a referenced page item whose value in the initial run is set to null which is making the fuzz. Just adding an NVL resolved the problem. -
Member names not visible in ASO database
Hi,
I created a metaoutline in EIS to load an ASO cube.
I was trying to load members from EIS and the member load was completed successfully.
When i checked the cube from Essbase Admin console, i can see that the outline has been created but the member names are not visible in the outline - the weirder thing is that the aliases and formulae of members are visible in the outline.
What could be the possible cause for this behaviour?
Thanks,
Rahul.Hi,
Do you guys have an idea as to why this could be happening? I'm trying to tune some BSO cubes which run for hours together and trying to convert them to ASO but am stuck at this point!
Thanks,
Rahul. -
Lookup columns values not visible in Sharepoint designer
I had created a lookup column for a list.
I had generated a stp and created a new list in the new environment.
The lookup columns were not working, so i created new columns with the existing name.
But when i eid t aview in designer, i dont seem to find the clumn values.
Could you please help.Hi,
It is known issue that on exporting list items, look up column values are lost.
For your issue, you can take steps as below to retain look up column values in export list template:
1. Browse to the source Web’s lookup list “Sub Category” and choose Modify settings and columns.
2. Copy the source lookup list GUID from the URL. It should be a sequence of numbers and letters similar to: %7BFFA47BF8%2D849C%2D4F20%2D9C50%2D173D2F5B6725%7D.
3. Browse to the destination Web’s lookup list and choose Modify settings and columns.
4. Copy the destination lookup list GUID from the URL. Similar as point 2.
5. Delete %2D from the string and replace with a dash sign (-). There should be no dash sign (-) at the start and the end. GUID should be in the following format: FA47BF8-849C-4F20-9C50-173D2F5B6725
6. Save the source Web’s list that contains a lookup column “Category” to the lookup list as a list template called category.stp.
7. Export the list template STP from the source list template gallery to the file system.
8. Rename the category.stp file to category.cab so Windows can open it.
9. Open the file, right click on the manifest.xml file and export it to the file system.
10. Edit the manifest.xml file; find the source Web’s lookup list GUID and replace it with the destination Web’s lookup list GUID.
11. Save the manifest.xml file.
12. Open a VS.NET command prompt.
13. Run the makecab command as: makecab manifest.xml category.stp
14. Import the new STP into the destination Web’s list template gallery. You will need to delete it if it has previously been imported.
Reference:
http://sharepointknowledgebase.blogspot.com/2012/09/retain-look-up-column-values-in-export.html#.VPg8d3kcQiQ
Best Regards,
Eric
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
I am using the following to return a results set from SQL Server and writing it to a text file. The data in the writes to the file, but I can not get the column name to write to the file.
flNewExcelFile oflTemp = new flNewExcelFile();
File flTemp = oflTemp.svFile();
BufferedWriter outData = new BufferedWriter(new FileWriter(flTemp));
String dtRow;
ResultSet rsRs = rsSPResult.rsObj();
ResultSetMetaData mtdData = rsRs.getMetaData();
int cols = mtdData.getColumnCount();
for (int i=1;i<=cols;i++)
dtRow = mtdData.getColumnName(i);
outData.write(dtRow);
outData.newLine();
while (rsRs.next())
for (int i=1;i<=cols;i++)
dtRow = rsRs.getString(mtdData.getColumnName(i));
outData.write(dtRow);
outData.newLine();
outData.close();
I am connecting to the data via a DSN-Less connection:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String sourceURL = "jdbc:odbc:DRIVER={SQL Server}; Server=ServerName;Database=dataBaseName";
databaseConnection = DriverManager.getConnection(sourceURL,"UserID","PW");
And creating the results set:
Statement sqlStatement = conn.createStatement();
ResultSet rsData = sqlStatement.executeQuery("Select * From Contract");
TIAbut I can not get the column name to write to the file.what happens?
looks like you are writing an m$ excel sheet.
1. you are possibly missing something in the steps needed to get column names into you flNewExcelFile object.
2. are you getting the columns names as a row, rather than the header?
if that is so, you might have to write the column names in some particular manner.
3. what is this flNewExcelFile class. the documentation to flNewExcelFile might give you the answer, if it is a third party class. -
Table column names not getting displayed
Hi
When i do a SELECT statement i am not getting the column names
SQL> SELECT * FROM EE;
aa physics 100
bb physics 200
PLease let me know how can i set it.
Thank you
Marium ThomasDid you modify some of the default settings (e.g. HEADING or PAGESIZE)?
Try
set heading onhttp://download-uk.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1011230 -
Column Name not displaying in WinXP
Hi,
I have a custom JTable that has the contructor :
public CustomMatrixTable(TableModel dm)
super(dm);
setAutoCreateColumnsFromModel(true);
setColumnSelectionAllowed(true);
setRowSelectionAllowed(true);
setCellSelectionEnabled(true);
setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
The table model has overrides the getColumnName by retriving the name from a Vector.
There are two coulmns in my example but the number can vary.
In Windows 2000 it work perfectly. In XP the first column's name can be displayed but not the next.
In fact the column header does not appear.
please help.
thanks
Phillok, it would seem that the work around is to declare a TableCellRenderer to be assigned as the column's header renderer. Unfortunately I have to do it for each column, nice if you want to make colourful column headers, but really one should be able to assign the column header renderer to be used by all column headers.
-
How to Set column value in SO matrix , if the column is not visible.
Hi,
We are trying to set value in to a column from sales order matrix with the below mentioned code
((SAPbouiCOM.EditText)oMat.Columns.Item("U_TWBS_AC_BaseEntry").Cells.Item(pVal.Row).Specific).String
it will throw an u201CForm Item is not editable u201C error if the column ("U_TWBS_AC_BaseEntry") visible is set to false through form settings.
how can we solve the issue,can we use any DI object in order to reset the form settings.
Thanks & RegardsHi
Try and make the column visible then set the value and make it invisible then
Hope this helps
Regards
Vivek
Maybe you are looking for
-
Project wise profitability analysis
Hi I have to create MIS for project wise profitability analysis . In sales order we used additional tab as project and we assigned projects to each and every sales order Now they want one Report "Project wise profitability analysis" . So i have do t
-
Do i have to connect ipad to a computer for it to be recognized as a device in itunes?
My son has his own Apple Id but I did not want to connect to my computer. Do I have to connect it to the computer to have it recognized in iTunes?
-
ORA_02309 Atomic NULL violation
Hi all, When I try to update the folowing i get an error message: update adressen_geom T set T.coordgeocodepoint.sdo_srid=90112; Now error ORA_02309 occurs. So if i choose to name the objecttype like somerwhere else in this forum and write it like th
-
What is the advantage and features of having a sky...
what are the cost advantages of having a skype phone number and its features ? Cheers Harvey
-
I need my label to remember the value of the previous number in item renderer
I have a label used as an item renderer and the dataprovider frequently changes. I need my label to remember the value of the previous number it was assigned to {data.ask} but am having trouble doing this. Any ideas how to do this?