在我的应用程序中,我有一个JFrame
显示JSplitPane
,分割为VERTICAL_SPLIT
。顶部显示一个JLabel
,底部显示一个JInternalFrame
。发生两个问题。JSplitPane没有绘画修正
的
JLabel
被显示,但JInternalFrame
不是。2.我在所有
我相信这是首尾相连的不正确使用的JSplitPane
来调整应用程序有JSplitPane
显示。但是,我一直无法解决什么问题。我可以帮助解决这个问题吗?
p.s.我已经运行测试以确保GUIWindow.getInsideFrame()
未返回null
。最后的instanceof
检查表示该窗格中的两个组件都存在且属于该类型。非常感谢您对您的帮助:
protected static void newWindow(GUIFrame window) {
SwingUtilities.invokeLater(new Runnable(){
@Override
public void run() {
JSplitPane pane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
JInternalFrame intFrame = window.getInsideFrame();
pane.setRightComponent(intFrame);
pane.setLeftComponent(new JLabel(window.getDescription()));
synchronized(lock){
frame.remove(currentPane);
frame.add(pane);
}
synchronized(lock){
frame.revalidate();
pane.setVisible(true);
frame.repaint();
if(window instanceof ColourFrameShower) return;
currentWindow = window;
currentPane = pane;
currentFrame = intFrame;
}
if(pane.getLeftComponent() instanceof JLabel) System.out.println("JLabel exists!");
else System.out.println("JLabel does not exist!");
if(pane.getRightComponent() instanceof JInternalFrame) System.out.println("JInternalFrame exists!");
else System.out.println("JInternalFrame does not exist!");
}
});
}
编辑:我固定的问题2在第二synchronised(lock)
块的开始frame.revalidate()
通话。这已包含在代码中。
谢谢 – JD9999
你试图显示只有你的JInternalFrame编辑:),没有JSplitPanel?它工作吗? :) – Kapcash
是的,没有JSplitPanel它正在工作。在我的github上查看整个应用程序的最新版本:https://github.com/JD9999/GUI-of-everything – JD9999