Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #4307
| From | "Sriram" <sriram@THRWHITE.remove-dii-this> |
|---|---|
| Subject | Re: Help in Trim and putt |
| Message-ID | <0964e952-f808-4e99-8d18-cc2eb4530047@z18g2000prn.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| References | <t9mdnbp_gKmYGnHVnZ2dnUVZ8gOdnZ2d@novis.pt> |
| Date | 2011-04-27 15:49 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
On Oct 8, 3:10 pm, Sabine Dinis Blochberger <no.s...@here.invalid>
wrote:
> Sriram wrote:
>
> > 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
>
> It means you're trying to access an index of an array, that doesn't
> exist. For example, try to access item at index 5 when the array only
> has 4 elements. IIRC a negative index also throws this exception.
>
>
>
>
>
>
>
> > 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)
> > {
>
> You check for two spaces here. This means it won't separate word1 and
> word2.
>
> > line = line.substring(0,pos)+line.substring(pos+1);
> > }
> > System.out.println(line);
> > String[] headerLabels= {line};
> > Object[][] data={{}};
>
> I'm not familiar with these constructs of curly braces.
>
> > model=new DefaultTableModel(data,headerLabels);
> > table=new JTable(model);
>
> --
> Sabine Dinis Blochberger
>
> Op3racionalwww.op3racional.eu- Hide quoted text -
>
> - Show quoted text -
Hi
Thanks for your quick reply. What I am trying to do is remove the
blank spaces between word2 and word3 (see string example below) and
make it looks like word1 word2 word3 word4 , put them in each column
of a JTable
String line = "word1 word2 word3 word4";
The String[] headerLabels must read the line output like this String[]
headerLabels={"word1","word2","word3","word4"} after joining them
together (i.e) removing the blank spaces
---
* 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 | Next — Previous in thread | Find similar
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