62,628
社区成员
发帖
与我相关
我的任务
分享public class IndexJFrame extends JFrame{
public JDesktopPane jDesktopPane;
public IndexJFrame(){
jDesktopPane=new JDesktopPane();
jDesktopPane.setBackground(Color.white);
container.add(jDesktopPane,BorderLayout.CENTER);
}//主界面事件类
public class IndexListener implements ActionListener,WindowListener,TreeSelectionListener{
IndexJFrame indexJFrame;
TreePath path;
@Override
public void actionPerformed(ActionEvent e) {
JButton button=(JButton) e.getSource();
if (button==indexJFrame.jButtonDA) {
indexJFrame.remove(indexJFrame.rightpanel);// 移除内容面板中的所有内容
indexJFrame.jDesktopPane.add(new TestJpanel(),BorderLayout.CENTER);// 将档案管理面版添加到内容面板中
SwingUtilities.updateComponentTreeUI(indexJFrame.rightpanel);// 刷新内容面板中的内容
}
}public class TestJpanel extends JInternalFrame{
public TestJpanel(){
JLabel jLabel=new JLabel("测试测试测试测试测试测试测试测试测试测试");
JInternalFrame jInternalFrame=new JInternalFrame("yoo", true, true, true);
jInternalFrame.setSize(400, 400);
jInternalFrame.setLocation(5, 5);
jInternalFrame.setLayout(null);
jLabel.setBounds(5, 5, 100, 25);
Container container=jInternalFrame.getContentPane();
container.add(jLabel);
jInternalFrame.setVisible(true);
}
}