我希望有多个客户端通过LAN连接到服务器并访问/修改服务器中的mySQL数据库.
我该怎么做呢?你们能提供一些我可以研究这个主题的资源/链接吗?
我想要实现的是从main方法获取控制器实例,所以我可以从另一个类调用控制器的方法并更新fxml.不管怎样,这是我的代码:
主要课程:
public class Main extends Application {
Controller controller;
@Override
public void start(Stage primaryStage) throws Exception{
FXMLLoader fxmlLoader = new FXMLLoader();
Parent root = fxmlLoader.load(getClass().getResource("sample.fxml"));
controller = fxmlLoader.getController();
primaryStage.setTitle("uPick Smart Service");
primaryStage.setScene(new Scene(root, 1600, 600));
primaryStage.show();
ConnectionHandling connectionHandling = new ConnectionHandling();
Thread X = new Thread (connectionHandling);
X.start();
}
public static void main(String args[]){
launch(args);
}
public Controller getController(){
return controller;
}
}
Run Code Online (Sandbox Code Playgroud)
我的控制器类:
public class Controller {
public HBox billbox;
public int childnr;
public void createBill() {
System.out.println("Creating"); …Run Code Online (Sandbox Code Playgroud)