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: "Robert Lahmer, QFS support" <support@?.de>
  • Date: Thu, 22 Dec 2011 11:32:59 +0100

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:


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 ?




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