🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8574

Re: Adding a row with a Jbutton

#8574
From: Sven Goetgeluck
Date: Wed, 09 Aug 2000 00:00
39 lines
1591 bytes
Hi,
Lee-Ann
had the same problem to add at runtime rows to a table
but solved it this way :
made a tableModel extended from a
AbstractTableModel
this has the function addObject wich adds rows into the table
make a class of the data you want to add and call the function addobject
with a new instance of the data

fe
 JTable objectsTable = null;
MyTableModel tableModel = null;
tableModel = new MyTableModel();
objectsTable = new JTable(tableModel);
...
...
add following line to the button
 tableModel.addObject(new
workstationObjectClass(on.Op_ObjectName,on.Op_GreenValue,on.Op_YellowValue,o
n.Op_OrangeValue,on.Op_RedValue));

greetins sven


"Lee-Ann" <lmccallion@telesoft-technologies.com> wrote in message
news:398feeda_1@dnews...
> Hi
>
> I am trying to add a row to a JTable using a button command.
> I am using the defaultTableModel and there is a method addRow( ).
> The problem is initiating this method from the button. The variable name
of
> the table model is not visible inside the button.
>
> Thanks
> Lee-Ann
>
>
Technical Details
Message-ID: <399057d7_2@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <398feeda_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,bd6def7290194c36
X-Google-Attributes: gid111d45,public
From: "Sven Goetgeluck" <sven.goetgeluck@pandora.be>
Subject: Re: Adding a row with a Jbutton
Date: 2000/08/09
Message-ID: <399057d7_2@dnews>
X-Deja-AN: 655951570
References: <398feeda_1@dnews>
X-Trace: 8 Aug 2000 11:56:23 -0800, 213.224.11.139
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: borland.public.jbuilder.java.swing
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400