Error.  Combobox in JTable in 10.1.3 EA

(oracle.jbo.AttrSetValException) JBO-27010: Attribute set with value oracle.jbo.server.ViewRowImpl@1b for Ediz in AppModule.UgSfpView2 has invalid precision/scale
Type of "Ediz" is VARCHAR2(5)

Hi,
can you provide a step-by-step description using the EMP Table of what you did to get to this state ?
Frank

Similar Messages

  • Addiing ComboBox in JTable

    Can any one help mee how to add combobox in jtable i am using Abstracttablemodel.

    yes these the code where i am setting my editor and combobox
    import java.sql.ResultSet;
    import java.sql.*;
    import java.util.*;
    import javax.swing.JTable;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.*;
    public class clsCustMast extends clsMSGen{
        String strQuery,
                 querySrch1,
                 querySrch2;
        String strTab1Rec;
        String strTableName;
        String []strTmp;
        public clsValidate val;
        public boolean flgInsrtTab1,
                           flgInsrtTab2,
                           flgErr;
        public String strCmbFrom,
                             strCmbTo;
       /* public JComboBox cmbRgn,
                              cmbCntry;*/
        int        intSlctdTab;     
        private int intCol,
                        rowCntTab1,
                        rowCntTab2;
         final static int CNS_TAB1 = 0;
         final static int CNS_TAB2 = 1;
         final static String CNS_MANDT = "1";
         final static boolean CNS_FALSE = false;
         final static boolean CNS_TRUE = true;
         final static String strUserPassword  = "manager";          
        public void disp(){
            super.disp();
            flgInsrtTab1 = CNS_FALSE;
            flgInsrtTab2 = CNS_FALSE;
            // to get all region ids from the  tble T_regionmast and populate it in the cmbReg to be displayed in the grid
            populateRegionCntryCmb();
            // to get all region ids from the  tble T_countrymast and populate it in the cmbCntry to be displayed in the grid
            //populateCntryCmb();
            intCol = 0;
            strQuery = "select a.f_custid,a.f_postcd,a.f_faxno,a.f_phoneno,a.f_regionid," +
                      " a.f_cntryid, a.f_delflag from t_custmast a,t_custtran b" +
                      " where a.f_custid = b.f_custid" +
                      " and b.f_langid = 'EN'";
            //System.out.println(strQuery);
            ResultSet Tab1Data = prcQuery(strQuery);
            try{
                 ResultSetMetaData rmdTab1Dt = Tab1Data.getMetaData();
                 intCol = rmdTab1Dt.getColumnCount();
                 ++intCol;
                 strTmp = new String[intCol+1];
                 //JButton btn1;
                 while (Tab1Data.next()){
                      String [] record = new String[intCol];
                      //Object [] record = new Object[intCol];
                      //btn1 = new JButton("C");
                      record[0] = new JButton("B").toString();
                      //record[0] = new Boolean(false);
                      for(int i=1; i<intCol; i++)
                     record= Tab1Data.getString(i);
              if (i==1)
    cmbFrom.addItem(record[i]);
    cmbTo.addItem(record[i]);
    // System.out.println(record[i]);
    model1.addRow(record);
    model1.fireTableChanged(null);      
    catch(SQLException ex)
         System.out.println("Error1");
    ex.printStackTrace();
    strQuery = "select f_langid, b.f_custname, f_city, f_address " +
              "from t_custmast a ,T_custtran b where " +
              "a.f_custid = b.f_custid" +
                        " and b.f_langid = 'EN'";
    ResultSet Tab2Data = prcQuery(strQuery);
    try{
    intCol = 0;     
    ResultSetMetaData rmdTab2Dt = Tab2Data.getMetaData();
    intCol = rmdTab2Dt.getColumnCount();
    while (Tab2Data.next()){
    String [] record = new String[intCol];
    for(int i=0; i<intCol;i++)
    record[i]=Tab2Data.getString(i+1);
    model2.addRow(record);
    model2.fireTableChanged(null);
    catch(SQLException ex)
         System.out.println("Error2");
    ex.printStackTrace();
    System.out.println(intCol);
    //Connect the database and Returns the resultset corresponding to passed query     
         public ResultSet prcQuery(String strQuery){
              ResultSet resultQuery = dbCon.doQuery(strQuery);
              return resultQuery;
         public void populateRegionCntryCmb(){
              cmbRgn = new JComboBox();
              cmbCntry = new JComboBox();
              String queryRgn = "select f_regionid,f_cntryid from t_regionmast";
              ResultSet rsRgn = prcQuery(queryRgn);
              //String[] items = { "one", "two", "three", "four" };
              try{
                   while(rsRgn.next()){
                        //cmbRgn.addItem(rsRgn.getString(1));
                        cmbCntry.addItem(rsRgn.getString(2));
                        //System.out.println(rsRgn.getString(1)+ " " + rsRgn.getString(2));
              }catch(SQLException ex)
    {             System.out.println("Error in region cd retrieve");
    ex.printStackTrace();
              System.out.println(cmbCntry.getItemAt(0));
              //cmbCntry = new JComboBox(items);
              cmbCntry.setEditable( false );
              DefaultCellEditor dceCmbCntry = new DefaultCellEditor( cmbCntry );          
              info_table.getColumnModel().getColumn(6).setCellEditor(dceCmbCntry);
              // Set the first columm to use a ComboBox as a renderer
              info_table.getColumnModel().getColumn(6).setCellRenderer(new clsComboBoxRenderer());
         public void populateCntryCmb(){
              cmbCntry = new JComboBox();
              String queryCntry = "select f_reionid,f_cntryid from t_regionmast";
              ResultSet rsCntry = prcQuery(queryCntry);
              try{
                   if(!rsCntry.next()){
                        System.out.println("No Records in Country Master Table");
                   }else{
                        while(rsCntry.next()){
                             cmbCntry.addItem(rsCntry.getString(1));
                             //System.out.println(rsCntry.getString(1));
              }catch(SQLException ex)
         System.out.println("Error in region cd retrieve");
    ex.printStackTrace();
              System.out.println(cmbCntry.getItemAt(1));
              cmbCntry.setEditable( false );
              DefaultCellEditor dceCmbCntry = new DefaultCellEditor( cmbCntry );          
              info_table.getColumnModel().getColumn(6).setCellEditor(dceCmbCntry);
              // Set the first columm to use a ComboBox as a renderer
              info_table.getColumnModel().getColumn(6).setCellRenderer(new clsComboBoxRenderer());
         class clsComboBoxRenderer extends JComboBox implements TableCellRenderer
              public Component getTableCellRendererComponent
                        JTable info_table, Object value, boolean isSelected,
                        boolean hasFocus, int row, int column){
                             removeAllItems();
                             addItem( value );
                             return this;     
         public void add()
              String strAdd1[],
                   strAdd2[];
              intSlctdTab = tabbedPane.getSelectedIndex();
              if ( intSlctdTab == CNS_TAB1){
                   if ( flgInsrtTab1 == CNS_FALSE && flgInsrtTab2 == CNS_FALSE){
                        rowCntTab1 = model1.getRowCount();
                        //add a new row for both tabs when the add button is pressed while tab1 is selected.
                        //Add a new row for the tab1
                        strAdd1 = new String[8];
                        model1.addRow(strAdd1);
                        model1.fireTableChanged(null);
                        flgInsrtTab1 = CNS_TRUE;
                        //Add a new row for the tab2
                        strAdd2 = new String[4];
                        model2.addRow(strAdd2);
                        model2.fireTableChanged(null);
                        flgInsrtTab2 = CNS_TRUE;
                   }else{
                        lblStatus.setText("Save the Records and then Add New one");
              }else if(intSlctdTab == CNS_TAB2){
                   if ( flgInsrtTab2 = CNS_FALSE){
                        rowCntTab2 = model2.getRowCount();
                        //When a add button is pressed while selecting the 2nd tab add new row only to 2nd tab
                        strAdd2 = new String[4];
                        model2.addRow(strAdd2);
                        model2.fireTableChanged(null);
                        flgInsrtTab2 = CNS_TRUE;
                   }else{
                        lblStatus.setText("Save the Records and then Add New one");
         public void save()
              // Decalrion for varaibles in the TAB1
              String strCustId,
                   strDelFlg,
                   strPostCd,
                   strFaxNo,
                   strPhNo,
                   strRgnId,
                   strCntryId;
    boolean flag;                              
              //Assigning the values of the selected row to the corresponding fields
    strCustId = model1.getValueAt(rowCntTab1,1).toString();
    strPostCd = model1.getValueAt(rowCntTab1,2).toString();
    strFaxNo = model1.getValueAt(rowCntTab1,3).toString();
    strPhNo = model1.getValueAt(rowCntTab1,4).toString();
    strRgnId = model1.getValueAt(rowCntTab1,5).toString();
    strCntryId = model1.getValueAt(rowCntTab1,6).toString();
         strDelFlg = model1.getValueAt(rowCntTab1,7).toString();
         flgErr = CNS_FALSE;
         //Validation for mandatory field F_CUSTID
         flag = clsValidate.mandt(CNS_MANDT,strCustId);
    if (flag == CNS_FALSE){
              lblStatus.setText("Please Enter Values for Cust Id Field");
              flgErr = CNS_TRUE;
    //Validation for Mandatory field F_DELFLAG
    flag = clsValidate.mandt(CNS_MANDT,strDelFlg);
    if (flag == CNS_FALSE){
              lblStatus.setText("Please Enter Values for Delete Flag Field");
              flgErr = CNS_TRUE;
    // if no error occurs process the insert process
    if (flgErr == CNS_FALSE){
              String sqlInsrtT1;
              sqlInstrtT1 = "Insert into t_custmast'" + ( "'" +
                             " f_custid,f_delflag,f_postcd,f_faxno,f_phoneno," +
                                  "f_regionid,f_cntryid '" +) "'" +
                                  "(strCustId,strDelFlg,strPostCd,strFaxNo,strPhNo,strRgnId,strCntryId)";
              strTableName = "t_custmast";
         //     sqlInsrtT1 = "insert into t_custmast*/
         /*     StringBuffer InsertSQLT1 = new StringBuffer();
              strTableName = "t_custmast";
              InsertSQLT1.append("INSERT INTO " + strTableName );
              InsertSQLT1.append(" VALUES (");
                   int colCntTab1 = model1.getColumnCount();
                   System.out.println(colCntTab1);
              // for (int i=0; i < colCntTab1-1; i++) {
                   int i = 0;
                   System.out.println("Value at 2,1 " + model1.getValueAt(2,7));
                   /* while(i < colCntTab1){
                   System.out.println(" "+ i);
                   //System.out.print( model1.getValueAt(2,i));
              //     InsertSQLT1.append(model1.getValueAt(rowCntTab1,i));
                   InsertSQLT1.append(model1.getValueAt(2,i));
                   if ( i != colCntTab1-1) {
                        InsertSQLT1.append(",");     
                   }else{
                        InsertSQLT1.append(");");
                   i++;
              //InsertSQLT1.append(");");
              // System.out.println( model1.getValueAt(rowCntTab1,7));
    System.out.println(InsertSQLT1.toString());*/
    public void delete(){}
    public void cancel(){}
    public void goTran(){}
    public void Search(){
         intSlctdTab = tabbedPane.getSelectedIndex();
         if (intSlctdTab == CNS_TAB1 ){
              System.out.println(intSlctdTab);
    querySrch1 = "select a.f_custid,a.f_postcd,a.f_faxno,a.f_phoneno,a.f_regionid,"
         + " a.f_cntryid, a.f_delflag from t_custmast a,t_custtran b"
                        + " where a.f_custid = b.f_custid"
                        + " and b.f_langid = 'EN'"
                        + " and a.f_custid between '" + strCmbFrom + "'"
                        + " and '" + strCmbTo + "'";
         searchCondnTab1(querySrch1);
         intSlctdTab = 3;
    if ( intSlctdTab == CNS_TAB2 ){      
    querySrch2 = "select f_langid, b.f_custname, f_city, f_address"
                        + " from t_custmast a ,T_custtran b "
                        + " where a.f_custid = b.f_custid"
                        + " and b.f_langid = 'EN'"
                        + " and a.f_custid between '" + strCmbFrom + "'"
                        + " and '" + strCmbTo + "'";                     
              searchCondnTab2(querySrch2);
              intSlctdTab = 3;
    public void cmbFromSrch(){
         strCmbFrom = ((String)cmbFrom.getSelectedItem()).trim();
         System.out.println("Combo1 : " + strCmbFrom);
    public void cmbToSrch(){
         strCmbTo = ((String)cmbTo.getSelectedItem()).trim();
         System.out.println("Combo2 : "+ strCmbTo);
         public void searchCondnTab1(String querySrch){
              System.out.println("Tab1 : " + querySrch);
    ResultSet rsSrchTab1 = prcQuery(querySrch);
    try{
         ResultSetMetaData rmdSrchTab1 = rsSrchTab1.getMetaData();
         intCol = rmdSrchTab1.getColumnCount();
         //increase the column count by one for the button
         ++intCol;
         //remove all datas before fetching records according to the conditions
         model1.vctData.removeAllElements();
         //adding records to the vector after fetching the records
         while (rsSrchTab1.next()){
              String [] record1 = new String[intCol];
              record1[0] = new JButton("B").toString();
              for(int i=1; i<intCol;i++)
    record1[i]= rsSrchTab1.getString(i);     
    model1.addRow(record1);
    model1.fireTableChanged(null);      
    catch(SQLException ex)
         System.out.println("Error3");
    ex.printStackTrace();
         public void searchCondnTab2(String querySrch){
              System.out.println("Tab2 : " + querySrch);
              ResultSet rsSrchTab2 = prcQuery(querySrch);
         try{
         ResultSetMetaData rmdSrchTab2 = rsSrchTab2.getMetaData();
         intCol = rmdSrchTab2.getColumnCount();
         //remove all datas before fetching records according to the conditions     
         model2.vctData.removeAllElements();
         //adding records to the vector after fetching the records
         while (rsSrchTab2.next()){
         String [] record2 = new String[intCol];
         for(int i=0; i<intCol;i++)
         record2[i]= rsSrchTab2.getString(i+1);
         model2.addRow(record2);
         model2.fireTableChanged(null);     
         catch(SQLException ex)
              System.out.println("Error4");
         ex.printStackTrace();
         public static void main(String args[]){
         clsCustMast objCust = new clsCustMast();
         objCust.strUserid = "SIVAGURU";
         objCust.strTab1Name = "Basic";
         objCust.strTab2Name = "Details";
         objCust.strTitle = "Customer Maintenance";
              objCust.Tran_code = "XD01";
              objCust.strClsId = "clsCustMast";
              objCust.strLangid = "EN";
         objCust.connectDbase();
         objCust.disp();

  • Problem of selecting combobox in JTable!!

    I click comboBox in jtable and choose one item
    then move mouse away
    and then click the comboBox again
    It turns out to be strange:
    the selectedItem of the comboBox changes the first item at once
    I refered to the demo "TableRenderDemo.java" in http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/TableRenderDemo.java
    I just wanna do things like that
    but for some unknown reasons,I fail
    I compared two codes but found nothing

    here I'm giving a simple sample code. Refer this..
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.awt.*;
    public class Class1 extends JFrame {
    JScrollPane jScrollPane1 = new JScrollPane();
    JTable editableTable1 = new JTable(3, 3);     
    public Class1() {
    try {          
    JComboBox c = new JComboBox();
    c.setEditable(true);
    c.addItem("a");
    c.addItem("b");
    DefaultCellEditor cellEditor = new DefaultCellEditor(c);
    TableColumn tc = editableTable1.getColumnModel().getColumn(0);
    tc.setCellEditor(cellEditor);
    this.getContentPane().setLayout(null);
    jScrollPane1.setBounds(new Rectangle(25, 19, 330, 180));
    this.getContentPane().add(jScrollPane1, null);
    jScrollPane1.getViewport().add(editableTable1, null);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    System.exit(0);
    } catch(Exception e) {
    System.out.println("Exception in Class1:"+e);
    public static void main(String[] args) {
    Class1 class1 = new Class1();
    class1.setSize(400, 400);
    class1.setVisible(true);

  • Error in updating Jtable Database

    package desktopapplication1; import java.util.*; import java.sql.*; import javax.swing.JOptionPane; import javax.swing.table.*; public class Datab extends DefaultTableModel { private Connection conn; private Statement st; private ResultSet rs; private ResultSetMetaData rsmd; private int rows; public Datab(String driver, String url, String query) throws SQLException, ClassNotFoundException { Class.forName(driver); conn = DriverManager.getConnection(url); st = conn.createStatement(rs.TYPE_SCROLL_SENSITIVE,rs.CONCUR_UPDATABLE); if ( query.substring(0,3).equalsIgnoreCase("INS") ) { st.executeUpdate(query); } else if ( query.substring(0,3).equalsIgnoreCase("DEL") ) { st.executeUpdate(query); } else { rs = st.executeQuery(query); rsmd = rs.getMetaData(); rs.last(); rows = rs.getRow(); } fireTableStructureChanged(); } public String getColumnName(int column){ try{ return rsmd.getColumnName(column+1); }catch(Exception e){ e.printStackTrace(); } return ""; } public int getColumnCount(){ try{ return rsmd.getColumnCount(); }catch(Exception e){ e.printStackTrace(); } return 0; } public int getRowCount(){ try{ return rows; }catch(Exception e){ e.printStackTrace(); } return 0; } public Object getValueAt(int row, int column){ try{ rs.absolute(row+1); return rs.getObject(column+1); }catch(Exception e){ e.printStackTrace(); } return ""; } public Class getColumnClass(int c) { return getValueAt(0, c).getClass(); } public boolean isCellEditable(int row, int column) { if (column < 0) { return false; } else { return true; } } public void setValueAt(Object value, int row, int column){ try{ int conf = JOptionPane.showConfirmDialog(null,"You wanna reaplace "+getValueAt(row,column)+" with "+value+"?", null, 2); if ( conf == 0 ) { rs.absolute(row+1); System.out.println("ROW = "+row+"CURSOR = "+(row+1)+""+rs.getString(1)+column); rs.updateString("Recipe","test"); //i tried to use a simple update cause the normal was not running but same error+ rs.updateRow(); }else { System.out.println("0"); } }catch(SQLException sqle){ System.err.println("Error setting value at row "+row+" column "+column+" with value "+value); sqle.printStackTrace(); } } }
    hi, when i click on my table to edit a value, it give me an error and sometimes fill the cell with a value like [B@341j0j
    Error setting value at row 1 column 0 with value soup2
    java.sql.SQLException: [Microsoft][Driver ODBC Microsoft Access]Error in row
    at sun.jdbc.odbc.JdbcOdbcResultSet.setPos(JdbcOdbcResultSet.java:5271)
    at sun.jdbc.odbc.JdbcOdbcResultSet.updateRow(JdbcOdbcResultSet.java:4171)
    at desktopapplication1.Datab.setValueAt(Datab.java:104)
    at javax.swing.JTable.setValueAt(JTable.java:2719)
    at javax.swing.JTable.editingStopped(JTable.java:4721)
    at javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.java:125)
    at javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(DefaultCellEditor.java:350)
    at javax.swing.DefaultCellEditor.stopCellEditing(DefaultCellEditor.java:215)
    at javax.swing.JTable$GenericEditor.stopCellEditing(JTable.java:5475)
    at javax.swing.DefaultCellEditor$EditorDelegate.actionPerformed(DefaultCellEditor.java:367)
    at javax.swing.JTextField.fireActionPerformed(JTextField.java:492)
    at javax.swing.JTextField.postActionEvent(JTextField.java:705)
    at javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:820)
    at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
    at javax.swing.JComponent.processKeyBinding(JComponent.java:2851)
    at javax.swing.JComponent.processKeyBindings(JComponent.java:2886)
    at javax.swing.JComponent.processKeyEvent(JComponent.java:2814)
    at java.awt.Component.processEvent(Component.java:6040)
    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.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
    at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:704)
    at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:969)
    at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:841)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:668)
    at java.awt.Component.dispatchEventImpl(Component.java:4502)
    at java.awt.Container.dispatchEventImpl(Container.java:2099)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    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)
    my db is like
    RecipeName intvalue1 intvalue2 intvalue3 stringvalue4
    soup 3 2 11 fish
    chocolate 3 2 44 dessert
    Edited by: kainard on Aug 1, 2010 2:31 PM
    Edited by: kainard on Aug 1, 2010 2:37 PM

    Can you explain why you declare
    private Connection conn;
    private Statement st;
    private ResultSet rs;
    private ResultSetMetaData rsmd;
    as private

  • Error while updating JTable

    WHAT I WANT TO DO:
    I display a list of items and their characteristics in a JTable (the content is in a DefaultTableModel). Each time a user buys items, I refresh the list for all the users currently connected to the server. The client buying the item is also prompted through a JOptionPane that his order has been processed.
    THE CODE:
    controller.handleOrder();
    JOptionPane.showMessageDialog(new JFrame(), message, "SUCCESSFUL ORDER", JOptionPane.INFORMATION_MESSAGE);Another thread calls the following function, which refreshes the list in the JTable:
    public void updateFlowers(){
         // method in Controller
         setChanged();
         notifyObservers();
        |
        V
    public void update(Observable arg0, Object arg1) {
         // method in Frame
         loadFlowers();
        |
        V
    private void loadFlowers(){
         // method in Frame
         flowerTableModel = controller.loadFlowers();
         flowerTable.setModel(flowerTableModel);
       |
       V
    public DefaultTableModel loadFlowers()  {
         // method in Controller
         Object table[][]=null;
         flowers=ClientOperations.getInstance().getFlowers();
         if (flowers!=null){
              table=new Object[flowers.size()][3];
              int i=0;
              for (Flower flower:flowers){
                   table[0]=flower.getSpecies();
                   table[i][1]=new Float(flower.getPrice());
                   table[i][2]=new Integer(flower.getInStock());
                   i++;
         DefaultTableModel flowersDTM=new DefaultTableModel(table,TABLE_HEADER);
         return flowersDTM;
    THE ERROR I GET:
    Exception occurred during event dispatching:
    java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
         at java.util.Vector.elementAt(Unknown Source)
         at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown Source)
         at javax.swing.plaf.basic.BasicTableUI.paintGrid(Unknown Source)
         at javax.swing.plaf.basic.BasicTableUI.paint(Unknown Source)
         at javax.swing.plaf.ComponentUI.update(Unknown Source)
         at javax.swing.JComponent.paintComponent(Unknown Source)
         at javax.swing.JComponent.paint(Unknown Source)
         at javax.swing.JComponent.paintToOffscreen(Unknown Source)
         at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
         at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
         at javax.swing.RepaintManager.paint(Unknown Source)
         at javax.swing.JComponent._paintImmediately(Unknown Source)
         at javax.swing.JComponent.paintImmediately(Unknown Source)
         at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
         at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
         at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
         at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.Dialog$1.run(Unknown Source)
         at java.awt.Dialog$3.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Unknown Source)
         at javax.swing.JOptionPane.showOptionDialog(Unknown Source)
         at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
         at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
         at ui.OrderFrame.handleOrder(OrderFrame.java:185)
         at ui.OrderFrame.access$1(OrderFrame.java:181)
         at ui.OrderFrame$ButtonListener.actionPerformed(OrderFrame.java:218)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    I would very much appreciate it if you could explain why I get this error and how it can be solved.
    Thank you,
    Cristina                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Updating of Swing components must be done on the EDT. Wrap the code in SwingUtilities.invokeLater() or use a SwingWorker.
    Read the section from the Swing tutorial on Concurrency for more information.

  • Combobox in jtable

    suppose you are editing a combobox in a jtable.
    in the combobox, there are items like
    A0
    A20
    C0
    C20
    E0
    E20
    my main goal is traverse and edit the table by keyboard.
    when i go to a jcombobox, e.g. i hit the button C, it only focus the combo, not selecting item.
    JComboBox comboBox = new JComboBox(arr){
                   protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
                        int condition, boolean pressed) {
                    boolean retValue = super.processKeyBinding(ks, e, condition, pressed);
                    if (!retValue && isStartingCellEdit() && editor != null) {
                        //editor.setItem(String.valueOf(ks.getKeyChar()));
                        JComponent editorComponent = (JComponent) getEditor().getEditorComponent();
                        InputMap map = editorComponent.getInputMap(condition);
                        ActionMap am = editorComponent.getActionMap();
                        if(map!=null && am!=null && isEnabled()){
                            Object binding = map.get(ks);
                            Action action = (binding==null) ? null : am.get(binding);
                            if(action!=null){
                                 SwingUtilities.notifyAction(action, ks, e, editorComponent,
                                        e.getModifiers());
                    return retValue;
                private boolean isStartingCellEdit() {
                    JTable table = (JTable) SwingUtilities.getAncestorOfClass(
                            JTable.class, this);
                    return table != null
                            && table.isFocusOwner()
                            && !Boolean.FALSE.equals((Boolean) table
                                    .getClientProperty("JTable.autoStartsEdit"));
    };so if i want to write C20,
    when i pressed C, it selects the combo, so after pressing 2 and 0, it searches for 20.
    how can i do this not to lose the first char?

    suppose you are editing a combobox in a jtable.
    in the combobox, there are items like
    A0
    A20
    C0
    C20
    E0
    E20
    my main goal is traverse and edit the table by keyboard.
    when i go to a jcombobox, e.g. i hit the button C, it only focus the combo, not selecting item.
    JComboBox comboBox = new JComboBox(arr){
                   protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
                        int condition, boolean pressed) {
                    boolean retValue = super.processKeyBinding(ks, e, condition, pressed);
                    if (!retValue && isStartingCellEdit() && editor != null) {
                        //editor.setItem(String.valueOf(ks.getKeyChar()));
                        JComponent editorComponent = (JComponent) getEditor().getEditorComponent();
                        InputMap map = editorComponent.getInputMap(condition);
                        ActionMap am = editorComponent.getActionMap();
                        if(map!=null && am!=null && isEnabled()){
                            Object binding = map.get(ks);
                            Action action = (binding==null) ? null : am.get(binding);
                            if(action!=null){
                                 SwingUtilities.notifyAction(action, ks, e, editorComponent,
                                        e.getModifiers());
                    return retValue;
                private boolean isStartingCellEdit() {
                    JTable table = (JTable) SwingUtilities.getAncestorOfClass(
                            JTable.class, this);
                    return table != null
                            && table.isFocusOwner()
                            && !Boolean.FALSE.equals((Boolean) table
                                    .getClientProperty("JTable.autoStartsEdit"));
    };so if i want to write C20,
    when i pressed C, it selects the combo, so after pressing 2 and 0, it searches for 20.
    how can i do this not to lose the first char?

  • Combobox in jtable two tab problem

    Hi all,
    If i am using combobox for one of the columns of jtable with custom editor and renderer, it needs two tab for navigation between the cells.
    How can i make it as 'one tab navigation'. Even i tried with 'isManagingfocus() return true' but...no effect.
    thanx in advance.
    S.A.Radha.

    here I'm giving a simple sample code. Refer this..
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.awt.*;
    public class Class1 extends JFrame {
    JScrollPane jScrollPane1 = new JScrollPane();
    JTable editableTable1 = new JTable(3, 3);     
    public Class1() {
    try {          
    JComboBox c = new JComboBox();
    c.setEditable(true);
    c.addItem("a");
    c.addItem("b");
    DefaultCellEditor cellEditor = new DefaultCellEditor(c);
    TableColumn tc = editableTable1.getColumnModel().getColumn(0);
    tc.setCellEditor(cellEditor);
    this.getContentPane().setLayout(null);
    jScrollPane1.setBounds(new Rectangle(25, 19, 330, 180));
    this.getContentPane().add(jScrollPane1, null);
    jScrollPane1.getViewport().add(editableTable1, null);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    System.exit(0);
    } catch(Exception e) {
    System.out.println("Exception in Class1:"+e);
    public static void main(String[] args) {
    Class1 class1 = new Class1();
    class1.setSize(400, 400);
    class1.setVisible(true);

  • Size of combobox in JTable with custom cell editor

    Hi All -
    I have a JTable that displays a combobox in certain cells. I have a custom table model, renderer, and editor. All of that works fine. I render the combobox with the renderer, and then return the combobox as an editor in the editor so that it can drop down and actually be of use. My problem is - I set the size of the combobox with a setBounds call in the renderer, I add it to a panel, and return the panel - because I dont want the combobox to take up the entire space of the cell. This approach fails in the editor. The setBounds and setSize calls have no effect. As soon as you click the combobox, the editor takes over and all of a sudden the combobox resizes to the entire area of the cell. I assume this is because in the editor you arent actually placing anything - your simply returning the "editing form" of the component.
    So - anybody know of a way to work around this? Worst case, I could just allow the combobox to use the entire area of the cell - but it makes it uglier so I figured I would run it by the forums.
    Eric

    Rather than just redirect you to my previous answer from ages ago, I'll just give it again. :-)
    You can actually do this, but you have to get tricky. By default, the dropdown's width will be the same width as the cell... but it doesn't have to be that way. Essentially what you have to do is override the UI (MetalComboBoxUI) for the combo component. In your new customized UI component subclass (that you set the combo to use), modify the the createPopup() method of this UI class, and add your own logic to set the size of the popup before you return it.
    Ideally the size would be based on the computed max width of a rendered item shown in the combo, but really you could set it to whatever just to see how it works.

  • Combobox in JTable question

    Hello,
    I have to make a button in a JTable that is activated with a right button and then like in a combobox appears a menue and every item in this menue should be activated with the left button and perform some action. Like in windows right click and then select smth.
    My question is should I do it with Combobox and if yes how to activate it with the right button because it always listens to left button. It is implemented with action listener and I tried mouse listener but it wouldn"t listen to that. I will be glad to any solutions.
    Thanx,
    Miroslav

    Hi,
    And thank you for the answer. i think I will use jpop menu as u sujested(Thank you for that). Now I should only see how to make the render and the editor to put it in a cell in a JTable.
    It should be activated with the right button, beacause my task is such and because I also think that it is better this way. II mean it is more natural than with the left button.
    Miroslav

  • Escape key "dies" in combobox and JTable

    I have set in my JDialog the default key ESCAPE as this standard code:
              KeyStroke escKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
              int param = JComponent.WHEN_IN_FOCUSED_WINDOW;
              root.getInputMap(param).put(escKey, "close");
              root.getActionMap().put("close", actionCancel);
         this.btCancel.setAction(actionCancel);
    The problem is when I have JComboBoxs and JTables. All key events seem to be consumed
    In this components (and maybe more components). So, if I press ESCAPE and my focus
    in a combobox, the dialog won't close.
    How could I work around this?
    thank you

    I've got the solution!
    I have a javaBean (JPanel) that has only one JComboBox. I trigger key pressed (don't know
    if should be key released in this case) on comboBox. Then I check if...
    this.comboBox.isPopupVisible().
    Simple. If popup is not visible and dispatch the event to this.
    I just wonder how the event goes to my javaBean, my javabean is in a dialog and this
    dialog of mine ends up to catch the event. ???
    Ok, this stays has a solution for future developers to found - in case they guess that
    right keywords :)

  • Click ComboBox in JTable to times before editing ?

    Hi,
    I have a JComboBox in a JTable.
    Now I want to open the ComboBox when
    you click the cell to times.
    There is a method in DefaultCellEditor called
    setClickCountToStart(int).
    But how can I get the reference to the DefaultCellEditor
    from my JTable. There is only a method theTable.getDefaultEditor
    which returns TableCellEditor ?
    Thanx Stephan

    I made it run right in jdk1.3.1 throgh chage the setSelectedItem Method, code is follow:
    public void setSelectedItem(Object item) {
        this.insertItemAt(item, 0);
        if(getItemCount() > 1) {
          this.removeItemAt(1);
        super.setSelectedItem(item);
    }

  • How to have a combobox in JTable column header?

    Any simple ways for doing this? I am trying to get a filter to a JTable, so that only the rows containing the selected value in that column would be shown.
    I first need to get this combobox into the header of a column.

    Thanks.
    I have already tried with this way, but it was too long and complicated to implement into my file.
    Could someone post the principles here.
    Like this:
    // create my combobox
    JComboBox myBox = new JComboBox();
    myBox.addItem("Cat");
    myBox.addItem("Dog");
    // put the combobox to column header
    ??? ANY CODE HERE ???
    Tnx ahead!
    OK!
    AUlo

  • How to add  ComboBox in Jtable Header

    Hello everyone,
    I want to add a Combox box in JTable Header .Basically it works as central access to whole table e.g. by selecting delete row in combo box then it should delete the current selected row.If somebody has any idea please share it.
    Thanks in advance.

    The individual headers are not Swing components and therefore do not respond to mouse events in the same way as Swing components. Why don't you just have a popup menu that is positioned over the currently selected row? If you want to apply an action to all selected rows then have a set of buttons placed above the table header.

  • Need combobox with a Jtable to view client & server files

    Hellow Everybody,
    I am quite new to Java, although I have experience with other
    programming languages.
    I have searched for tutorials, code, examples etc. but have not found
    much that can help me so far. I am a BCA student & I am appearing for my last year exams. I studied about various Java programs in my course and I decided to make a Swing based FTP Server. Although I not expert in Java , but I have learnt the network programming very much clearly, and that�s why by the help these I wrote a program but it not complete. I have given the program below.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Cursor;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.event.WindowListener;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.StringTokenizer;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JProgressBar;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingUtilities;
    import javax.swing.border.BevelBorder;
    import javax.swing.border.EmptyBorder;
    import sun.net.TelnetInputStream;
    import sun.net.ftp.FtpClient;
    public class Client extends JFrame {
    public static int BUFFER_SIZE = 10240;
    protected JTextField userNameTextField = new JTextField("anonymous");
    protected JPasswordField passwordTextField = new JPasswordField(10);
    protected JTextField urlTextField = new JTextField(20);
    protected JTextField fileTextField = new JTextField(10);
    protected JTextArea monitorTextArea = new JTextArea(5, 20);
    protected JProgressBar m_progress = new JProgressBar();
    protected JButton putButton = new JButton("Upload <<");
    protected JButton getButton;
    protected JButton fileButton = new JButton("File");
    protected JButton closeButton = new JButton("Close");
    protected JFileChooser fileChooser = new JFileChooser();
    protected FtpClient ftpClient;
    protected String localFileName;
    protected String remoteFileName;
    public Client() {
    super("FTP Client");
    JPanel p = new JPanel();
    p.setBorder(new EmptyBorder(5, 5, 5, 5));
    p.add(new JLabel("User name:"));
    p.add(userNameTextField);
    p.add(new JLabel("Password:"));
    p.add(passwordTextField);
    p.add(new JLabel("URL:"));
    p.add(urlTextField);
    p.add(new JLabel("File:"));
    p.add(fileTextField);
    monitorTextArea.setEditable(false);
    JScrollPane ps = new JScrollPane(monitorTextArea);
    p.add(ps);
    m_progress.setStringPainted(true);
    m_progress.setBorder(new BevelBorder(BevelBorder.LOWERED, Color.white,
    Color.gray));
    m_progress.setMinimum(0);
    JPanel p1 = new JPanel(new BorderLayout());
    p1.add(m_progress, BorderLayout.CENTER);
    p.add(p1);
    ActionListener lst = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    if (connect()) {
    Thread uploader = new Thread() {
    public void run() {
    putFile();
    disconnect();
    uploader.start();
    putButton.addActionListener(lst);
    putButton.setMnemonic('U');
    p.add(putButton);
    getButton = new JButton("Download >>");
    lst = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    if (connect()) {
    Thread downloader = new Thread() {
    public void run() {
    getFile();
    disconnect();
    downloader.start();
    getButton.addActionListener(lst);
    getButton.setMnemonic('D');
    p.add(getButton);
    lst = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    if (fileChooser.showSaveDialog(Client.this) != JFileChooser.APPROVE_OPTION)
    return;
    File f = fileChooser.getSelectedFile();
    fileTextField.setText(f.getPath());
    fileButton.addActionListener(lst);
    fileButton.setMnemonic('f');
    p.add(fileButton);
    lst = new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    if (ftpClient != null)
    disconnect();
    else
    System.exit(0);
    closeButton.addActionListener(lst);
    closeButton.setDefaultCapable(true);
    closeButton.setMnemonic('g');
    p.add(closeButton);
    getContentPane().add(p, BorderLayout.CENTER);
    fileChooser.setCurrentDirectory(new File("."));
    fileChooser
    .setApproveButtonToolTipText("Select file for upload/download");
    WindowListener wndCloser = new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    disconnect();
    System.exit(0);
    addWindowListener(wndCloser);
    setSize(720, 240);
    setVisible(true);
    public void setButtonStates(boolean state) {
    putButton.setEnabled(state);
    getButton.setEnabled(state);
    fileButton.setEnabled(state);
    protected boolean connect() {
    monitorTextArea.setText("");
    setButtonStates(false);
    closeButton.setText("Cancel");
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    String user = userNameTextField.getText();
    if (user.length() == 0) {
    setMessage("Please enter user name");
    setButtonStates(true);
    return false;
    String password = new String(passwordTextField.getPassword());
    String sUrl = urlTextField.getText();
    if (sUrl.length() == 0) {
    setMessage("Please enter URL");
    setButtonStates(true);
    return false;
    localFileName = fileTextField.getText();
    // Parse URL
    int index = sUrl.indexOf("//");
    if (index >= 0)
    sUrl = sUrl.substring(index + 2);
    index = sUrl.indexOf("/");
    String host = sUrl.substring(0, index);
    sUrl = sUrl.substring(index + 1);
    String sDir = "";
    index = sUrl.lastIndexOf("/");
    if (index >= 0) {
    sDir = sUrl.substring(0, index);
    sUrl = sUrl.substring(index + 1);
    remoteFileName = sUrl;
    try {
    setMessage("Connecting to host " + host);
    ftpClient = new FtpClient(host);
    ftpClient.login(user, password);
    setMessage("User " + user + " login OK");
    setMessage(ftpClient.welcomeMsg);
    ftpClient.cd(sDir);
    setMessage("Directory: " + sDir);
    ftpClient.binary();
    return true;
    } catch (Exception ex) {
    setMessage("Error: " + ex.toString());
    setButtonStates(true);
    return false;
    protected void disconnect() {
    if (ftpClient != null) {
    try {
    ftpClient.closeServer();
    } catch (IOException ex) {
    ftpClient = null;
    Runnable runner = new Runnable() {
    public void run() {
    m_progress.setValue(0);
    putButton.setEnabled(true);
    getButton.setEnabled(true);
    fileButton.setEnabled(true);
    closeButton.setText("Close");
    Client.this.setCursor(Cursor
    .getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    SwingUtilities.invokeLater(runner);
    protected void getFile() {
    if (localFileName.length() == 0) {
    localFileName = remoteFileName;
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    fileTextField.setText(localFileName);
    byte[] buffer = new byte[BUFFER_SIZE];
    try {
    int size = getFileSize(ftpClient, remoteFileName);
    if (size > 0) {
    setMessage("File " + remoteFileName + ": " + size + " bytes");
    setProgressMaximum(size);
    } else
    setMessage("File " + remoteFileName + ": size unknown");
    FileOutputStream out = new FileOutputStream(localFileName);
    InputStream in = ftpClient.get(remoteFileName);
    int counter = 0;
    while (true) {
    int bytes = in.read(buffer);
    if (bytes < 0)
    break;
    out.write(buffer, 0, bytes);
    counter += bytes;
    if (size > 0) {
    setProgressValue(counter);
    int proc = (int) Math
    .round(m_progress.getPercentComplete() * 100);
    setProgressString(proc + " %");
    } else {
    int kb = counter / 1024;
    setProgressString(kb + " KB");
    out.close();
    in.close();
    } catch (Exception ex) {
    setMessage("Error: " + ex.toString());
    protected void putFile() {
    if (localFileName.length() == 0) {
    setMessage("Please enter file name");
    byte[] buffer = new byte[BUFFER_SIZE];
    try {
    File f = new File(localFileName);
    int size = (int) f.length();
    setMessage("File " + localFileName + ": " + size + " bytes");
    setProgressMaximum(size);
    FileInputStream in = new FileInputStream(localFileName);
    OutputStream out = ftpClient.put(remoteFileName);
    int counter = 0;
    while (true) {
    int bytes = in.read(buffer);
    if (bytes < 0)
    break;
    out.write(buffer, 0, bytes);
    counter += bytes;
    setProgressValue(counter);
    int proc = (int) Math
    .round(m_progress.getPercentComplete() * 100);
    setProgressString(proc + " %");
    out.close();
    in.close();
    } catch (Exception ex) {
    setMessage("Error: " + ex.toString());
    protected void setMessage(final String str) {
    if (str != null) {
    Runnable runner = new Runnable() {
    public void run() {
    monitorTextArea.append(str + '\n');
    monitorTextArea.repaint();
    SwingUtilities.invokeLater(runner);
    protected void setProgressValue(final int value) {
    Runnable runner = new Runnable() {
    public void run() {
    m_progress.setValue(value);
    SwingUtilities.invokeLater(runner);
    protected void setProgressMaximum(final int value) {
    Runnable runner = new Runnable() {
    public void run() {
    m_progress.setMaximum(value);
    SwingUtilities.invokeLater(runner);
    protected void setProgressString(final String string) {
    Runnable runner = new Runnable() {
    public void run() {
    m_progress.setString(string);
    SwingUtilities.invokeLater(runner);
    public static int getFileSize(FtpClient client, String fileName)
    throws IOException {
    TelnetInputStream lst = client.list();
    String str = "";
    fileName = fileName.toLowerCase();
    while (true) {
    int c = lst.read();
    char ch = (char) c;
    if (c < 0 || ch == '\n') {
    str = str.toLowerCase();
    if (str.indexOf(fileName) >= 0) {
    StringTokenizer tk = new StringTokenizer(str);
    int index = 0;
    while (tk.hasMoreTokens()) {
    String token = tk.nextToken();
    if (index == 4)
    try {
    return Integer.parseInt(token);
    } catch (NumberFormatException ex) {
    return -1;
    index++;
    str = "";
    if (c <= 0)
    break;
    str += ch;
    return -1;
    public static void main(String argv[]) {
    new Client();
    The above given code is not yet complete. I want some specific features to be implemented in this code that is given below.
    1.     A login Gridlayout or Borderlayout & within it the username & password textfield.
    2.     When the username and password will request to server and if it will success then the textfields of the username & password have to be disable.
    3 . Two Combobox. One will give client directories and files and another
    will give the server directories and files.
    4 . Below the Combobox two JTable will be given & the tables wll show the
    client and server directories and files.
    Could anybody give me the codes that I want. If anybody check this code please help me????
    With Regards,
    DILLU

    Well Mr Michael_Dunn,
    Thanks for responding my query. First of all I would like to tell that
    this FTP server is going to be my project and that's why I am submmiting my question. I told in my points that I want a Jcombobox & a JTable for displaying that files & directories. whenever I set the directories in the combobox the files will be displayed in the JTable
    I hope you understand my point

  • Some error in setting table model to a JTable..kindly help..

    hi all,
    i m pasting a code of a function in which i fetch data from the database n display it in a JTable pasted on a panel in a JFrame window.
    There is some problem with the table model which i m unable to correct.
    Kindly help..
    public void showDetails(){
         Statement statement;
         ResultSet rs;
    Connection connection;
         //DATABASE CONNECTION
              try{
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              connection=DriverManager.getConnection("jdbc:odbc:iirsdb");
                   statement=connection.createStatement();
                   String strQuery=null;
                   Object[][] data;
                   //SELECT QUERIES
                        if(index>=1 && index<=14)
                             strQuery="select IP_Address,"+strMapped+",Timestamp from tblStatic where IP_Address='" + strIP + "' and Timestamp='"+strTime+"' and "+strMapped+"='"+strDetailResult+"'";
                        if(index>17 && index<=22)
                             strQuery="select IP_Address,"+strMapped+",Timestamp from tblSemiDyn where IP_Address='" + strIP + "' and Timestamp='"+strTime+"' and "+strMapped+"='"+strDetailResult+"'";
                        if(index==25)
                             strQuery="select IP_Address,"+strMapped+",Timestamp from tblDyn where IP_Address='" + strIP + "' and Timestamp='"+strTime+"' and "+strMapped+"='"+strDetailResult+"'";
                   rs=statement.executeQuery(strQuery);
                   ResultSetMetaData rsmd=rs.getMetaData();
                   int col=rsmd.getColumnCount();
                   Vector colNames=new Vector();
                   Vector row=new Vector();
                   for(int i=1;i<=col;i++){
                        colNames.addElement(rsmd.getColumnName(i));
                   while(rs.next()){
                        for(int i=1;i<=col;i++){
                             row.addElement(rs.getObject(i));
                        data.addElement(row);
                   DefaultTableModel tableModel = new DefaultTableModel(data, colNames);
                   JTable table= new JTable(tableModel);
                   //table.setModel(new DefaultTableModel(data,colNames));
                   //JTable.revalidate();
                   //display table with ResultSet contents
                             //JTable table= new JTable(row, colNames);
                             JScrollPane scroller=new JScrollPane(table);
                             pnlFifth.add(scroller,BorderLayout.CENTER);
                             scroller.setVisible(true);
                             scroller.validate();
                   rs.close();
    }catch(ClassNotFoundException cnfex){
                   System.err.println("Failed to load JDBC/ODBC driver");
                   cnfex.printStackTrace();
    catch (SQLException sql){
    JOptionPane.showMessageDialog(this, "Cannot connect to Database"+sql,"Error", JOptionPane.WARNING_MESSAGE);
    }

    hi..okays..will take care of this..actually, this ws d first time i ws using this community service.
    Below.i inserted checkstatements but still d table isnt getting displayed..wht to do? D logic is correct i guess but whr is d problem?
    public void showDetails(){
         Statement statement;
         ResultSet rs;
        Connection connection;
        Vector colNames=null;
             Vector data=null;
         //DATABASE CONNECTION
              try{
                    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                    connection=DriverManager.getConnection("jdbc:odbc:iirsdb");
                   String strQuery=null;
              data = new Vector();
                   //SELECT QUERIES
                        if(index>=1 && index<=14)
                             strQuery="select IP_Address,"+strMapped+",Timestamp from tblStatic where IP_Address='" + strIP + "' and Timestamp='"+strTime+"' and "+strMapped+"='"+strDetailResult+"'";
                        if(index>17 && index<=22)
                             strQuery="select IP_Address,"+strMapped+",Timestamp from tblSemiDyn where IP_Address='" + strIP + "' and Timestamp='"+strTime+"' and "+strMapped+"='"+strDetailResult+"'";
                        if(index==25)
                             strQuery="select IP_Address,"+strMapped+",Timestamp from tblDyn where IP_Address='" + strIP + "' and Timestamp='"+strTime+"' and "+strMapped+"='"+strDetailResult+"'";
                   statement=connection.createStatement();
                   rs=statement.executeQuery(strQuery);
                   ResultSetMetaData rsmd=rs.getMetaData();
                   int col=rsmd.getColumnCount();
                   //int r=rsmd.getRowCount();
                   colNames=new Vector();
                   for(int i=1;i<=col;i++){
                        colNames.addElement(rsmd.getColumnName(i));
                   while(rs.next()){
                        Vector row=new Vector(col);
                        for(int i=1;i<=col;i++){
                             row.addElement(rs.getObject(i));
                        data.addElement(row);
                   rs.close();
                   statement.close();
    }catch(ClassNotFoundException cnfex){
                   System.err.println("Failed to load JDBC/ODBC driver");
                   cnfex.printStackTrace();
    catch (SQLException sql){
                JOptionPane.showMessageDialog(this, "Cannot connect to Database"+sql,"Error", JOptionPane.WARNING_MESSAGE);
    JTable table=new JTable(data,colNames)
                public Class getColumnClass(int column)
                    for (int row = 0; row < getRowCount(); row++)
                        Object o = getValueAt(row, column);
                        if (o != null)
                            return o.getClass();
                    return Object.class;
            JScrollPane scrollPane = new JScrollPane( table );
            //getContentPane().add( scrollPane );
            pnlFifth.add( scrollPane );
            scrollPane.setVisible(true);
    }     

Maybe you are looking for

  • How to store adobe Interactive form PDF in archive link?

    Hi everybody, I had create a WebDybpro Abap that contain an Adobe Interactive Form, now I must store this Interactive Form into Archive Link like a PDF document. I succeeded to save the PDF document on the archive link but after this operation, when

  • Product Grouping in Listing.....Help Needed

    Hi Guys Plz help me on how can grouping of Products can be done in listing? e.g : Say, i have 10 products like 1) Toothpate 2) Toilet Cleaner 3) Toilet Brush 4) Tooth Brush 5) Hand Wash 6) Soap 7) Talcum Powder 8) Lipstick 9) Nail Polish 10) Mouth Fr

  • 10.5.3--Sleep/Standby issue?

    With 10.5.2, when leaving work I would simply drag the mouse to the hot spot to launch my screensaver. My MacBook Pro 17" is set to BETTER PERFORMANCE; it never sleeps, only the display goes to sleep after 15 minutes. I have never had luck with Mac +

  • Need advice about new project!!

    I come from a dvd background and more recently a online video background (lost of h.264 stuff). I have a client who would like me to do a training DVD-ROM. Shoot the footage - easy Edit the multi cams - easy Add screen shots of the software and chang

  • Adobe Air iOS publishing keeps giving unexpected errors

    The device has encountered and unexpected error. Installation Error: PackageExtractionFailed I thought it would maybe be because of my certificates or profiles. So I made new development certificates and distribution certificates. I extracted them to