SwingX如何获取JXMonthView的子组件?
有人有使用 SwingX 的经验吗? 我想使用 JXMonthView 并修改其组件。我可以毫不费力地使用它。 但是,当我尝试实际接触底层子组件时,我失败了。 我想更改仅显示月份的组件使用的字体样式和颜色。 我正在使用 SwingX 1.6.2。
Anyone had experience with using SwingX?
I want to use JXMonthView and modify its components. I can use it without a sweat.
But when I try to actually get my hands on the underlying child components I fail.
I would like to change the font style and color used only by the component which displays the month.
I am using SwingX 1.6.2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基本上,JXMonthView 没有需要修改的组件(一个例外,请参见下文)。相反,它的绘制是通过渲染机制完成的,类似于表格/树/列表的单元格渲染。 SwingX 定制渲染视觉属性的方式是通过荧光笔来装饰渲染组件。
不幸的是,这一演变陷入了中间的困境:要做到这一点并不容易,也没有真正的公众支持。协作者位于 plaf.basic 中:
因此,自定义 JXMonthView 的视觉效果是一项相当繁琐的工作,涉及到很多子类化。好的一面是:swinglabs-demos 有一个示例,说明如何做到这一点
MonthViewExtDemo
CU
Jeanette
PS:您可以考虑在 SwingLabs 论坛 - 尽管由于 java.net 的迁移问题,它不再像以前那样活跃,但叹息
Basically, a JXMonthView has no components to modify (for the one exception, see below). Instead, it's painting is done by a rendering mechanism, similar to rendering of cells a table/tree/list. The SwingX'ish way to customize the visual properties of the rendering is to decorate the rendering component by a Highlighter.
Unfortunately, the evolution got stuck somewhere in the middle: there's no easy and no really public support to do so. The collaborators are in plaf.basic:
So customizing the visuals of a JXMonthView is quite a chore, involving a lot of subclassing. On the brighter side: swinglabs-demos has an example of how that can be done
MonthViewExtDemo
CU
Jeanette
PS: you might consider to post SwingX specific questions at the SwingLabs Forum - though it's not as active as it used to be, due to migration woes of java.net, sigh
我认为您只需获取 MonthViewUI 并进行所需的更改即可。看一下
JXMonthView
源。I think you can just get the MonthViewUI and make the changes you need. Take a look at the
JXMonthView
source.