JAVAFX梭哈游戏排行榜(Mysql与JDBC)
实验内容
在Mysql数据库中创建数据库showhand,同时创建表users,表字段内容参考下图,使用Swing/awt/JavaFx创建下面图表,使用JDBC知识完成以下功能:
显示所有数据表users中的全部记录;
根据昵称查询users符合条件的用户列表;
布局图
现实部分
MainUI 代码
package ShowHand;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javafx.application.Application;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.TableColumn.CellDataFeatures;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.util.Callback;
public class MySqlTableUI extends Application{
public static void main(String[] args) {
// TODO Auto-generated method stub
launch(args);
}
public void start(Stage stage) throws Exception{
ObservableList<Person> persons = FXCollections.observableArrayList();
//TableView table = new TableView();
//与数据库建立联系,读取数据
Class.forNa