0

子フレームが親フレームのタイトルバーを覆い隠さないように、子JInternalFramesを作成しようとしています。これが可能かどうかさえわかりません。不可能かどうか教えてください。創造的なアイデアがあれば、ぜひ聞いていただければ幸いです。TYIA-Roland

    **
     * @(#)rebuiltgui.java
     *
     * rebuiltgui Applet application
     *
     * @author 
     * @version 1.00 2013/1/21
     */

    //package components;
    import javax.swing.JInternalFrame;
    import javax.swing.JDesktopPane;
    //import javax.swing.JMenu;
    //import javax.swing.JMenuItem;
    //import javax.swing.JMenuBar;
    //import javax.swing.JFrame;
    //import javax.swing.KeyStroke;
    //import java.awt.event.*;

    import javax.swing.plaf.basic.BasicInternalFrameUI;

    import java.awt.event.*;

    import java.awt.Desktop;
    import javax.swing.*;

    import javax.swing.BoxLayout;

    import java.awt.*;
    import java.applet.*;

    public class rebuiltgui extends JApplet {

        public void init() {

            javax.swing.SwingUtilities.invokeLater(new Runnable() {

                public void run() {

                    createAndShowGUI();
                }
            });
        }

        private void createAndShowGUI() {

            JLayeredPane layerz = new JLayeredPane();
            JPanel loginpane = new JPanel();

    //      Dimension appletdim = Toolkit.getDefaultToolkit().getScreenSize();
            Dimension appletdim = this.getSize();


    //      this.setLayout( new BoxLayout( this, BoxLayout.X_AXIS ));

    //      content.add(desktop, BorderLayout.CENTER);

            appletdim.height += 15;

            JDesktopPane desktop = new JDesktopPane();
            desktop.setPreferredSize(new Dimension( appletdim.width, appletdim.height ));
            this.add( desktop );

            JInternalFrame mainframe = new JInternalFrame(("Mainframe"), false, false, false, false);

            mainframe.setBounds( 0, 0, appletdim.width, appletdim.height );

            BasicInternalFrameUI ui = (BasicInternalFrameUI) mainframe.getUI();
            Component north = ui.getNorthPane();
            MouseMotionListener[] actions = (MouseMotionListener[]) north.getListeners(MouseMotionListener.class);

            for (int i = 0; i < actions.length; i++) {

                north.removeMouseMotionListener(actions[i]);
            }


    //      loginframe.setSize(200, 150);
            mainframe.setBackground(Color.lightGray);
            desktop.add(mainframe);
    //      loginframe.moveToFront();


    //      desktop.add( loginframe );

            mainframe.setVisible(true);

            JInternalFrame loginframe;

            loginframe = new JInternalFrame( "Login Screen.", false, false, false, false );
            loginframe.setBounds( 0, 0, appletdim.width, appletdim.height );

            BasicInternalFrameUI uilogin = (BasicInternalFrameUI) loginframe.getUI();
            Component northli = uilogin.getNorthPane();
            MouseMotionListener[] actionsli = (MouseMotionListener[]) northli.getListeners(MouseMotionListener.class);

            for (int i = 0; i < actionsli.length; i++) {

                northli.removeMouseMotionListener(actions[i]);
            }

desktop.add( loginframe );

            loginframe.setVisible(true);
        }
    }
4

0 に答える 0