Logo QF-Test

Finding valuable answers
in the Mailing List Archive.


Free Trial  Download  Buy

Thomas Max, QF-Test training and support

Use the full-text search on our web site to find helpful tips on the mailing list.

Thomas Max, 
Sr. Software Engineer & Trainer, QFS

2017 up to now  | 2016 | 2015 | 2014 | 2013 | 2012 | 2011 | 2010 | 2009 | 2008 | 2007

(older archive entries before 2007 are not shown here, but included in the onsite-search)

Mailing List - Entries of 2011

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] [qftestJUI] header checkbox in a JTable

  • Subject: Re: [QF-Test] [qftestJUI] header checkbox in a JTable
  • From: RIDOUX Sylvain <sylvain.ridoux@?.com>
  • Date: Fri, 23 Dec 2011 07:55:19 +0100

Hi Robert,

Thanks for your help.

By adapting the script in my code, it works.

I can get the status of the checkbox in the header, and change it if necessary.

thank you very much

Best Regards



-----Message d'origine-----
De : Robert Lahmer, QFS support [mailto:support@?.de] 
Envoyé : jeudi 22 décembre 2011 11:33
À : qftest-list@?.de
Cc : RIDOUX Sylvain
Objet : Re: [QF-Test] [qftestJUI] header checkbox in a JTable

Hello Sylvain,

most likely, a JCheckBox resides somewhere in the header's renderer. Please 
try out the following 'SUT script' to find out programmatically whether it 
is selected or not:

from javax.swing import JCheckBox

# Adapt the table's Component Id
# and the column's index
table = rc.getComponent("mytable")
colidx = 0
column = table.getColumnModel().getColumn(colidx)
renderer = column.getHeaderRenderer()
value = column.getHeaderValue()
com = renderer.getTableCellRendererComponent(table, value, false, false, 
-1, colidx)
if isinstance(com, JCheckBox):
    print com.isSelected()
    for c in com.getComponents():
        if isinstance(c, JCheckBox):
            print c.isSelected()

Best regards,

--On Mittwoch, Dezember 21, 2011 08:26:12 +0100 RIDOUX Sylvain 
<sylvain.ridoux@?.com> wrote:

> Hi,
> I want to check, if a checkbox(in the header of a Jtable)  is selected.
> i try "check text" node, it 's ok for a cell, but it does not work for a
> checkbox in a header. i can not recover the checkbox with a script in
> order to test it state.
> do you have any idea ?
> Thanks
> Sylvain

QFS Support - Robert Lahmer
Quality First Software GmbH                http://www.qfs.de
Tulpenstr. 41                         Tel: +49 8171 38648-20
DE-82538 Geretsried                   Fax: +49 8171 38648-16
GF: Gregor Schmid, Karlheinz Kellerer     HRB München 140833

Videos Downloads Documentation Buy Free Trial