创建 JInternalFrames 并保存选中的那个
我现在正在学习 Java,我想知道如何在 JFrame 中创建 JInternalFrames 并将它们保存为文件.我在内部框架上绘制了一些对象,并且有一个保存"按钮.例如,有几个内部框架,我想保存选中的那个.有人可以为我提供有关如何执行此操作的简单代码吗?只有帧以及如何保存它们.
I am learning Java now and I was wondering how to create JInternalFrames in a JFrame and save them as files. I draw some objects on the internal frames and I have a button 'Save'. For example, there are several of the internal frames and I want to save the one which is selected. May someone provide me with simple code on how to do this? Only the frames and how to save them.
推荐答案
阅读
JDesktopPane
API.您会找到一种方法,可以让您获得当前选择的内部框架.
Read the
JDesktopPane
API. You will find a method that will get you the currenctly selected internal frame.
查看 屏幕图像.这将允许您创建任何 Swing 组件的图像.它还允许您将此图像保存到文件中.
Check out Screen Image. This will allow you to create an image of any Swing component. It will also allow you to save this image to a file.
相关文章