Example usage for javax.swing JInternalFrame setIcon

List of usage examples for javax.swing JInternalFrame setIcon

Introduction

In this page you can find the example usage for javax.swing JInternalFrame setIcon.

Prototype

@BeanProperty(description = "The image displayed when this internal frame is minimized.")
public void setIcon(boolean b) throws PropertyVetoException 

Source Link

Document

Iconifies or de-iconifies this internal frame, if the look and feel supports iconification.

Usage

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

public void closeInternalFrame(JInternalFrame iframe) {
    boolean canClose = true;

    if (getToolbarStates().isDocumentDirty(iframe)) {
        try {/*from www  .j a  v a 2  s.  com*/
            iframe.setSelected(true);
            iframe.setIcon(false);
        } catch (PropertyVetoException exc) {
            ;//ignore
        }

        int answer = showConfirmClosingInternalFrame(iframe, "internalframe.close");
        canClose = (answer != JOptionPane.CANCEL_OPTION);
    }

    if (canClose) {
        WordMLTextPane editor = SwingUtil.getWordMLTextPane(iframe);
        if (editor != null) {
            editor.removeCaretListener(getToolbarStates());
            editor.removeFocusListener(getToolbarStates());
            editor.setTransferHandler(null);

            editor.getDocument().removeDocumentListener(getToolbarStates());

            WordMLEditorKit editorKit = (WordMLEditorKit) editor.getEditorKit();
            editorKit.removeInputAttributeListener(getToolbarStates());
            editor.getWordMLEditorKit().deinstall(editor);
        }
        iframe.dispose();
    }
}

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

public void createInternalFrame(FileObject f) {
    if (f == null) {
        return;/*  ww  w  .  ja va  2s. co m*/
    }

    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
    }
}

From source file:org.en.tealEye.guiMain.MainAppFrame.java

public void minimizeAllFrames() {
    Object[] obj = frameMap.values().toArray();
    for (Object oframe : obj) {
        JInternalFrame frame = (JInternalFrame) oframe;
        desktop.getDesktopManager().iconifyFrame(frame);
        frame.setResizable(true);//ww w.  j  av a2s.c  o m
        frame.setMaximizable(true);
        try {
            frame.setIcon(true);
        } catch (PropertyVetoException e) {
            log.error(e.getMessage(), e);
        }
    }
}

From source file:org.en.tealEye.guiMain.MainAppFrame.java

public void normalizeAllFrames() {
    Collection<JInternalFrame> obj = frameMap.values();
    int i = 0;//from   w w  w.  j ava2 s  .  co  m
    for (JInternalFrame oframe : obj) {
        if (oframe.isIcon())
            try {
                desktop.getDesktopManager().deiconifyFrame(oframe);
                oframe.setIcon(false);

            } catch (PropertyVetoException e) {
                log.error(e.getMessage(), e);
            }
        desktop.getDesktopManager().resizeFrame(oframe, i, i, 450, 450);
        desktop.getDesktopManager().activateFrame(oframe);
        try {
            oframe.setSelected(false);
        } catch (PropertyVetoException e) {
            log.error(e.getMessage(), e);
        }
        oframe.moveToFront();
        i = i + 10;
    }
}