Search in sources :

Example 21 with JInternalFrame

use of javax.swing.JInternalFrame in project jdk8u_jdk by JetBrains.

the class MetalworksFrame method openHelpWindow.

public void openHelpWindow() {
    JInternalFrame help = new MetalworksHelp();
    desktop.add(help, HELPLAYER);
    try {
        help.setVisible(true);
        help.setSelected(true);
    } catch (java.beans.PropertyVetoException e2) {
    }
}
Also used : JInternalFrame(javax.swing.JInternalFrame)

Example 22 with JInternalFrame

use of javax.swing.JInternalFrame in project jdk8u_jdk by JetBrains.

the class Test6325652 method create.

private static JInternalFrame create(int index) {
    // NON-NLS: frame identification
    String text = "test" + index;
    index = index * 3 + 1;
    JInternalFrame internal = new JInternalFrame(text, true, true, true, true);
    internal.getContentPane().add(new JTextArea(text));
    internal.setBounds(10 * index, 10 * index, WIDTH, HEIGHT);
    internal.setVisible(true);
    return internal;
}
Also used : JTextArea(javax.swing.JTextArea) JInternalFrame(javax.swing.JInternalFrame)

Example 23 with JInternalFrame

use of javax.swing.JInternalFrame in project JMRI by JMRI.

the class TableFrames method makePathTurnoutFrame.

/*
     * ********************* PathTurnoutFrame *****************************
     */
protected JInternalFrame makePathTurnoutFrame(OBlock block, String pathName) {
    String title = Bundle.getMessage("TitlePathTurnoutTable", block.getDisplayName(), pathName);
    JInternalFrame frame = new JInternalFrame(title, true, true, false, true);
    if (log.isDebugEnabled()) {
        log.debug("makePathTurnoutFrame for Block " + block.getDisplayName() + " and Path " + pathName);
    }
    frame.setName(makePathTurnoutName(block.getSystemName(), pathName));
    OPath path = block.getPathByName(pathName);
    if (path == null) {
        return null;
    }
    PathTurnoutTableModel PathTurnoutModel = new PathTurnoutTableModel(path);
    PathTurnoutModel.init();
    JTable PathTurnoutTable = new JTable(PathTurnoutModel);
    PathTurnoutTable.setTransferHandler(new jmri.util.DnDTableImportExportHandler(new int[] { PathTurnoutTableModel.SETTINGCOLUMN, PathTurnoutTableModel.DELETE_COL }));
    PathTurnoutTable.setDragEnabled(true);
    JComboBox<String> box = new JComboBox<String>(PathTurnoutTableModel.turnoutStates);
    PathTurnoutTable.getColumnModel().getColumn(PathTurnoutTableModel.SETTINGCOLUMN).setCellEditor(new DefaultCellEditor(box));
    PathTurnoutTable.getColumnModel().getColumn(PathTurnoutTableModel.DELETE_COL).setCellEditor(new ButtonEditor(new JButton()));
    PathTurnoutTable.getColumnModel().getColumn(PathTurnoutTableModel.DELETE_COL).setCellRenderer(new ButtonRenderer());
    //PathTurnoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    for (int i = 0; i < PathTurnoutModel.getColumnCount(); i++) {
        int width = PathTurnoutModel.getPreferredWidth(i);
        PathTurnoutTable.getColumnModel().getColumn(i).setPreferredWidth(width);
    }
    PathTurnoutTable.sizeColumnsToFit(-1);
    int tableWidth = PathTurnoutTable.getPreferredSize().width;
    PathTurnoutTable.setPreferredScrollableViewportSize(new java.awt.Dimension(tableWidth, ROW_HEIGHT * 5));
    JScrollPane tablePane = new JScrollPane(PathTurnoutTable);
    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BorderLayout(5, 5));
    JLabel prompt = new JLabel(Bundle.getMessage("AddTurnoutPrompt"));
    contentPane.add(prompt, BorderLayout.NORTH);
    contentPane.add(tablePane, BorderLayout.CENTER);
    frame.addInternalFrameListener(this);
    frame.setContentPane(contentPane);
    frame.setLocation(10, 270);
    frame.pack();
    return frame;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) ButtonEditor(jmri.util.table.ButtonEditor) JComboBox(javax.swing.JComboBox) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) OPath(jmri.jmrit.logix.OPath) Point(java.awt.Point) DefaultCellEditor(javax.swing.DefaultCellEditor) Dimension(java.awt.Dimension) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) JInternalFrame(javax.swing.JInternalFrame) ButtonRenderer(jmri.util.table.ButtonRenderer)

Example 24 with JInternalFrame

use of javax.swing.JInternalFrame in project JMRI by JMRI.

the class TableFrames method openPathTurnoutFrame.

protected void openPathTurnoutFrame(String pathTurnoutName) {
    JInternalFrame frame = _PathTurnoutMap.get(pathTurnoutName);
    log.debug("openPathTurnoutFrame for " + pathTurnoutName);
    if (frame == null) {
        int index = pathTurnoutName.indexOf('&');
        String pathName = pathTurnoutName.substring(1, index);
        String sysName = pathTurnoutName.substring(index + 1);
        OBlock block = InstanceManager.getDefault(jmri.jmrit.logix.OBlockManager.class).getBySystemName(sysName);
        if (block == null) {
            return;
        }
        frame = makePathTurnoutFrame(block, pathName);
        if (frame == null) {
            return;
        }
        _PathTurnoutMap.put(pathTurnoutName, frame);
        frame.setVisible(true);
        _desktop.add(frame);
        frame.moveToFront();
    } else {
        frame.setVisible(true);
        try {
            frame.setIcon(false);
        } catch (PropertyVetoException pve) {
            log.warn("PathTurnout Table Frame for \"" + pathTurnoutName + "\" vetoed setIcon " + pve.toString());
        }
        frame.moveToFront();
    }
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) OBlockManager(jmri.jmrit.logix.OBlockManager) JInternalFrame(javax.swing.JInternalFrame) OBlock(jmri.jmrit.logix.OBlock) Point(java.awt.Point)

Example 25 with JInternalFrame

use of javax.swing.JInternalFrame in project JMRI by JMRI.

the class TableFrames method internalFrameClosed.

@Override
public void internalFrameClosed(InternalFrameEvent e) {
    JInternalFrame frame = (JInternalFrame) e.getSource();
    String name = frame.getName();
    if (log.isDebugEnabled()) {
        log.debug("Internal frame closed: " + frame.getTitle() + ", name= " + name + " size (" + frame.getSize().getWidth() + ", " + frame.getSize().getHeight() + ")");
    }
    if (name != null && name.startsWith("OB")) {
        _blockPathMap.remove(name);
        WarrantTableAction.initPathPortalCheck();
        WarrantTableAction.checkPathPortals(((BlockPathFrame) frame).getModel().getBlock());
        ((BlockPathFrame) frame).getModel().removeListener();
        if (_showWarnings) {
            WarrantTableAction.showPathPortalErrors();
        }
    } else {
        _PathTurnoutMap.remove(name);
    }
}
Also used : JInternalFrame(javax.swing.JInternalFrame)

Aggregations

JInternalFrame (javax.swing.JInternalFrame)36 Point (java.awt.Point)12 PropertyVetoException (java.beans.PropertyVetoException)12 Dimension (java.awt.Dimension)9 Component (java.awt.Component)7 JPanel (javax.swing.JPanel)7 JScrollPane (javax.swing.JScrollPane)7 JTable (javax.swing.JTable)7 BorderLayout (java.awt.BorderLayout)6 JButton (javax.swing.JButton)6 JLabel (javax.swing.JLabel)6 JComponent (javax.swing.JComponent)5 JMenu (javax.swing.JMenu)4 Jynstrument (jmri.jmrit.jython.Jynstrument)4 Container (java.awt.Container)3 JDesktopPane (javax.swing.JDesktopPane)3 JMenuBar (javax.swing.JMenuBar)3 JMenuItem (javax.swing.JMenuItem)3 TableRowSorter (javax.swing.table.TableRowSorter)3 ButtonEditor (jmri.util.table.ButtonEditor)3