Java 手动设置回转JInternalFrame lnf

Java 手动设置回转JInternalFrame lnf,java,swing,look-and-feel,jinternalframe,jdesktoppane,Java,Swing,Look And Feel,Jinternalframe,Jdesktoppane,为什么启动时未设置内部框架的标题背景 我试着将它设置在整体JFrameinit上,但没有什么不同(相比之下,我可以在这个位置更改其他JFrameui组件的外观和感觉,例如MenuItem.background,因此我认为这可能是因为JInternalFrame不是顶级组件,即在选项卡式窗格下,它可能需要在其他点进行更改,但在哪里?) 关于调用UIManager.put()的正确位置的任何提示对于JInternalFrame?我认为您需要在创建任何Swing组件之前调用UIManager.put。

为什么启动时未设置内部框架的标题背景

我试着将它设置在整体
JFrame
init上,但没有什么不同(相比之下,我可以在这个位置更改其他
JFrame
ui组件的外观和感觉,例如
MenuItem.background
,因此我认为这可能是因为
JInternalFrame
不是顶级组件,即在选项卡式窗格下,它可能需要在其他点进行更改,但在哪里?)


关于调用
UIManager.put()
的正确位置的任何提示对于
JInternalFrame

我认为您需要在创建任何Swing组件之前调用UIManager.put。

我认为您需要在创建任何Swing组件之前调用UIManager.put。

最终得到了它-调用put()在JInternalFrame创建后工作正常,但在将组件添加到容器之前,我确实做到了。然后,我仍然需要设置它的UI:

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);

最终得到了它-在JInternalFrame创建之后调用put()可以正常工作,但在将组件添加到容器之前,我确实做到了。然后,我仍然必须设置它的UI:

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);

我这样做了,并添加了MenuItem.background颜色的更改,但只有MenuItem颜色更改,而不是JInternalFrame标题背景的颜色。我还需要做什么来设置JInternalFrame的外观和感觉?你能发布一个尽可能小的工作示例来重现这个问题吗?我这样做了,并添加了d也改变了MenuItem.background颜色,但只有MenuItem颜色改变了,而不是JInternalFrame标题背景的颜色。我还需要做些什么来设置JInternalFrame的外观和感觉吗?你能给出重现此问题的最小可能工作示例,以便我可以尝试一下吗?