Example usage for javax.swing JComponent addMouseMotionListener

List of usage examples for javax.swing JComponent addMouseMotionListener

Introduction

In this page you can find the example usage for javax.swing JComponent addMouseMotionListener.

Prototype

public synchronized void addMouseMotionListener(MouseMotionListener l) 

Source Link

Document

Adds the specified mouse motion listener to receive mouse motion events from this component.

Usage

From source file:org.docx4all.ui.main.WordMLEditor.java

public void createInternalFrame(FileObject f) {
    if (f == null) {
        return;/*from w  w w.j  a  v  a2 s.c om*/
    }

    log.info(VFSUtils.getFriendlyName(f.getName().getURI()));

    JInternalFrame iframe = _iframeMap.get(f.getName().getURI());
    if (iframe != null) {
        iframe.setVisible(true);

    } else {
        iframe = new JInternalFrame(f.getName().getBaseName(), true, true, true, true);
        iframe.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        iframe.addInternalFrameListener(_internalFrameListener);
        iframe.addInternalFrameListener(_toolbarStates);
        iframe.addPropertyChangeListener(WindowMenu.getInstance());

        if (iframe.getUI() instanceof BasicInternalFrameUI) {
            BasicInternalFrameUI ui = (BasicInternalFrameUI) iframe.getUI();
            javax.swing.JComponent northPane = ui.getNorthPane();
            if (northPane == null) {
                // Happens on Mac OSX: Google for "osx java getNorthPane"
                // Fix is from it.businesslogic.ireport.gui.JMDIFrame
                javax.swing.plaf.basic.BasicInternalFrameUI aUI = new javax.swing.plaf.basic.BasicInternalFrameUI(
                        iframe);
                iframe.setUI(aUI);

                // Try again
                ui = (BasicInternalFrameUI) iframe.getUI();
                northPane = ((javax.swing.plaf.basic.BasicInternalFrameUI) ui).getNorthPane();
            }
            northPane.addMouseMotionListener(_titleBarMouseListener);
        }

        JEditorPane editorView = createEditorView(f);
        JPanel panel = FxScriptUIHelper.getInstance().createEditorPanel(editorView);

        iframe.getContentPane().add(panel);
        iframe.pack();
        _desktop.add(iframe);

        editorView.requestFocusInWindow();
        editorView.select(0, 0);

        String filePath = f.getName().getURI();
        iframe.putClientProperty(WordMLDocument.FILE_PATH_PROPERTY, filePath);
        _iframeMap.put(filePath, iframe);

        iframe.show();
    }

    try {
        iframe.setSelected(true);
        iframe.setIcon(false);
        iframe.setMaximum(true);
    } catch (PropertyVetoException exc) {
        // do nothing
    }
}