创建JInternalFrames并保存所选的一个 [英] Create JInternalFrames and save the one which is selected

查看:126
本文介绍了创建JInternalFrames并保存所选的一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在学习Java,我想知道如何在JFrame中创建JInternalFrame并将它们保存为文件。我在内部框架上绘制了一些对象,我有一个保存按钮。例如,有几个内部框架,我想保存所选的一个。有人可以为我提供有关如何执行此操作的简单代码吗?只有框架以及如何保存它们。

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.

推荐答案


  1. 阅读 JDesktopPane API。您将找到一种方法,可以获得当前选择的内部框架。

  1. 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.

这篇关于创建JInternalFrames并保存所选的一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆