【发布时间】:2016-02-22 16:51:58
【问题描述】:
我想使用 Java NetBeans 在调色板 GUI 中执行选定的项目。我打算先选择一个或多个项目,然后执行按钮。代码如下:
User user = status.getUser();
Date dated = status.getCreatedAt();
PreparedStatement stmt = null;
Connection conne = null;
try {
Class.forName("com.mysql.jdbc.Driver");
jTextArea1.append("Connecting to database... " + "\n");
conne = DriverManager.getConnection("jdbc:mysql://localhostuseUnicode=true&characterEncoding=UTF-8", "root", "");
jTextArea1.append(status + "\n");
jTextArea1.append("Inserting records into the table..." + "\n");
stmt = conne.prepareStatement("set names 'utf8'");
stmt.execute();
stmt = conne.prepareStatement("set character set utf8");
stmt.execute();
stmt = conne.prepareStatement("INSERT INTO japantweet(ID,date,name,statusLocation,text,source) VALUES (?,?,?,?,?,?)");
stmt.setInt(1, (int) status.getId());
stmt.setString(2, getTimeStamp());
stmt.setString(3, status.getUser().getScreenName());
stmt.setString(4, user.getLocation());
stmt.setString(5, status.getText());
stmt.setString(6, status.getSource());
stmt.executeUpdate();
jTextArea1.append("this record inserted!" + "\n");
jTextArea1.append("=======================" + "\n");
} catch (SQLException se) {
se.printStackTrace();
} catch (final Exception e) {
e.printStackTrace();
}
这是界面:
非常感谢您的任何评论!
【问题讨论】:
-
执行选中项是什么意思??
-
我的意思是执行一项或多项检查项目
-
这里的问题是关于执行 当你点击
Run时如果你同时选择Japan和Indonesia会发生什么?? -
是的,这就是我的意思。抱歉解释不清楚..
-
当您点击
Run时,如果您同时选择Japan和Indonesia会发生什么??
标签: java user-interface netbeans checkbox execute