📄 comboboxframe.java
字号:
package book;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.swing.JComboBox;
public class ComboboxFrame extends JComboBox {
ComboboxFrame(String str) throws SQLException {
MainDAO dao = new MainDAO();
if (str.equals("读者类别")) {
String leibie;
boolean boo = false;
ResultSet rs = dao.getSelect("select * from duzheleibie");
while ((boo = rs.next()) == true) {
leibie=rs.getString("读者类别");
this.addItem(leibie);
}
}
if(str.equals("性别")){
this.addItem("男");
this.addItem("女");
}
if(str.equals("出版社")){
String leibie;
boolean boo = false;
ResultSet rs = dao.getSelect("select * from chubanshe");
while ((boo = rs.next()) == true) {
leibie=rs.getString("出版社名称");
this.addItem(leibie);
}
}
if(str.equals("ISBN")){
String leibie;
boolean boo = false;
ResultSet rs = dao.getSelect("select * from chubanshe");
while ((boo = rs.next()) == true) {
leibie=rs.getString("ISBN");
this.addItem(leibie);
}
}
if(str.equals("图书类别")){
String leibie;
boolean boo = false;
ResultSet rs = dao.getSelect("select * from tushuleibie");
while ((boo = rs.next()) == true) {
leibie=rs.getString("图书类别");
this.addItem(leibie);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -