Search in sources :

Example 1 with WindowsInternalFrameUI

use of com.sun.java.swing.plaf.windows.WindowsInternalFrameUI in project java-swing-tips by aterai.

the class DesktopLayerUI method createFrame2.

private static JInternalFrame createFrame2() {
    JInternalFrame f = new JInternalFrame("WindowsInternalFrameUI", true, true, true, true) {

        @Override
        public void updateUI() {
            super.updateUI();
            setUI(new WindowsInternalFrameUI(this) {

                @Override
                protected MouseInputAdapter createBorderListener(JInternalFrame w) {
                    return new BorderListener() {

                        @Override
                        public void mouseClicked(MouseEvent e) {
                            if (SwingUtilities.isLeftMouseButton(e)) {
                                super.mouseClicked(e);
                            }
                        }

                        @Override
                        public void mousePressed(MouseEvent e) {
                            if (SwingUtilities.isLeftMouseButton(e)) {
                                super.mousePressed(e);
                            }
                        }
                    };
                }
            });
        }
    };
    f.setSize(200, 100);
    f.setLocation(5 + 40, 5 + 50);
    EventQueue.invokeLater(() -> f.setVisible(true));
    return f;
}
Also used : WindowsInternalFrameUI(com.sun.java.swing.plaf.windows.WindowsInternalFrameUI) MouseEvent(java.awt.event.MouseEvent) MouseInputAdapter(javax.swing.event.MouseInputAdapter)

Aggregations

WindowsInternalFrameUI (com.sun.java.swing.plaf.windows.WindowsInternalFrameUI)1 MouseEvent (java.awt.event.MouseEvent)1 MouseInputAdapter (javax.swing.event.MouseInputAdapter)1