有没有办法将类型转换String
为JLayeredPane
?以下是我正在使用的代码:
private static void build_tables() {
String sql="SELECT * FROM pos_tables WHERE pos_company_id='"
+global_variables.company_id
+"' AND shop_type='"
+global_variables.shop_type
+"'";
if(mysql_query.count_mysqls(variables.con.conn, sql)>0){
try {
ResultSet rs = mysql_query.execute_mysql(variables.con.conn, sql);
while (rs.next()) {
JLayeredPane JL = (JLayeredPane)rs.getObject("parent_floor");
tablesetup.addButton(rs.getString("table_name"),
Integer.parseInt(rs.getString("x")),
Integer.parseInt(rs.getString("y")), JL);
}
} catch (SQLException ex) {
Logger.getLogger(builder.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
我收到以下错误:
线程“AWT-EventQueue-0”java.lang.ClassCastException 中的异常: java.lang.String 不能转换为 javax.swing.JLayeredPane