我已经创建了一个已添加到框架中的内部框架,但是当我运行它时,我发现内部框架没有任何最大值、最小值、关闭等。我没有对它进行装饰,并且我尝试了一些东西,例如外观和感觉以及未装饰,但似乎没有什么可以解决它。
这是我的代码(frame 是内部框架,outFrame 是 JFrame):
//Adding everything to contentPane.
contentPane.add(label);
contentPane.add(width);
contentPane.add(textWidth);
contentPane.add(height);
contentPane.add(textHeight);
contentPane.add(box);
contentPane.add(bOpen);
//Adding contentPane to the frame.
frame.add(contentPane);
frame.setSize(500, 400);
//frame.setClosable(true);
frame.setVisible(true);
//frame.setBorder(border);
outFrame.add(frame);
outFrame.setVisible(true);
最佳答案
"the internal frame does not have any max,min,close,etc."
看看JInternalFrame API并参见How to use Internal Frames .
您需要设置 iconabilized
、maximizing
和 closable
属性,默认情况下,它们设置为 false
public boolean setMaximized(boolean b)
public void setIconABLE(boolean b)
public void setClosable(boolean b)
或者用这些值构建框架
public JInternalFrame(String title,
boolean resizable,
boolean closable,
boolean maximizable,
boolean iconifiable)
将值设置为 true 将为您提供关闭、最大化和图标化框架的按钮
"I have create and internal frame which has been added to a frame"
JInternalFrames
旨在与 JDesktopPanes
一起使用并添加到 JDesktopPanes
,而不是 JFrames
。请参阅上面我提供的有关如何使用内部框架的链接
关于java - 未修饰的 JInternalFrame,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23524312/