简体   繁体   English

JInternalFrame和JDesktopPane

[英]JInternalFrame and JDesktopPane

I have master employee form and I want to show em on my main form . 我有master employee表格,我想在main form上显示em。 That main form is MDI container, so I just want to know how to show the master employee form. main form是MDI容器,所以我只想知道如何显示master employee表单。

Here is the JDesktopPane creating object code: 这是JDesktopPane创建目标代码:

public class MainForm extends javax.swing.JFrame {

JDesktopPane desk = new JDesktopPane();
LoginForm login = new LoginForm();
/** Creates new form MainForm */
public MainForm() {
    initComponents();
}

And here is to call masteremployee form though it's not working. 尽管无法正常工作,但这里要打电话给masteremployee form

  MasterEmployee me = new MasterEmployee();       
    desk.add(me);
    me.setVisible(true);

How do I resolve this ? 我该如何解决? I want to make the master employee form shows on Jdesktoppane 我想在Jdesktoppane上显示master employee表格

Update: 更新:

It is working now. 现在正在工作。 I used the following reference. 我使用了以下参考。

Read the section from the Swing tutorial on How to Use Internal Frames for a working example that shows you how to create and select an internal frame. 阅读Swing教程中有关如何使用内部框架的部分,获取一个工作示例,该示例向您展示如何创建和选择内部框架。

You need to do more than just invoke setVisible() on the internal frame and I have no idea what the code in your MasterEmployess class does. 您需要做的不仅仅是在内部框架上调用setVisible(),而且我不知道您的MasterEmployess类中的代码做什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM