问题描述
我们有一个独立的java swing应用程序,用户可以通过提供IP来在打印机上打印他绘制的内容。
现在要求应用程序需要记住此用户最后一次给出的IP。
任何建议都会有所帮助。
提前致谢。
以下是使用Java的教程 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:
I would use this approach over writing any data out explicitly to a file because its platform agnostic.
这篇关于记住在客户端的独立应用程序上输入的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!