手动设置 Swing JInternalFrame lnf
UIManager.put("InternalFrame.activeTitleBackground", new ColorUIResource(new Color(207,255,247)));
UIManager.put("InternalFrame.inactiveTitleBackground", new ColorUIResource(new Color(207,255,247)));
JDesktopPane baTabbedPane = new JDesktopPane();
JInternalFrame iframe = new JInternalFrame("Cheapest To Deliver",true,true,true,true);
iframe.setSize(400,150);
baTabbedPane.add(iframe);
为什么我的内部框架的标题背景在启动时没有设置?
我尝试在整体 JFrame
init 上设置它,但没有什么区别(相比之下,我可以更改其他 JFrame
ui 组件的外观和感觉,例如 MenuItem.background
在这个位置,所以我认为这可能是因为 JInternalFrame
不是顶级组件,即选项卡式窗格下的组件,也许它需要在其他点进行更改,但是在哪里? )
关于为 JInternalFrame
调用 UIManager.put()
的正确位置有什么提示吗?
UIManager.put("InternalFrame.activeTitleBackground", new ColorUIResource(new Color(207,255,247)));
UIManager.put("InternalFrame.inactiveTitleBackground", new ColorUIResource(new Color(207,255,247)));
JDesktopPane baTabbedPane = new JDesktopPane();
JInternalFrame iframe = new JInternalFrame("Cheapest To Deliver",true,true,true,true);
iframe.setSize(400,150);
baTabbedPane.add(iframe);
why is my Internal Frame's title background not set on startup?
I've tried setting it on the overall JFrame
init but made no difference (By contrast I could change other JFrame
ui component look n feel such as MenuItem.background
in this location so I thought it might have been because the JInternalFrame
was not a top-level component i.e. under a tabbed pane, that maybe it needed changing at some other point, but where?)
Any tips on the correct place to call UIManager.put()
for JInternalFrame
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最终得到它 - 在 JInternalFrame 创建之后对 put() 的调用工作正常,但我在将组件添加到容器之前确实做到了。然后我仍然需要设置它的用户界面:
got it eventually - the call to put() works fine after JInternalFrame creation but I did make it before I added the component to a container. I then still had to set it's UI:
我认为您需要在创建任何 Swing 组件之前对 UIManager.put 进行所有调用。
I think you need to make all calls to UIManager.put before you create any Swing components.