51Testing软件测试论坛

标题: WinRunner:JComboBox in a JTable [打印本页]

作者: pcl2004_27    时间: 2006-10-30 14:27
标题: WinRunner:JComboBox in a JTable
Description

      How to select a JcomboBox item from a JTable cell.


Solution

      ##################################################################
# This function selects an item from a JComboBox in JTable cell.
# PARAMETERS DESCRIPTION:
# Obj -> The logical name of the table
# row -> The number of the row (first is 0)
# col -> The number of the column (first is 0)
# item -> The number of the item to select (first is 0)
###################################################################

public function select_comb_item(in Obj, in row, in col, in item)
{
auto editor;
auto comboB;
auto colName;
auto retVal;
auto hasCh;

java_activate_method(Obj,"getCellEditor",editor,row,col);
java_activate_method(editor,"getComponent",comboB);
tbl_get_column_name(Obj,col,colName);
tbl_click_cell(Obj, "#"&row, colName);
java_activate_method(comboB,"setSelectedIndex",retVal,item);
java_activate_method(comboB,"selectedItemChanged",hasCh);
jco_free_all();
}

#EXAMPLE
set_window("SwingSet", 4);
select_comb_item("Inter-cell spacing:_1",0,2,4);




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2