Artikel ini memperkenalkan alat transfer file sederhana berdasarkan soket dan javafx. Ini dibagikan kepada Anda untuk referensi Anda. Konten spesifiknya adalah sebagai berikut
aplikasi paket; impor java.io.file; Impor org.james.component.buttonbox; impor org.james.component.filereceivergrid; impor org.james.component.filesendergrid; impor javafx.application.application; impor javafx.event.acticleevent; impor javafx.event.eventhandler; impor javafx; impor javafx; impor javafx; impor javafx; impor javafx; impor javafx; impor javafx. javafx.scene.layout.bordpane; import javafx.stage.filechooser; import javafx.stage.stage; Public Class Main Extends Application {Public Static Static PrimaryStage; @Override public void start (tahap primarystage) {coba {this.primarystage = primarystage; primarystage.setfullScreen (false); primarystage.setriSizable (false); Filereceivergrid filereceivergrid = new filereceivergrid (); filereceivergrid.initialize (); FileSenderGrid fileDenderGrid = new fileDenderGrid (); fileDenderGrid.Initialize (); ButtonBox ButtonBox = new ButtonBox (); ButtonBox.Initialize (); Root borderpane = borderpane baru (); root.settop (filereceivergrid); root.setbottom (ButtonBox); ButtonBox.GetReceiveFileFunc (). Setonaction (EventHandler baru <ActionEvent> () {@Override public handle (ActionEvent Event) {ButtonBox.getReceiveFileFunce (). setDisable (true); ButtonBox.getSendFilEfunce (). setDisable (false); root.sendBOtsEpL) (false); root.sendFilEfunce (). setDisable (false); root. ButtonBox.GetSendFileFunc (). SetonAction (EventHandler baru <ActionEvent> () {@Override public handle public (event ActionEvent) {buttonbox.getReceiveFileFunce (). setDisable (false); FileDenderGrid.GetSelectFileBtn (). SetonAction (EventHandler baru <ActionEvent> () {@Override public handle (ActionEvent Event) {FileChooser FileChooser = FileChooser (FileChooser. null) {fileDenderGrid.setFile (SelectedFile); Adegan adegan = adegan baru (root, 800.400); scene.getstylesheets (). add (getClass (). getResource ("application.css"). toExternalform ()); primarystage.setscene (adegan); primarystage.show (); } catch (Exception e) {E.PrintStackTrace (); }} public static void main (string [] args) {launch (args); }}Di atas adalah semua tentang artikel ini, saya harap ini akan membantu untuk pembelajaran semua orang.