🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to programatically select a row in JTable. Please HELP

#9948
From: Zippy
Date: Thu, 16 Dec 1999 00:00
23 lines
1434 bytes
After you select the row you probably want to move it to the visible
range to do that ...
    public void scrollToRow ( int row )
	{
	Rectangle rect = jtable.getCellRect( row, 0, true );
	jtableScrollPane.getViewport().scrollRectToVisible( rect );
	}

>jTable.getSelectionModel().setSelectionInterval(startingRow,endingRow);
>where startingRow and endingRow are type int, and the first row of the table
>is 0.
>
>Imran Hussain wrote:
>
>> Hi,
>> I need to programatically change the selected row in a JTable. I
>> searched the API docs but could not find a function like setSelection or
>> setCurrentRow.
>>
>> Could someone please help me out.
>>
>> Thanks,
>> Imran.
Technical Details
Message-ID: <38584670.2470166@news.pangea.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3857C1D4.6A225AE1@imranweb.com> <3857CEFA.DB0C015D@borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,3e1af3c9adc5980
X-Google-Attributes: gid111d45,public
From: Zippy@Pangea.ca (Zippy)
Subject: Re: How to programatically select a row in JTable. Please HELP
Date: 1999/12/16
Message-ID: <38584670.2470166@news.pangea.ca>
X-Deja-AN: 561231533
Content-Transfer-Encoding: 7bit
References: <3857C1D4.6A225AE1@imranweb.com> <3857CEFA.DB0C015D@borland.com>
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@pangea.ca
X-Trace: pumpkin.pangea.ca 945310483 2850 64.4.89.60 (16 Dec 1999 02:14:43 GMT)
Organization: Oats
Mime-Version: 1.0
Reply-To: Zippy@Pangea.ca
NNTP-Posting-Date: 16 Dec 1999 02:14:43 GMT
Newsgroups: borland.public.jbuilder.java.swing