栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

序列化JavaFX组件

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

序列化JavaFX组件

如果将用户组件保存在服务器端的主要目的是-可以向用户显示相同的界面-为什么不保存您需要的有关用户组件的所有描述性信息,以及何时需要-
只需重建用户界面再次使用存储的描述性信息?这是原始示例:

 public class DropedComponentsCoordinates implements Serializable{private String componentID;private String x_coord;private String y_coord;//and so on, whatever you need to get from yor serializable objects;//getters and setters are assumed but not typed here. }  public class YourController implements Initializable {List<DropedComponentsCoordinates> dropedComponentsCoordinates;@Overridepublic void initialize(URL url, ResourceBundle rb) {    dropedComponentsCoordinates = new ArrayList();}//This function will be fired, every time //a user has dropped a component on the place he/she wantspublic void onDropFired(ActionEvent event) {    try {        //getting the info we need from components        String componentID = getComponentID(event);        String component_xCoord = getComponent_xCoord(event);        String component_yCoord = getComponent_yCoord(event);        //putting this info to the list        DropedComponentsCoordinates dcc = new DropedComponentsCoordinates();        dcc.setX_Coord(component_xCoord);        dcc.setY_Coord(component_yCoord);        dcc.setComponentID(componentID);    } catch (Exception e) {        e.printStackTrace();    }}private String getComponentID(ActionEvent event){    String componentID;        return componentID;}private String getComponent_xCoord(ActionEvent event){    String component_xCoord;        return component_xCoord;}private String getComponent_yCoord(ActionEvent event){    String component_yCoord;        return component_yCoord;}}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/449668.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号