等待jbutton单击以继续执行程序java

时间:2015-11-22 21:38:04

标签: java swing

如何在main方法中知道单击一个按钮以继续执行,因为代码在actionperfomed按钮内不起作用。

例如,这是我的主要方法

    public static void main(String args[]) {
jwindows jw = new jwindows ();

//stop until a button inside the jwindows is clicked

// codeExecuteAfterButtonClick 

}

1 个答案:

答案 0 :(得分:0)

// prepare dummy data $month = date('M'); $year = date('Y'); $sheetData = array( array('data00', 'data01') ,array('col1', 'col2', 'col3', 'col4', 'col5', 'col6') ,array('data20', "data21") ,array('data30', 'data31') ,array('data40', 'data41') ); // prepare vars $tableName = "{$month}_{$year}"; $dataCount = count($sheetData); // prepare columns $columnsSQL = ""; foreach ($sheetData[1] as $columnName) { // wrap with ` ticks $columnsSQL .= '`'. preg_replace('#[ ]#', '_', $columnName).'`'.','; } $columnsSQL = rtrim($columnsSQL, ','); // prepare values $valuesSQL = ""; for ($i=2;$i < $dataCount;$i++) { foreach($sheetData[$i] as $columnValue){ $valuesSQL .= "'{$columnValue}', "; } } $valuesSQL = rtrim($valuesSQL, ', '); $SQL = " INSERT INTO {$tableName}( {$columnsSQL} ) VALUES ( {$valuesSQL} )"; INSERT INTO Nov_2015( `col1`,`col2`,`col3`,`col4`,`col5`,`col6` ) VALUES ( 'data20', 'data21', 'data30', 'data31', 'data40', 'data41' ) 方法是存在的对象来处理这种情况

wait