我试图建立一个聊天程序。我可以做到这一点,当我使用java awt
包但java fx
我似乎有点困惑。当你第一次建立一个java fx project
所有的方法,即使public static void main(string args[])
在那里,有一个地方,你开始primaryStage
的编码...我没有问题编码我的程序的视觉方面它只是我不知道我应该设置我的方案,并把它放在哪里时,即时通讯做的Network
部分..JavaFX聊天应用程序
**CODE: This is Just a View**
Server extends Application{
public void start(Stage primaryStage){
//Where you setup the visual of your program
}
public static void main(String args[]){
launch(args); // Where the program will run
}
public void ServerConnection(){
//where i put the codes to setup my streams and SOCKET
}
的一个ServerConnection方法包含其他methods
很好,但所有这些将前往ServerConnectionMethod现在我的问题是Wh ERE将我把我的一个ServerConnection方法,以便如果JavaFX应用程序正确启动,将伴随着我primary Stage
很抱歉的长期post..have一个String ="potato";
想到'开始(...)'方法在JavaFX应用程序中相当于“传统”Java应用程序中的“main(...)”方法;主要区别在于''start(...)'方法在UI线程上执行,并且为了方便而接收'Stage'实例。 –