🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

DefaultTableModel, moving rows

#9195
From: Werner Moschina
Date: Thu, 11 May 2000 00:00
37 lines
1503 bytes
Hi,

is there a bug in the DefaultTableModel class moveRow method? Moving up
in the JTable is no problem, but moving downward results in total
confusion.
(0,1,2,3,4,5,6,7,8,9,10) before
moveRows(6,9,10) // the result should be (0,1,2,3,4,5,10,6,7,8,9)
(0,1,2,3,4,5,7,9,6,10,8) after

Have I misunderstood the examples of moves in Sun's "Java[TM] 2
Platform, Standard Edition, v1.2.2 API Specification" or what am I doing
wrong?
Code fragment:
---------- cut here ---------
final Object[][] data =
{
  {
    "entry1", "entry2", "entry3", "index0", "entry4"
  },
  {
    "entry1", "entry2", "entry3", "index1", "entry4"
  } // and so on up to index 10
}

final String[] tableHeader =
{
  "", "Module", "Document", "index", "Step Name"
};

DefaultTableModel tourTableModel = new DefaultTableModel(data,
tableHeader);
JTable jTableTourSteps = new JTable(tourTableModel);

tourTableModel.moveRow(6,9,10);
---------- cut here ---------

regards Werner
Technical Details
Message-ID: <391A638A.5C9FEB72@stutensee.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,e05f1d447b59fc27,start
X-Google-Attributes: gid111d45,public
From: Werner Moschina <wmo@stutensee.net>
Subject: DefaultTableModel, moving rows
Date: 2000/05/11
Message-ID: <391A638A.5C9FEB72@stutensee.net>
X-Deja-AN: 621936370
Content-Transfer-Encoding: 7bit
Organization: Another Netscape Collabra Server User
X-Accept-Language: de
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing