可配置的 jframe 元素

发布于 2025-01-15 02:20:15 字数 109 浏览 13 评论 0原文

我已经使用 Swing JFrame 构建了一个数字时钟,目前时钟是实时的,但它始终会显示一组时区。我可以配置时区吗?

我想设置时区、标签名称、显示/隐藏时钟。 这些可以在可执行jar中吗?

I have build a digital clock using Swing JFrame, for now the clock is live but it will always show a set of timezone. Is that possible for me to configure the timezone?

I want to set the timezone, name of the label, show/hide the clock.
Is these are possible in executable jar?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£噩梦荏苒 2025-01-22 02:20:15

作为一个可配置的应用程序,我们有两个选项

  1. 数据库
  2. 文件

如果它是一个小型应用程序,那么选择数据库完全是浪费时间和内存。我们可以通过写入/读取文件来实现相同的目的。

同样,如果我们将configuration.properties 或参考文件与可运行的jar 一起打包。它将失败,因为jar 中的所有文件都是只读的,我们无法写入其中。
所以唯一的可能就是

在 jar 的同一位置或系统中创建临时文件
临时文件夹

Being a configurable application we have two options

  1. Database
  2. File

If it's a small application then choosing a database is completely waste of time and memory. We can achieve the same via writing/reading the file.

Again, if we are packing the configuration.properties or reference file along with our runnable jar. It will fail because all the files within jar are read only, we cannot write into it.
So the only possibility is to

create a temp file either in the same location of the jar or in system
temp folder

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文