Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #4305

Help in Trim and putting

From "Sriram" <sriram@THRWHITE.remove-dii-this>
Subject Help in Trim and putting
Message-ID <1032f7a4-7a69-4e7d-8866-250535c7ef92@b31g2000prb.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
Date 2011-04-27 15:49 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Hi

   I have been having trouble in trimming a string and putting into a
string array named headerLabels and getting the column names of that
headerLabels in a JTable ... Here is a small example not the real
complicated code that I use...

When compiling I keep getting an error
java .lang.ArrayIndexOutofBoundsException. Can anybody help me in
clarifying that error? When navigating to that specific error it
points out to the source of error originating at

	  table.getColumnModel().getColumn(j).setCellEditor(new
DefaultCellEditor(e2));

Here j is the number of Fields that might be added in a JTable and is
dependent (i.e) if the field to be added is a JComboBox or JtextField.
e2 is the JTextField here.

Some ideas and show how might help me. Anybody can help out with that?

    Example(similar i had in my code)

    String line = "word1 word2             word3 word4";
    // word1 and word2 between is okay but between word2 and word3 is
not okay
    int pos=0;
    while((pos = line.indexOf("  "))>-1)
    {
       line = line.substring(0,pos)+line.substring(pos+1);
     }
     System.out.println(line);
     String[] headerLabels= {line};
     Object[][] data={{}};
     model=new DefaultTableModel(data,headerLabels);
     table=new JTable(model);

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar


Thread

Help in Trim and putting "Sriram" <sriram@THRWHITE.remove-dii-this> - 2011-04-27 15:49 +0000
  Re: Help in Trim and putt "Sabine Dinis Blochberger" <sabine.dinis.blochberger@THRWHITE.remove-dii-this> - 2011-04-27 15:49 +0000
    Re: Help in Trim and putt "Sriram" <sriram@THRWHITE.remove-dii-this> - 2011-04-27 15:49 +0000

csiph-web