Example usage for javax.swing.event InternalFrameEvent getSource

List of usage examples for javax.swing.event InternalFrameEvent getSource

Introduction

In this page you can find the example usage for javax.swing.event InternalFrameEvent getSource.

Prototype

public Object getSource() 

Source Link

Document

The object on which the Event initially occurred.

Usage

From source file:InternalFrameListenerDemo.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);

    desktop.add(internalFrame);/*w  ww  . java  2 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);

    internalFrame.addInternalFrameListener(new InternalFrameListener() {

        public void internalFrameClosing(InternalFrameEvent e) {
            displayMessage("Internal frame closing", e);
        }

        public void internalFrameClosed(InternalFrameEvent e) {
            displayMessage("Internal frame closed", e);
        }

        public void internalFrameOpened(InternalFrameEvent e) {
            displayMessage("Internal frame opened", e);
        }

        public void internalFrameIconified(InternalFrameEvent e) {
            displayMessage("Internal frame iconified", e);
        }

        public void internalFrameDeiconified(InternalFrameEvent e) {
            displayMessage("Internal frame deiconified", e);
        }

        public void internalFrameActivated(InternalFrameEvent e) {
            displayMessage("Internal frame activated", e);
        }

        public void internalFrameDeactivated(InternalFrameEvent e) {
            displayMessage("Internal frame deactivated", e);
        }

        void displayMessage(String prefix, InternalFrameEvent e) {
            System.out.println(prefix + ": " + e.getSource());
        }

    });

    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);

    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:InternalFrameEventTest.java

public SelfInternalFrame(String s) {
    getContentPane().add(new JLabel(s), BorderLayout.CENTER);
    addInternalFrameListener(new InternalFrameListener() {
        public void internalFrameActivated(InternalFrameEvent e) {
            System.out.println("Activated" + e.getSource());
        }/*from ww  w . j a  va  2 s. c  o m*/

        public void internalFrameClosed(InternalFrameEvent e) {
            System.out.println("Closed");
        }

        public void internalFrameClosing(InternalFrameEvent e) {
            System.out.println("Closing");
        }

        public void internalFrameDeactivated(InternalFrameEvent e) {
            System.out.println("Deactivated");
        }

        public void internalFrameDeiconified(InternalFrameEvent e) {
            System.out.println("Deiconified");
        }

        public void internalFrameIconified(InternalFrameEvent e) {
            System.out.println("Iconified");
        }

        public void internalFrameOpened(InternalFrameEvent e) {
            System.out.println("Opened");
        }
    });
    setBounds(50, 50, 100, 100);
    setResizable(true);
    setClosable(true);
    setMaximizable(true);
    setIconifiable(true);
    setTitle(s);
}

From source file:InternalFrameEventDemo.java

void displayMessage(String prefix, InternalFrameEvent e) {
    String s = prefix + ": " + e.getSource();
    display.append(s + newline);/*from   w  w  w. j av a  2s.co m*/
    display.setCaretPosition(display.getDocument().getLength());
}

From source file:edu.ucla.stat.SOCR.analyses.util.moduls.frm.Panels.Jpan_btn.java

@Override
public void internalFrameActivated(InternalFrameEvent e) {
    InternalFrameData ifd;/*from w  w  w.  j  a v  a  2  s. c  om*/

    currentInternalFrame = (FrmInternalFrame) e.getSource();
    btnUpdate.setEnabled(true);
    if (!buttonClicked) {
        fr.setCurrentFrame(currentInternalFrame);
        ifd = currentInternalFrame.getInternalFrameData();
        de = ifd.getDadesExternes();
        fitx = de.getFitxerDades();
        setFileName(fitx.getNom());
        multiDendro = ifd.getMultiDendrogram();
        Jpan_Menu.setConfigPanel(ifd);
    }
}