no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@67 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
P Santos 22 years ago
parent f2d372d700
commit 85d0773830

@ -29,6 +29,7 @@ public class Importer extends JFrame
public Importer( String filename ) public Importer( String filename )
throws Exception throws Exception
{ {
System.out.println( "File: " + filename );
setupComponents( filename ); setupComponents( filename );
addWindowListener( new WindowAdapter(){ addWindowListener( new WindowAdapter(){
@ -56,8 +57,8 @@ public class Importer extends JFrame
table.getColumn( i ).setResizable( true ); table.getColumn( i ).setResizable( true );
} }
TableColumn col = table.getColumnModel().getColumn( 0 ); // TableColumn col = table.getColumnModel().getColumn( 0 );
col.setHeaderRenderer( new ComboBoxHeaderRenderer() ); // col.setHeaderRenderer( new ComboBoxHeaderRenderer() );
JScrollPane sp = new JScrollPane( table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JScrollPane sp = new JScrollPane( table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
@ -70,7 +71,8 @@ public class Importer extends JFrame
try try
{ {
im = new Importer( im = new Importer(
"C:\\Documents and Settings\\psantos\\My Documents\\Devel\\teste.xls" // "E:\\test.xls"
"C:\\Documents and Settings\\psantos\\My Documents\\Devel\\teste_2.xls"
// "C:\\Documents and Settings\\psantos\\My Documents\\Devel\\Docs\\jexcelapi\\jxlrwtest.xls" // "C:\\Documents and Settings\\psantos\\My Documents\\Devel\\Docs\\jexcelapi\\jxlrwtest.xls"
); );
} }
@ -79,7 +81,14 @@ public class Importer extends JFrame
e.printStackTrace(); e.printStackTrace();
} }
im.show(); if( im == null )
{
System.out.println( "O im e' null" );
}
else
{
im.show();
}
// String[][] all = (String[][]) e.getObjects(); // String[][] all = (String[][]) e.getObjects();
// //
@ -93,36 +102,4 @@ public class Importer extends JFrame
// System.out.println(); // System.out.println();
// } // }
} }
}
class ComboBoxHeaderRenderer extends JComboBox implements TableCellRenderer
{
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex) {
// 'value' is column header value of column 'vColIndex'
// rowIndex is always -1
// isSelected is always false
// hasFocus is always false
// Configure the component with the specified value
// setText(value.toString());
JPopupMenu pm = new JPopupMenu( "Menu" );
pm.add( "Ola" );
pm.add( "Adeus" );
add( pm );
// Set tool tip if desired
setToolTipText((String)value);
// Since the renderer is a component, return itself
//return this;
return this;
}
// The following methods override the defaults for performance reasons
// public void validate() {}
// public void revalidate() {}
// protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {}
// public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
} }
Loading…
Cancel
Save