记住在客户端的独立应用程序上输入的值 [英] Remember the values entered on standalone app on the client side
问题描述
我们有一个独立的java swing应用程序,用户可以通过提供IP来在打印机上打印他绘制的内容。
现在要求应用程序需要记住此用户最后一次给出的IP。
<到目前为止我能想到的是(虽然是一个粗野的) - 在客户端计算机上保留一个日志文件类型的存储,并且每次应用程序出现时它都会读取最后提交的一个。
任何建议都会有所帮助。
提前致谢。
以下是使用Java的教程首选项 API实现您想要的。
来自文章:
Java Preferences API提供
系统方式来处理用户和
系统偏好和配置
数据,例如为了保存用户设置,
记住字段
等的最后一个值。
我会用这种方法将任何数据显式写入文件,因为它与平台无关。
We have a standalone java swing app, in which the user can print something that he drew, on a printer by giving its IP.
Now the requirement is that the app needs to remember the ip that was given the last time by this user.
What I could think of till now is (a brute one though) - keep a log file kind of storage on the client machine, and that everytime the app comes up it reads the last submitted one.
Any suggestions would be helpful.
Thanks in advance.
Here's a tutorial on using the Java Preferences API to achieve what you want. From the article:
The Java Preferences API provides a systematic way to handle user and system preference and configuration data, e.g. to save user settings, remember the last value of a field etc.
I would use this approach over writing any data out explicitly to a file because its platform agnostic.
这篇关于记住在客户端的独立应用程序上输入的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!