Example usage for javax.swing.event InternalFrameListener InternalFrameListener

List of usage examples for javax.swing.event InternalFrameListener InternalFrameListener

Introduction

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

Prototype

InternalFrameListener

Source Link

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);/*from   w w  w. ja v a2 s  .co 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: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());
        }/*w w w  . ja  v  a 2 s.co 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:grafix.telas.JanelaGraficos.java

private void configurarJanela() {
    this.setBorder(BorderFactory.createEtchedBorder());
    this.setClosable(true);
    this.setIconifiable(false);
    this.setMaximizable(true);
    this.setResizable(true);
    this.setBounds(0, 0, 500, 500);
    this.setVisible(true);
    this.setTitle(getAcao().getCodAcao() + " - " + getAcao().getNomeAcao());
    this.setFrameIcon(new ImageIcon("resource/icones/grafix4.gif"));
    layersPane = new JLayeredPane();
    layersPane.setLayout(new OverlayLayout(layersPane));
    layersPane.add(getPanelGraficos(), JLayeredPane.FRAME_CONTENT_LAYER);
    layersPane.add(getPanelMolduras(), JLayeredPane.DRAG_LAYER);
    this.add(layersPane);
    this.addInternalFrameListener(new InternalFrameListener() {
        public void internalFrameActivated(InternalFrameEvent evt) {
            janelaAtivada();//from   w w w  . ja  v a 2  s . com
        }

        public void internalFrameClosed(InternalFrameEvent evt) {
            janelaFechada();
        }

        public void internalFrameClosing(InternalFrameEvent evt) {
        }

        public void internalFrameDeactivated(InternalFrameEvent evt) {
        }

        public void internalFrameDeiconified(InternalFrameEvent evt) {
        }

        public void internalFrameIconified(InternalFrameEvent evt) {
        }

        public void internalFrameOpened(InternalFrameEvent evt) {
        }
    });
}

From source file:com.opendoorlogistics.studio.scripts.editor.ScriptEditor.java

/**
 * Create the frame.//from w  w  w  .j ava  2  s . co  m
 */
public ScriptEditor(ODLApi api, Script script, File file, final ScriptUIManager runner) {
    super(file != null ? file.getAbsolutePath() : null);
    this.script = script;
    this.file = file;
    this.runner = runner;
    this.api = api;

    Icon icon = ScriptIcons.getIcon(api, script);
    if (icon != null) {
        setFrameIcon(icon);
    }

    // save the current XML of the script
    lastOutputXML = getXML();

    setSize(DisplayConstants.LEVEL1_SIZE);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new BorderLayout());

    // create toolbar
    reinitialiseToolbar();

    //      JCheckBox syncBox = createSyncCheckbox(script);
    //      bottomToolbarSyncCheckbox = syncBox;
    //      if(bottomToolbarSyncCheckbox!=null){
    //         bottomToolbarSyncCheckbox.addActionListener(new ActionListener() {
    //            
    //            @Override
    //            public void actionPerformed(ActionEvent e) {
    //               syncCheckboxChanged();
    //            }
    //         });
    //         toolBar.add(bottomToolbarSyncCheckbox);         
    //      }
    //      toolBar.addSeparator();
    //      fillToolbar(toolBar, actions);

    // override close operation
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    addInternalFrameListener(new InternalFrameListener() {

        @Override
        public void internalFrameOpened(InternalFrameEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void internalFrameIconified(InternalFrameEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void internalFrameDeiconified(InternalFrameEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void internalFrameDeactivated(InternalFrameEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void internalFrameClosing(InternalFrameEvent e) {
            disposeWithSavePrompt();
        }

        @Override
        public void internalFrameClosed(InternalFrameEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void internalFrameActivated(InternalFrameEvent e) {
            // TODO Auto-generated method stub

        }
    });

    if (runner != null) {
        runner.registerDatastoreStructureChangedListener(dsStructureChangedListener);
    }

    toolBar.updateEnabled();
    updateTitle();
}

From source file:com.emr.schemas.DestinationTables.java

/**
 * Handles click event for the Next button
 * <br />/*from  w  ww . j a v a 2s .  co  m*/
 * Opens the EditMappings form for mapping of source and destination columns.
 * @param evt {@link ActionEvent}
 */
private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextActionPerformed
    //JOptionPane.showMessageDialog(this, "Under Construction", "Under Construction", JOptionPane.INFORMATION_MESSAGE);
    //get selected destination table
    if (destinationTablesList.getSelectedIndex() < 0) {
        JOptionPane.showMessageDialog(this, "Please select a destination table from the list.",
                "Destination table not selected", JOptionPane.ERROR_MESSAGE);

    } else {
        btnNext.setEnabled(false);
        btnClearSelection.setEnabled(false);
        String destinationTable = (String) destinationTablesList.getSelectedValue();
        JDesktopPane desktopPane = getDesktopPane();
        EditMappingsForm frm = new EditMappingsForm(mpiConn, emrConn, selected_columns, destinationTable,
                sourceQuery, sourceTables, relations, this);
        desktopPane.add(frm);
        frm.setVisible(true);
        frm.setSize(600, 480);
        frm.setLocation(300, 140);
        frm.moveToFront();
        final DestinationTables currentForm = this;
        frm.addInternalFrameListener(new InternalFrameListener() {

            @Override
            public void internalFrameOpened(InternalFrameEvent e) {
                //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

            @Override
            public void internalFrameClosing(InternalFrameEvent e) {
                //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

            @Override
            public void internalFrameClosed(InternalFrameEvent e) {
                btnNext.setEnabled(true);
                btnClearSelection.setEnabled(true);
                currentForm.closeForm();
            }

            @Override
            public void internalFrameIconified(InternalFrameEvent e) {
                //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

            @Override
            public void internalFrameDeiconified(InternalFrameEvent e) {
                //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

            @Override
            public void internalFrameActivated(InternalFrameEvent e) {
                //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }

            @Override
            public void internalFrameDeactivated(InternalFrameEvent e) {
                //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            }
        });
    }

}

From source file:com.emr.schemas.SchemerMapper.java

/**
 * Handles click event for the Next button
 * Opens {@link TableRelationsForm} for the user to define the relationships between the selected tables.
 * @param evt {@link ActionEvent}/*from  w  w w .  ja  v  a 2 s  .  c o m*/
 */
private void btnNextScreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextScreenActionPerformed
    if (listOfTables.isEmpty()) {
        JOptionPane.showMessageDialog(this, "Please select source tables from thee list",
                "No selection was made", JOptionPane.ERROR_MESSAGE);
    } else {
        Container container = SwingUtilities.getAncestorOfClass(JDesktopPane.class,
                (Component) evt.getSource());

        if (container != null) {
            btnClearSel.setEnabled(false);
            btnNextScreen.setEnabled(false);
            JDesktopPane desktopPane = getDesktopPane();
            TableRelationsForm frm = new TableRelationsForm(listOfTables, this);
            desktopPane.add(frm);
            frm.setVisible(true);
            frm.setSize(800, 500);
            frm.setLocation(120, 60);
            frm.moveToFront();
            frm.addInternalFrameListener(new InternalFrameListener() {

                @Override
                public void internalFrameOpened(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameClosing(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameClosed(InternalFrameEvent e) {
                    btnClearSel.setEnabled(true);
                    btnNextScreen.setEnabled(true);
                }

                @Override
                public void internalFrameIconified(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameDeiconified(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameActivated(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameDeactivated(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
            });
        }
    }

}

From source file:com.emr.schemas.TableRelationsForm.java

/**
 * Handles click event for the next button
 * Opens {@link DestinationTables} form for the user to select the destination table
 * @param evt {@link ActionEvent}//from w w  w.j  a  v  a  2 s  .com
 */
private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextActionPerformed
    int length = selected_columns.size();
    if (length < 1) {
        JOptionPane.showMessageDialog(this, "Please select at least one column from the source columns list.",
                "No column(s) selected.", JOptionPane.ERROR_MESSAGE);

    } else {

        sql = getSourceQueryString();
        if ("".equals(sql)) {
            JOptionPane.showMessageDialog(this, "You selected " + tables.size()
                    + " source tables without matching relationships. Please define relations between all the tables, or go back and refine/change your tables selection.",
                    "Table Relations missing", JOptionPane.ERROR_MESSAGE);
        } else {
            btnNext.setEnabled(false);
            btnClearSelection.setEnabled(false);
            //open form for choosing the destination table
            JDesktopPane desktopPane = getDesktopPane();
            DestinationTables frm = new DestinationTables(sql, selected_columns, tables, where_clause, emrConn,
                    this);
            desktopPane.add(frm);
            frm.setVisible(true);

            frm.setSize(900, 500);
            frm.setLocation(120, 60);
            frm.moveToFront();
            frm.addInternalFrameListener(new InternalFrameListener() {

                @Override
                public void internalFrameOpened(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameClosing(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameClosed(InternalFrameEvent e) {
                    btnNext.setEnabled(true);
                    btnClearSelection.setEnabled(true);
                }

                @Override
                public void internalFrameIconified(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameDeiconified(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameActivated(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }

                @Override
                public void internalFrameDeactivated(InternalFrameEvent e) {
                    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
                }
            });
        }

    }
}