最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于socket和javaFX簡單文件傳輸工具

 更新時間:2016年02月10日 21:21:35   作者:uncle_zhang  
這篇文章主要介紹了基于socket和javaFX簡單文件傳輸工具的相關(guān)資料,需要的朋友可以參考下

本文實(shí)例介紹了基于socket和javaFX簡單文件傳輸工具,分享給大家供大家參考,具體內(nèi)容如下

package application;
   
import java.io.File;
 
import org.james.component.ButtonBox;
import org.james.component.FileReceiverGrid;
import org.james.component.FileSenderGrid;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
 
 
public class Main extends Application {
   
  public static Stage primaryStage;
   
  @Override
  public void start(Stage primaryStage) {
    try {
      this.primaryStage = primaryStage;
      primaryStage.setFullScreen(false);
      primaryStage.setResizable(false);
       
      FileReceiverGrid fileReceiverGrid = new FileReceiverGrid();
      fileReceiverGrid.initialize();
      FileSenderGrid fileSenderGrid = new FileSenderGrid();
      fileSenderGrid.initialize();
       
      ButtonBox buttonBox = new ButtonBox();
      buttonBox.initialize();
       
      BorderPane root = new BorderPane();
      root.setTop(fileReceiverGrid);
      root.setBottom(buttonBox);
       
      buttonBox.getReceiveFileFunc().setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
          buttonBox.getReceiveFileFunc().setDisable(true);
          buttonBox.getSendFileFunc().setDisable(false);
          root.setTop(fileReceiverGrid);
        }
      });
       
      buttonBox.getSendFileFunc().setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
          buttonBox.getReceiveFileFunc().setDisable(false);
          buttonBox.getSendFileFunc().setDisable(true);
          root.setTop(fileSenderGrid);
        } 
      });
       
      fileSenderGrid.getSelectFileBtn().setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
          FileChooser fileChooser = new FileChooser();
          fileChooser.setTitle("打開文件");
          File selectedFile = fileChooser.showOpenDialog(primaryStage);
          if(selectedFile != null){
            fileSenderGrid.setFile(selectedFile);
            fileSenderGrid.getFileNameLabel().setText(selectedFile.getPath());
          }
        } 
      });
       
      Scene scene = new Scene(root,800,400);
      scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
      primaryStage.setScene(scene);
      primaryStage.show();
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
   
   
  public static void main(String[] args) {
    launch(args);
  }
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助。

相關(guān)文章

  • 詳解Spring中的攔截器與過濾器

    詳解Spring中的攔截器與過濾器

    Filter?過濾器和Interceptor?攔截器是SpringBoot?的?Web?項目開發(fā)中長用到的,本文主要來和大家討論一下?Filter?與?Interceptor?的做法及它們之間的區(qū)別,需要的可以參考下
    2023-07-07
  • Prometheus 入門教程之SpringBoot 實(shí)現(xiàn)自定義指標(biāo)監(jiān)控

    Prometheus 入門教程之SpringBoot 實(shí)現(xiàn)自定義指標(biāo)監(jiān)控

    這篇文章主要介紹了Prometheus 入門教程之SpringBoot 實(shí)現(xiàn)自定義指標(biāo)監(jiān)控,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-12-12
  • SpringBoot+Mybatis-plus+shardingsphere實(shí)現(xiàn)分庫分表的方案

    SpringBoot+Mybatis-plus+shardingsphere實(shí)現(xiàn)分庫分表的方案

    實(shí)現(xiàn)億級數(shù)據(jù)量分庫分表的項目是一個挑戰(zhàn)性很高的任務(wù),下面是一個基于Spring Boot的簡單實(shí)現(xiàn)方案,感興趣的朋友一起看看吧
    2024-03-03
  • Spring Cache的使用示例詳解

    Spring Cache的使用示例詳解

    SpringCache是構(gòu)建在SpringContext基礎(chǔ)上的緩存實(shí)現(xiàn),提供了多種緩存注解,如@Cachable、@CacheEvict、@CachePut等,本文通過實(shí)例代碼介紹了Spring Cache的使用,感興趣的朋友一起看看吧
    2025-01-01
  • 整理Java編程中字符串的常用操作方法

    整理Java編程中字符串的常用操作方法

    這篇文章主要介紹了Java編程中字符串的常用操作方法的整理,字符串處理是Java入門學(xué)習(xí)中的基礎(chǔ)知識,需要的朋友可以參考下
    2016-02-02
  • @TableField注解之深入理解與應(yīng)用方式

    @TableField注解之深入理解與應(yīng)用方式

    在現(xiàn)代軟件開發(fā)中,@TableField注解作為MyBatis-Plus中的一個重要特性,用于定義實(shí)體類字段與數(shù)據(jù)庫表字段的映射關(guān)系,本文詳細(xì)介紹了@TableField注解的使用場景、屬性及其在實(shí)際開發(fā)中的應(yīng)用,包括字段名稱映射、非數(shù)據(jù)庫字段標(biāo)識、字段填充策略
    2024-10-10
  • SpringBoot+Mybatis-plus實(shí)現(xiàn)分頁查詢的示例代碼

    SpringBoot+Mybatis-plus實(shí)現(xiàn)分頁查詢的示例代碼

    本文主要介紹了SpringBoot+Mybatis-plus實(shí)現(xiàn)分頁查詢的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-02-02
  • Java實(shí)現(xiàn)差分?jǐn)?shù)組的示例詳解

    Java實(shí)現(xiàn)差分?jǐn)?shù)組的示例詳解

    差分?jǐn)?shù)組是由原數(shù)組進(jìn)化而來,值為原數(shù)組當(dāng)前位置值減去上一個位置的值。本文將通過例題詳解如何利用Java實(shí)現(xiàn)差分?jǐn)?shù)組,需要的可以參考一下
    2022-06-06
  • 為什么rest接口返回json建議采用下劃線形式,不要用駝峰

    為什么rest接口返回json建議采用下劃線形式,不要用駝峰

    為什么rest接口返回json建議采用下劃線形式,不要用駝峰?今天小編就來為大家說明一下原因,還等什么?一起跟隨小編過來看看吧
    2020-09-09
  • Springboot如何實(shí)現(xiàn)對配置文件中的明文密碼加密

    Springboot如何實(shí)現(xiàn)對配置文件中的明文密碼加密

    這篇文章主要介紹了Springboot如何實(shí)現(xiàn)對配置文件中的明文密碼加密問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-12-12

最新評論

宜川县| 资溪县| 东山县| 鱼台县| 滨州市| 碌曲县| 滁州市| 台江县| 农安县| 宁远县| 佛坪县| 香河县| 云浮市| 钦州市| 柳江县| 张掖市| 柯坪县| 锦屏县| 曲周县| 徐水县| 库尔勒市| 浮梁县| 临安市| 兴隆县| 卓资县| 丰镇市| 玛纳斯县| 靖江市| 社会| 莲花县| 泰兴市| 甘肃省| 谷城县| 循化| 新化县| 宝山区| 绵竹市| 大化| 昌图县| 南雄市| 泸水县|