Example usage for javax.swing JInternalFrame getTitle

List of usage examples for javax.swing JInternalFrame getTitle

Introduction

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

Prototype

public String getTitle() 

Source Link

Document

Returns the title of the JInternalFrame.

Usage

From source file:InternalFrameIconifyListener.java

public static void main(final String[] args) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JDesktopPane desktop = new JDesktopPane();
    JInternalFrame internalFrame = new JInternalFrame("Can Do All", true, true, true, true);

    InternalFrameListener internalFrameListener = new InternalFrameIconifyListener();

    //     Add listener for iconification events
    internalFrame.addInternalFrameListener(internalFrameListener);

    desktop.add(internalFrame);//from   w w w  . j av  a2  s  .c  o m

    internalFrame.setBounds(25, 25, 200, 100);

    JLabel label = new JLabel(internalFrame.getTitle(), JLabel.CENTER);
    internalFrame.add(label, BorderLayout.CENTER);

    internalFrame.setVisible(true);

    frame.add(desktop, BorderLayout.CENTER);
    frame.setSize(500, 300);
    frame.setVisible(true);
}

From source file:MainClass.java

public void internalFrameIconified(InternalFrameEvent internalFrameEvent) {
    JInternalFrame source = (JInternalFrame) internalFrameEvent.getSource();
    System.out.println("Iconified: " + source.getTitle());
}

From source file:MainClass.java

public void internalFrameDeiconified(InternalFrameEvent internalFrameEvent) {
    JInternalFrame source = (JInternalFrame) internalFrameEvent.getSource();
    System.out.println("Deiconified: " + source.getTitle());
}

From source file:CascadeDemo.java

public void newFrame() {
    JInternalFrame jif = new JInternalFrame("Frame " + m_count, true, true, true, true);
    jif.setBounds(20 * (m_count % 10) + m_tencount * 80, 20 * (m_count % 10), 200, 200);

    JLabel label = new JLabel(EARTH);
    jif.getContentPane().add(new JScrollPane(label));

    m_desktop.add(jif);/* www  .ja va  2 s.  co  m*/
    try {
        jif.setSelected(true);
    } catch (PropertyVetoException pve) {
        System.out.println("Could not select " + jif.getTitle());
    }

    m_count++;
    if (m_count % 10 == 0) {
        if (m_tencount < 3)
            m_tencount++;
        else
            m_tencount = 0;
    }
}

From source file:InternalFrameListenerDemo.java

public void newFrame() {
    JInternalFrame jif = new JInternalFrame("Frame " + m_count, true, true, true, true);
    jif.addInternalFrameListener(this);
    jif.setBounds(20 * (m_count % 10) + m_tencount * 80, 20 * (m_count % 10), 200, 200);
    JLabel label = new JLabel();
    label.setBackground(Color.white);
    label.setOpaque(true);/*from   w w  w.ja  v a 2  s.c  o m*/
    jif.getContentPane().add(label);
    m_desktop.add(jif);
    try {
        jif.setSelected(true);
    } catch (PropertyVetoException pve) {
        System.out.println("Could not select " + jif.getTitle());
    }
    m_count++;
    if (m_count % 10 == 0) {
        if (m_tencount < 3)
            m_tencount++;
        else
            m_tencount = 0;
    }
}

From source file:DesktopManagerDemo.java

public void newFrame() {
    JInternalFrame jif = new JInternalFrame("Frame " + m_count, true, true, true, true);
    jif.setBounds(20 * (m_count % 10) + m_tencount * 80, 20 * (m_count % 10), 200, 200);
    JLabel label = new JLabel();
    label.setBackground(Color.white);
    label.setOpaque(true);//from   w  ww  . j  av  a 2 s  . co m
    jif.getContentPane().add(label);
    m_desktop.add(jif);
    try {
        jif.setSelected(true);
    } catch (PropertyVetoException pve) {
        System.out.println("Could not select " + jif.getTitle());
    }
    m_count++;
    if (m_count % 10 == 0) {
        if (m_tencount < 3)
            m_tencount++;
        else
            m_tencount = 0;
    }
}

From source file:au.org.ala.delta.editor.DeltaEditor.java

private void buildWindowMenu(JMenu mnuWindow) {
    mnuWindow.removeAll();/*from   ww  w  .j  a v  a 2 s .c  o  m*/

    JMenuItem mnuItCascade = new JMenuItem();
    mnuItCascade.setAction(_actionMap.get("cascadeFrames"));
    mnuWindow.add(mnuItCascade);

    JMenuItem mnuItTile = new JMenuItem();
    mnuItTile.setAction(_actionMap.get("tileFrames"));
    mnuWindow.add(mnuItTile);

    JMenuItem mnuItTileHorz = new JMenuItem();
    mnuItTileHorz.setAction(_actionMap.get("tileFramesHorizontally"));
    mnuWindow.add(mnuItTileHorz);

    JMenuItem mnuItArrangeIcons = new JMenuItem();
    mnuItArrangeIcons.setAction(_actionMap.get("arrangeIcons"));
    mnuWindow.add(mnuItArrangeIcons);

    JMenuItem mnuItCloseAll = new JMenuItem();
    mnuItCloseAll.setAction(_actionMap.get("closeAllFrames"));
    mnuWindow.add(mnuItCloseAll);

    mnuWindow.addSeparator();

    JMenuItem mnuItChooseFont = new JMenuItem();
    mnuItChooseFont.setAction(_actionMap.get("chooseFont"));
    mnuWindow.add(mnuItChooseFont);

    mnuWindow.addSeparator();

    JMenu mnuLF = new JMenu();
    mnuLF.setName("mnuLF");
    mnuLF.setText(_resourceMap.getString("mnuLF.text"));
    mnuWindow.add(mnuLF);

    JMenuItem mnuItMetalLF = new JMenuItem();
    mnuItMetalLF.setAction(_actionMap.get("metalLookAndFeel"));
    mnuLF.add(mnuItMetalLF);

    JMenuItem mnuItWindowsLF = new JMenuItem();
    mnuItWindowsLF.setAction(_actionMap.get("systemLookAndFeel"));
    mnuLF.add(mnuItWindowsLF);

    try {
        // Nimbus L&F was added in update java 6 update 10.
        Class.forName("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel").newInstance();
        JMenuItem mnuItNimbusLF = new JMenuItem();
        mnuItNimbusLF.setAction(_actionMap.get("nimbusLookAndFeel"));
        mnuLF.add(mnuItNimbusLF);
    } catch (Exception e) {
        // The Nimbus L&F is not available, no matter.
    }
    mnuWindow.addSeparator();

    int i = 1;
    for (final JInternalFrame frame : _frames) {
        JMenuItem windowItem = new JCheckBoxMenuItem();
        if (i < 10) {
            windowItem.setText(String.format("%d %s", i, frame.getTitle()));
            windowItem.setMnemonic(KeyEvent.VK_1 + (i - 1));
        } else {
            windowItem.setText(frame.getTitle());
        }
        windowItem.setSelected(frame.isSelected());
        windowItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    frame.setSelected(true);
                } catch (PropertyVetoException e1) {
                }
            }
        });
        mnuWindow.add(windowItem);
        ++i;
    }

}

From source file:JavaXWin.java

public void newFrame() {
    JInternalFrame jif = new JInternalFrame("Frame " + m_count, true, true, true, true);
    jif.setBounds(20 * (m_count % 10) + m_tencount * 80, 20 * (m_count % 10), 200, 200);

    JTextArea text = new JTextArea();
    JScrollPane scroller = new JScrollPane();
    scroller.getViewport().add(text);/*from  w ww  .  j  a v  a  2  s.c om*/
    try {
        FileReader fileStream = new FileReader("");
        text.read(fileStream, "JavaLinux.txt");
    } catch (Exception e) {
        text.setText("* Could not read JavaLinux.txt *");
    }
    jif.getContentPane().add(scroller);

    m_desktop.add(jif);
    try {
        jif.setSelected(true);
    } catch (PropertyVetoException pve) {
        System.out.println("Could not select " + jif.getTitle());
    }

    m_count++;
    if (m_count % 10 == 0) {
        if (m_tencount < 3)
            m_tencount++;
        else
            m_tencount = 0;
    }
}

From source file:org.docx4all.ui.menu.FileMenu.java

@Action
public void saveFile(ActionEvent actionEvent) {
    WordMLEditor editor = WordMLEditor.getInstance(WordMLEditor.class);
    if (editor.getToolbarStates().isDocumentDirty()) {
        JInternalFrame iframe = editor.getCurrentInternalFrame();
        if (iframe.getTitle().startsWith(editor.getUntitledFileName())) {
            saveAsDocx(actionEvent);/*from w  w w  .  j  a va2 s  . c om*/

        } else {
            WordMLTextPane textPane = SwingUtil.getWordMLTextPane(iframe);
            if (textPane != null && textPane.getWordMLEditorKit().getPlutextClient() != null
                    && editor.getCurrentEditor() != textPane) {

                ResourceMap rm = editor.getContext().getResourceMap(getClass());
                String title = rm.getString("saveFile.Action.text");
                String message = rm.getString("saveFile.Action.goto.editorView.infoMessage");
                editor.showMessageDialog(title, message, JOptionPane.INFORMATION_MESSAGE);

                return;
            }

            boolean success = save(iframe, null, SAVE_FILE_ACTION_NAME);
            if (success) {
                editor.getToolbarStates().setDocumentDirty(iframe, false);
                editor.getToolbarStates().setLocalEditsEnabled(iframe, false);
            }
        }
    }
}

From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationMenuUI.java

public synchronized void updateFrameworkResources() {
    logReaders = new HashMap<String, LogReader>();
    JInternalFrame[] frames = MainUI.getInstance().getDesktop().getAllFrames();
    for (JInternalFrame frame : frames) {
        if (frame instanceof Provider) {
            ProvidedObject[] providedObjects = ((Provider) frame).getProvidedObjects();
            for (ProvidedObject providedObject : providedObjects) {
                for (Object object : providedObject.getObjects()) {
                    if (object instanceof LogReader) {
                        logReaders.put(frame.getTitle() + " - " + providedObject.getName(), (LogReader) object);
                    }//w  w w  .j av a  2s.c  o m
                }
            }
        }
    }
}