(URGENT) jCheckBox in jTable

I have a jTable inwhich I would like to have a column of jCheckBox.
I can I do that ???

class MyTableModel extends AbstractTableModel
   //These are the object Types of the columns represented by this TableModel
    static final Class[] COLUMN_TYPES = new Class[]{
        String.class, Boolean.class, Integer.class, etc...};
    //without getColumnClass() only Strings are displayed
    //this method is what displays the Boolean class as a checkBox etc.
    public Class getColumnClass(int column)
        return COLUMN_TYPES[column];
}

Similar Messages

  • JCheckBox in JTable..urgent!!!

    hello all, can you please help me on how to add JCheckBox on each row of JTable?..the value of JCheckBox is not true or false..i just use it for user options.. please help!!

    Are you trying to create a checkbox in each row or just a few? Let me know.
    Yinka...

  • Can not show the JCheckBox in JTable cell

    I want to place a JCheckBox in one JTable cell, i do as below:
    i want the column "d" be a check box which indicates "true" or "false".
    String[] columnNames = {"a","b","c","d"};
    Object[][] rowData = {{"", "", "", Boolean.FALSE}};
    tableModel = new DefaultTableModel(rowData, columnNames);
    dataTable = new JTable(tableModel);
    dataTable.getColumnModel().getColumn(3).setCellEditor(new DefaultCellEditor(new JCheckBox()));
    But when i run it, the "d" column show the string "false" or "true", not the check box i wanted.
    I do not understand it, can you help me?
    Thank you very much!
    coral9527

    Do not use DefaultTableModel, create your own table model and you should implement the method
    getColumnClass to display the boolean as checkbox ...
    I hope the following colde snippet helps you :
    class MyModel extends AbstractTableModel {
              private String[] columnNames = {"c1",
    "c2"};
    public Object[][] data ={{Boolean.valueOf(true),"c1d1"}};
         public int getColumnCount() {
         //System.out.println("Calling getColumnCount");
         return columnNames.length;
    public int getRowCount() {
    //System.out.println("Calling row count");
    return data.length;
    public String getColumnName(int col) {
    return columnNames[col];
    public Object getValueAt(int row, int col) {
    return data[row][col];
    * JTable uses this method to determine the default renderer/
    * editor for each cell. If we didn't implement this method,
    * then the last column would contain text ("true"/"false"),
    * rather than a check box.
    public Class getColumnClass(int c) {
    return getValueAt(0, c).getClass();
    * Don't need to implement this method unless your table's
    * editable.
    public boolean isCellEditable(int row, int col) {
    //Note that the data/cell address is constant,
    //no matter where the cell appears onscreen.
    return true;
    * Don't need to implement this method unless your table's
    * data can change.
    public void setValueAt(Object value, int row, int col) {
    data[row][col] = value;
    fireTableCellUpdated(row, col);

  • Booleans not rendering as JCheckBoxes in JTable

    I've read several posts on trying to get JCheckBoxes to render in a JTable, and I've looked at the Tables tutorial, but I still can't figure out why my JTable isn't rendering Booleans as check-boxes. :-(
    I thought rendering check-boxes was the the default behavior for cells with Boolean values. This doesn't seem to be the case. I can add a cell editor of type JCheckBox by simply instantiating a new DefaultCellEditor, but adding a cell renderer doesn't look so easy (I believe I have to create my own implementation class). I was trying to avoid that, because a) I'm working in Servoy (which means I'm working in a Rhino editor and need to access my own custom classes as plugins or beans), and b) my Java skills are weak.
    So can anybody see anything about my code that is obviously wrong? Or do I have to roll up my sleeves and write my own DefaultTableCellRenderer bean/plugin?
    Here's my code (remember - it's javascript instances of java objects). (Note: I'm not sure exactly what kinds of objects JSDataSet.getAsTableModel() returns to the JTable model, but creating my own JTable with a vector of vectors of Boolean objects, or setting a Boolean in the cell after the fact doesn't work either.)
    Any tips would be greatly appreciated.
    // convert dataset into JTable
    var table = elements.monitoring;
    table.model = treatments.getAsTableModel();
    // modify column headers
    var columns = table.columnModel;
    columns.getColumn(0).setHeaderValue('Quantity');
    columns.getColumn(0).setPreferredWidth(60);
    columns.getColumn(1).setHeaderValue('Repeats/hr.');
    columns.getColumn(1).setPreferredWidth(75);
    columns.getColumn(2).setHeaderValue('TREATMENT');
    columns.getColumn(2).setPreferredWidth(225);
    // start treatment times at 8am
    var j=8;
    for (i=3;i<44;++i) {
         var j_int = Packages.java.lang.Integer(j);
         columns.getColumn(i).setHeaderValue(j_int);
         columns.getColumn(i).setPreferredWidth(10);
         if (j == 12) {
              j=0;
         ++j;
    // center cell data
    var cell_class = Packages.java.lang.String;
    var table_renderer = table.getDefaultRenderer(cell_class);
    table_renderer.setHorizontalAlignment(0);
    // add JTable to JScrollPane viewport (necessary to display headers)
    var viewport = elements.monitoring_pane.viewport;
    viewport.add(table);

    Ok, another problem -
    I wound up throwing out the Rhino constructor method and implementing my own JTable class and importing it into the Rhino scope. I had to do that because I needed columns to render different types of objects - basically, the table cells should appear blank until they are selected and data is added to them, at which point they should be Boolean and render check-boxes - I got that to work by overriding the getCellRenderer method.
    The problem is, I need to add some logic to the 'onClick' event for the table cell, so that I can add a blank check box, add a checked check box, or remove a check box. I looked at the Table tutorial and tried to do it by implementing the TableModelListener interface on my JTable and defining the tableChanged method. However, when I add the tableChanged method to my class, I get an ArrayIndexOutOfBoundsException.
    Any tips would be greatly appreciated.
    I instantiate the class in Rhino and add the TableModelListener like so:
    var table = new Packages.my_classes.MyJTable();
    table.model = model; // a working model defined elsewhere
    table.getModel().addTableModelListener(table);Here's my class:
    package my_classes;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    public class MyJTable extends JTable implements TableModelListener {
         public TableCellRenderer getCellRenderer(int row, int column) {
              Object value = getValueAt(row,column);
                if (value == null) {
                     return getDefaultRenderer(JCheckBox.class);
                return super.getCellRenderer(row,column);
         public Class getColumnClass(int column) {
              if (column > 2) {
                   return Boolean.class;
              } else {
                   return Object.class;
         public void tableChanged(TableModelEvent e) {
              int row = e.getFirstRow();
              int column = e.getColumn();
              TableModel model = (TableModel) e.getSource();
              String columnName = model.getColumnName(column);
              Object data = model.getValueAt(row, column);
    }

  • Double clicking for editing JCheckBox in JTable under java 1.6?

    Hi all,
    I have a JTable with JCheckboxes in a column (and associated renderer and editor). All worked good with/until java 1.5.
    Now with java 1.6 I have to click two times on the checkbox in order to change the selection...
    Anyone has experimented a similar problem??

    I have spent some hours over this strange problem finding no way to solve it and no workaround.
    Could this be a bug introduced with java 1.6?
    Note that the behaviour is more strange as what I hade described in my last post:
    - mouse click on a cell with a checkbox: checkbox CHANGE state
    - mouse click on other celll with checkbox: NO EFFECT
    - click on other celll: checkbox CHANGE state
    - click on other celll: NO EFFECT
    - click on other celll: checkbox CHANGE state
    - click on other celll: NO EFFECT
    - click on other celll: checkbox CHANGE state
    - click on other celll: NO EFFECT
    - ... and so on
    Really strange, at least for me...

  • How to insert jcheckbox in jtable

    hello
    i am user of oracle9i jdeveloper using jclient/swing .
    question:
    how to insert jcheckbox at a particular cell in jtable.
    please reply to me if anyone amongst you know the solution.
    thank you

    Please continue the discussion here: how to insert checkbox at a particular  cell  in jtable
    Correct me if this is not about the same subject.

  • Adding JcheckBox in JTable

    Hi there,
    I have a JcheckBox in a JTable. Whenever I click the Checkbox , on that particular cell it display true , when Clicked and false when I click again. Is there any way that I could disable that ?, I also wanted to center the Jcheckbox ?
    Thanks

    Similar way I'm using in other class & it is working.But a JTable is not the same as other components, which is why you should be using Boolean values.
    You responded to my post 12 minutes after I posted my reply. That did not give you enough time to read the tutorial and understand how to use a JTable correctly!!!

  • Adding JCheckBox into JTable

    Hi all,
    I added a JCheckBox into a JTable, while clicking the check box the selection will not replicate into the JTable. Please help me to resolve this issue.
    * TableDemo.java
    * Created on September 5, 2006, 11:49 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package simPackage;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.ButtonGroup;
    import javax.swing.DefaultCellEditor;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.*;
    * @author aathirai
    public class TableDemo extends JPanel{
       // public JRadioButton[] dataButton;
        /** Creates a new instance of TableDemo */
        public TableDemo() {
            JCheckBox firstCheck = new JCheckBox("");
            Object[][] data={{firstCheck,"2","4","5","2"}};
                    String[] columnNames={"qr No","supplier kt code","part no","start date","end date"};
                    JTable searchResultTable = new JTable(data,columnNames);
                    searchResultTable.getColumn("qr No").setCellRenderer(new RadioButtonRenderer());
                    searchResultTable.getColumn("qr No").setCellEditor(new RadioButtonEditor(firstCheck));
            JScrollPane scrollPane = new JScrollPane(searchResultTable);
            //Add the scroll pane to this panel.
            add(scrollPane);
    public static void main(String args[])   {
         JFrame jFrame  = new JFrame("testing");
         jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            TableDemo newContentPane = new TableDemo();
            newContentPane.setOpaque(true); //content panes must be opaque
            jFrame.setContentPane(newContentPane);
            //Display the window.
            jFrame.pack();
            jFrame.setVisible(true);
    class RadioButtonRenderer implements TableCellRenderer {
        public JCheckBox check1 = new JCheckBox("");
      public Component getTableCellRendererComponent(JTable table, Object value,
       boolean isSelected, boolean hasFocus, int row, int column) {
          check1.setBackground(Color.WHITE);
         return check1;
    class RadioButtonEditor extends DefaultCellEditor{
        public JCheckBox check1 = new JCheckBox("");
      boolean state;
      int r, c;
      JTable t;
      class RbListener implements ActionListener{
        public void actionPerformed(ActionEvent e){
          if (e.getSource() == check1){
            state = true;
          else{
            state = false;
          RadioButtonEditor.this.fireEditingStopped();
      public RadioButtonEditor(JCheckBox checkBox) {
        super(checkBox);
      public Component getTableCellEditorComponent(JTable table, Object value,
       boolean isSelected, int row, int column) {
        RbListener rb = new RbListener();
        t = table;
        r = row;
        c = column;
        if (value == null){
          return null;
        check1.addActionListener(rb);
         //check1.setSelected(((Boolean)value).booleanValue());
        /*if (((Boolean)value).booleanValue() == true){
          check1.setSelected(true);
        return check1;
      public Object getCellEditorValue() {
        if (check1.isSelected() == true){
          return Boolean.valueOf(true);
        else{
          return Boolean.valueOf(false);
    }Thanks in advance.

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    class TableDemo extends JPanel
      public TableDemo()
        //JCheckBox firstCheck = new JCheckBox("");
        //Object[][] data={{firstCheck,"2","4","5","2"}};
        Object[][] data={{new Boolean(false),"2","4","5","2"}};
        String[] columnNames={"qr No","supplier kt code","part no","start date","end date"};
        JTable searchResultTable = new JTable(data,columnNames);
        //searchResultTable.getColumn("qr No").setCellRenderer(new RadioButtonRenderer());
        //searchResultTable.getColumn("qr No").setCellEditor(new RadioButtonEditor(firstCheck));
        TableColumn tc = searchResultTable.getColumnModel().getColumn(0);
        tc.setCellEditor(searchResultTable.getDefaultEditor(Boolean.class));
        tc.setCellRenderer(searchResultTable.getDefaultRenderer(Boolean.class));
        JScrollPane scrollPane = new JScrollPane(searchResultTable);
        add(scrollPane);
      public static void main(String args[])
        JFrame jFrame  = new JFrame("testing");
        jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        TableDemo newContentPane = new TableDemo();
        newContentPane.setOpaque(true); //content panes must be opaque
        jFrame.setContentPane(newContentPane);
        jFrame.pack();
        jFrame.setVisible(true);
    }

  • Need urgent help on JTable and cell

    Hi,
    I've got problem in validating the cell in Table.
    If user enters data in a cell i would like to validate the data in cell and if it is wrong i would like to give a dialog and keep the cursor in the same cell. So that i can restrict the user to enter valid data.
    How do i capture the event when he is leaving the cell using tab/mouse press?
    Suppose if the cursor is in once cell from a row (the rew contains different cell renderers,) then he wish to delete the row then i would like to save the data in the model and delete it.
    I'm getting class cast exception as i have got differnt components inside row.
    Thanks

    Hi,
    Try out the following code.
    import javax.swing.*;
    import javax.swing.table.*;
    class EditingTest
         EditingTest()
              JFrame frame = new JFrame("Editing Test");
              frame.setBounds(10,10,750,550);
              JTable table = new JTable(5,5);
              TableCellEditor tableCellEditor = new CustomEditor(new JTextField());
              for(int i = 4; i > -1; --i)
                   table.getColumnModel().getColumn(i).setCellEditor(tableCellEditor);
              JScrollPane scrollpane = new JScrollPane(table);
              frame.getContentPane().add(scrollpane);
              frame.setVisible(true);
         public static void main(String [] args)
              EditingTest appln = new EditingTest();
    class CustomEditor extends DefaultCellEditor
         CustomEditor(JTextField editorComponent)
              super(editorComponent);
         public boolean stopCellEditing()
              try
                   String editingValue = (String)getCellEditorValue();
                   if(editingValue.length() != 5)
                        JOptionPane.showMessageDialog(null,"Please enter string with 5 letters.", "Alert!",JOptionPane.ERROR_MESSAGE);
                        return false;
              catch(ClassCastException exception)
                   return false;
              return super.stopCellEditing();
    }

  • Urgent :problem with JTable on server program

    hi all i am writing an internet cafe timer.there is a table with the following colums:PC Name,IP Address,Status,Time Left, Time Login. ,on the server GUI. Whenever a client connects,a new row having the clients details is added to the table model, which reflects on the table.but if a client disconnects and reconnects, i want it to search thru the rows in the model, if there is a row with its information already,it shouls simply update the status column to "Reconnected", and not add an entirly new row, but if there is no row with its information, it can then add a new row with its information.
    Simply put, when a client connects,it should check
    1)if the table is empty, add a new row;
    2)else, check if tabe already has a row for the client, then update the row,else add a new row.
    its not working this way.it only works for the first client to connect,if other clients connect and disconnect,it still adds a new row, instaed of updating.
    the method doTable() in class ClientThread is what i use .please check it out and help me.
    i have a thread for each client.when a client connects, the server starts the thread and passes an instance of the server ui to the thread, so the threads acess the tablemodel thru this instance.
    Here is a simple run down of my classes
    CafeServer.java
    * @(#)CafeServer.java
    * @author obinna
    * @version 1.00 2007/3/10
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    import java.sql.*;
    public class CafeServer {
         int serverPort;
         int serverLimit;
         //ServerSocket serversocket;
         private static int rownum = -1;
         private static Connection conn;
         private static CafeServerUI serverUI;
    * Creates a new instance of <code>CafeServer</code>.
    public CafeServer() {
         try{
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              conn = DriverManager.getConnection("jdbc:odbc:cafetimer","","");
              System.out.println("connection established with cafetimer database");
         }catch(Exception ex){
              JOptionPane.showMessageDialog(null,"Cannot find database");
              serverUI = new CafeServerUI( this,conn );
    public void closeServer(){
         System.exit(0);
    public static void main(String[] args) throws IOException{
    // TODO code application logic here
    try{
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
         new CafeServer();
    catch(Exception ex){
         JOptionPane.showMessageDialog(null,"Could Not Find System Look and Feel.\nDefault L&F Loaded.");
         JFrame.setDefaultLookAndFeelDecorated(true);
    ServerSocket serverSocket = null;
    boolean listening = true;
    try {
    serverSocket = new ServerSocket(4444);
    } catch (IOException e) {
    System.err.println("Could not listen on port: 4444.");
    System.exit(-1);
    while (listening)
         new ClientThread(serverSocket.accept(),serverUI,conn).start();
    serverSocket.close();
    CafeServerUI.java
    //import statements.......................................
    public class CafeServerUI extends JFrame{
         public Vector pins = new Vector<String>();
         public DefaultTableModel model;
         public JTable table;
         protected JTextArea msgarea;
         protected JScrollPane scrpane;
         protected JPanel mainp,northp,leftp,rightupp,rightp;
         protected String[] colnames = {"Computer Name","IP Ad
    .............................................................constrctor follows
    ClientThread.java
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    public class ClientThread extends Thread{
         private Socket socket = null;
         private String pin, timeleft, pin3,timeleft3,tleft;
         private CafeServerUI csui = null;
         private Ticket ticket;
         private RemainingTime remtime;
         private String hostname,ipadd;
         private int rownum;
         private Connection conn;
         private Statement stmt;
         private ResultSet rs;
         private boolean found;
         public ObjectOutputStream outputStream;
         public ObjectInputStream inputStream;
         private Admin admin;
         boolean found2 = false;
         //private String[] newrow = new String[5];
    public ClientThread(Socket socket,CafeServerUI csui,Connection conn) {
              super("Client Thread");
              this.socket = socket;
              this.csui = csui;
              this.conn = conn;
              try{
                   stmt = this.conn.createStatement();
              }catch(Exception ex){
                   System.out.println(ex.getMessage() + " : " + ex);
              //this.rownum = rownum;
              hostname = this.socket.getInetAddress().getHostName();
              ipadd = this.socket.getInetAddress().getHostAddress();
              //sString[] newrow = {hostname,ipadd,"Connected","",""};
              doTable();
              //System.out.print("table row " + this.rownum);
              this.csui.oos.addElement(ClientThread.this);
    public void doTable(){
         String[] newrow = {hostname,ipadd,"Connected","",""};
         if(this.csui.model.getRowCount() == 0){
                   this.csui.model.addRow(newrow);
              }else{
                   for(int i=0; i < this.csui.model.getRowCount(); i++ ){
                        String hname = (String)this.csui.model.getValueAt(i,0);
                        if(hname.equalsIgnoreCase(hostname)){
                             this.csui.model.setValueAt("Re Connected",i,2);
                             break;
                        }else{
                             this.csui.model.addRow(newrow);
                             break;
    .....public void run()....

    In the UI is defined the InputMap/ActionMap pair to respond to keys. There is defined an action for ENTER. I have had the same problem, and the only thing that worked for me was to clear the actionMap, and reassign some keys to their original action, and some (e.g. ENTER, TAB) to my actions. This worked. With TAB is harder beacuse i guess it's deeper in the JVM implemented, but after a while i've managed to overwrite that too.

  • Click on JCheckBox in JTable gets me a NullPointerException

    Hi everyone,
    The subject says almost everything : I have a JTable with one colum with check boxes and another one with combo boxes. When I select a check box the value of the combo box of the same line is updated but for some reason I get the following exception :
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicTableUI$Handler.setValueIsAdjusting(BasicTableUI.java:923)
         at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(BasicTableUI.java:1136)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
         at java.awt.Component.processMouseEvent(Component.java:6263)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
         at java.awt.Component.processEvent(Component.java:6028)
         at java.awt.Container.processEvent(Container.java:2041)
         at java.awt.Component.dispatchEventImpl(Component.java:4630)
         at java.awt.Container.dispatchEventImpl(Container.java:2099)
         at java.awt.Component.dispatchEvent(Component.java:4460)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
         at java.awt.Container.dispatchEventImpl(Container.java:2085)
         at java.awt.Window.dispatchEventImpl(Window.java:2478)
         at java.awt.Component.dispatchEvent(Component.java:4460)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    The updating of the combo box column is done as following :
              final int row = evt.getLastRow();
              if ( (Boolean) this.table.getValueAt(row, CHECKBOX_COL) ) {
                   final Object o = // some non-null object
                   this.table.setValueAt(o, row, COMBOBOX_COL);
              this.table.repaint(0);
    The object o is one of the items stored by the combo box so no inconsistency on that side.
    Any help welcome !
    Julien

    I can't provide a SSCCE because of the numerous non-free libraries I'm using.
    Anyway, here's what I found out so far :
    As the StackTrace tells us the method that throws the exception is setValueIsAdjusting
            private void setValueIsAdjusting(boolean flag) {
                table.getSelectionModel().setValueIsAdjusting(flag);
                table.getColumnModel().getSelectionModel().
                        setValueIsAdjusting(flag);
            }Here table is null, which obviously throws the exception. It has been set to null by calling the BasicTableUI.uninstallUI method.
    So my questions are :
    Why would the uninstallUI method be called before the other calls ?
    Is there a way to controll the calls to this method ?
    Is there a way to get the setValueIsAdjusting method to be called before ?
    regards
    Julien

  • (URGENT) problem with JTable: can't catch ENTER and control focus in JTable

    I hava a JTable and a AbstractTableModel.
    Here is what i want to DO.
    When I press the ENTER or TAB I want to set focus to cell wich is 2 position away from the the sell I am editing
    on the same row in the JTable. How can I do this.
    in fact, that is my real question HOW to ?
    When I press the ENTER or TAB in JTABLE I want to tell to JTable which cell to grab the focus

    In the UI is defined the InputMap/ActionMap pair to respond to keys. There is defined an action for ENTER. I have had the same problem, and the only thing that worked for me was to clear the actionMap, and reassign some keys to their original action, and some (e.g. ENTER, TAB) to my actions. This worked. With TAB is harder beacuse i guess it's deeper in the JVM implemented, but after a while i've managed to overwrite that too.

  • Urgent help with JTable

    I hope I'm not crossposting here.
    OK, I'm desperate about this.
    I really need working code for JTable in which one can copy/paste rows or blocks of data from MS Excel for example. Another required feature is to add and remove rows from any position, and to clear the contents of entire row, column or block of cells.
    If anyone can post me the source, it will save me for my deadline is too soon :(
    10x in advance

    I really need working code for JTable in which onecan copy/paste rows or blocks of data from MS Excel
    for example
    This library can be used to read write and modify excel filehttp://www.andykhan.com/jexcelapi/index.html
    just read the excelfile using this api store it in 2d array pass it to the Jtable constructor refresh jpanel and u r done

  • URGENT--inserting into JTable

    Hi
    i'm trying to insert data retrieved from the database into JTable
    i have seen some code examples on TableModel on this site but
    getting confused.Can anybody give me a full code example.
    Ashish

    you can take a look at the following link:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=357504
    I published my code for a dynamic table that supports adding/removing columns.

  • Boolean Fields as JCheckbox in a Dynamic JTable

    Hi,
    I am building an application like an sql query browser. I want to show boolean fields as JCheckbox in JTable. But the problem is that the table is dynamic, i don't know which column is boolean. How can i handle this? Should i configure getValueAt() overrided method in my TableModel class? If yes, how? Or any other suggestion . . .
    Regards.

    As default, boolean fields are shown as jcheckbox in jtable if getValueAt() method in my TableModel returns Object (not by getting string value). I am not careful nowadays :)

Maybe you are looking for

  • Tries to connect multiple times at the same time a...

    Tries to connect multiple times at the same time after trying to reinstalling software.

  • SharePoint 2013 SSRS SQL 2012 SP1 and Mac Safari 5.1 or 6.0 report issues

    I have been try to figure out an issue that only seems to be affecting Safari 5.1 or 6.0 on OSX 10.6.8 or 10.7. I can view the same reports as the same user on the same Mac as the same user in Chrome 27.0.1453.116 or Firefox 22.  I have also tested i

  • Wouldn't it be cool if your could do iMessages from the iCloud browser on any computer?

    I like the way you can start an iMessage conversation on one device and continue on another.  It would be better yet if I could log into any browser, as I can with other iCloud stuff, and continue iMessaging from there.  This means I could even messa

  • Two step stock transfer

    If I want to transfer material from one storage location to another, through MRP system creates reservation with movement type 311. But I want to have reservation with movement type 313 so that it will be two step and material can be transfered to tr

  • Essbase export question

    I have the strangest error. I am trying to export Level 0 and import in our new enviornement. Versions for target and source: 11.1.2.2 My method of export:* Right click [database name] --> Export Export to file [ name.txt] Export option: Level0 data