Java 类javax.swing.LayoutFocusTraversalPolicy 实例源码

项目:SweetHome3D    文件:HomePane.java   
/**
 * Sets a focus traversal policy that ignores invisible split pane components.
 */
private void updateFocusTraversalPolicy()
{
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy()
    {
        @Override
        protected boolean accept(Component component)
        {
            if (super.accept(component))
            {
                for (JSplitPane splitPane; (splitPane = (JSplitPane) SwingUtilities
                        .getAncestorOfClass(JSplitPane.class, component)) != null; component = splitPane)
                {
                    if (isChildComponentInvisible(splitPane, component))
                    {
                        return false;
                    }
                }
                return true;
            }
            else
            {
                return false;
            }
        }
    });
    setFocusTraversalPolicyProvider(true);
}
项目:swing-jgoodies-forms    文件:InternalFocusSetupUtils.java   
private static FocusTraversalPolicy createLayoutFocusTraversalPolicy(Component initialComponent) {
    if (layoutFTPConstructor != null) {
        try {
            return layoutFTPConstructor.newInstance(initialComponent);
        } catch (IllegalArgumentException
                | InstantiationException
                | IllegalAccessException
                | InvocationTargetException ex) {
            // Ignore
        }
    }
    return new LayoutFocusTraversalPolicy();
}
项目:swing-jgoodies-forms    文件:FormBuilderTest.java   
@Test(expected=IllegalStateException.class)
public void rejectSettingFocusTraversalPolicyTwice() {
    FormBuilder.create()
        .columns("pref")
        .rows("pref")
        .focusTraversalPolicy(new ContainerOrderFocusTraversalPolicy())
        .focusTraversalPolicy(new LayoutFocusTraversalPolicy())
        .build();
}
项目:OLD-OpenJDK8    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };
}
项目:vars    文件:RowEditorPanel.java   
/**
 * <p><!-- Method description --></p>
 *
 */
private void initialize() {
    setLayout(new BorderLayout());
    add(getJPanel(), BorderLayout.NORTH);
    add(getListPanel(), BorderLayout.CENTER);
    setEnabled(false);
    setFocusCycleRoot(true);
    Dimension size = getPreferredSize();
    Dimension preferredSize = new Dimension(size.height, 200);
    setPreferredSize(preferredSize);

    //FocusTraversalPolicy policy = getFocusTraversalPolicy();
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {

        /*
         *  Warning, when a component should not be focused, I
         *  recursively call getComponentAfter, if all components should not be focused,
         * this could lead to an infinite loop.
         */
        @Override
        public Component getComponentAfter(final Container focusCycleRoot, final Component aComponent) {
            Component retval = super.getComponentAfter(focusCycleRoot, aComponent);
            if (retval == notesArea) {
                retval = this.getComponentAfter(focusCycleRoot, retval);
            }

            if (retval instanceof JList) {
                if (listPanel.getObservation().getAssociations().size() == 0) {
                    retval = this.getComponentAfter(focusCycleRoot, retval);
                }
            }

            return retval;
        }
    });
}
项目:monsiaj    文件:TopWindow.java   
/**
 * <p>
 * Constructs a Window instance.</p>
 */
public TopWindow() {
    super();

    URL iconURL = getClass().getResource("/images/orca.png");
    setIconImage(Toolkit.getDefaultToolkit().createImage(iconURL));

    int x, y, width, height;
    x = prefs.getInt(this.getClass().getName() + ".x", 0);
    y = prefs.getInt(this.getClass().getName() + ".y", 0);
    width = prefs.getInt(this.getClass().getName() + ".width", DEFAULT_WIDTH);
    height = prefs.getInt(this.getClass().getName() + ".height", DEFAULT_HEIGHT - FOOTER);

    if (System.getProperty("monsia.topwindow.width") != null) {
        width = Integer.parseInt(System.getProperty("monsia.topwindow.width"));
    }
    if (System.getProperty("monsia.topwindow.height") != null) {
        height = Integer.parseInt(System.getProperty("monsia.topwindow.height"));
    }
    if (System.getProperty("monsia.topwindow.x") != null) {
        x = Integer.parseInt(System.getProperty("monsia.topwindow.x"));
    }
    if (System.getProperty("monsia.topwindow.y") != null) {
        y = Integer.parseInt(System.getProperty("monsia.topwindow.y"));
    }

    this.setLocation(x, y);
    this.setSize(width, height);
    this.addComponentListener(this);
    this.setFocusCycleRoot(true);
    this.setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
}
项目:OpenJSharp    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };

    repaintListener = (JComponent c, int x, int y, int w, int h) -> {
        Window jlf = SwingUtilities.getWindowAncestor(c);
        if (jlf != JLightweightFrame.this) {
            return;
        }
        Point p = SwingUtilities.convertPoint(c, x, y, jlf);
        Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
                new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
                              bbImage.getHeight() / scaleFactor));

        if (!r.isEmpty()) {
            notifyImageUpdated(r.x, r.y, r.width, r.height);
        }
    };

    SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
        RepaintManager.currentManager(this), repaintListener);
}
项目:jdk8u-jdk    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };

    repaintListener = (JComponent c, int x, int y, int w, int h) -> {
        Window jlf = SwingUtilities.getWindowAncestor(c);
        if (jlf != JLightweightFrame.this) {
            return;
        }
        Point p = SwingUtilities.convertPoint(c, x, y, jlf);
        Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
                new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
                              bbImage.getHeight() / scaleFactor));

        if (!r.isEmpty()) {
            notifyImageUpdated(r.x, r.y, r.width, r.height);
        }
    };

    SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
        RepaintManager.currentManager(this), repaintListener);
}
项目:openjdk-jdk10    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    AffineTransform defaultTransform =
                       getGraphicsConfiguration().getDefaultTransform();
    scaleFactorX = defaultTransform.getScaleX();
    scaleFactorY = defaultTransform.getScaleY();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };

    repaintListener = (JComponent c, int x, int y, int w, int h) -> {
        Window jlf = SwingUtilities.getWindowAncestor(c);
        if (jlf != JLightweightFrame.this) {
            return;
        }
        Point p = SwingUtilities.convertPoint(c, x, y, jlf);
        Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
                new Rectangle(0, 0,
                      (int)Math.round(bbImage.getWidth() / scaleFactorX),
                      (int)Math.round(bbImage.getHeight() / scaleFactorY)));

        if (!r.isEmpty()) {
            notifyImageUpdated(r.x, r.y, r.width, r.height);
        }
    };

    SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
        RepaintManager.currentManager(this), repaintListener);
}
项目:openjdk9    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };

    repaintListener = (JComponent c, int x, int y, int w, int h) -> {
        Window jlf = SwingUtilities.getWindowAncestor(c);
        if (jlf != JLightweightFrame.this) {
            return;
        }
        Point p = SwingUtilities.convertPoint(c, x, y, jlf);
        Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
                new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
                              bbImage.getHeight() / scaleFactor));

        if (!r.isEmpty()) {
            notifyImageUpdated(r.x, r.y, r.width, r.height);
        }
    };

    SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
        RepaintManager.currentManager(this), repaintListener);
}
项目:jdk8u_jdk    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };

    repaintListener = (JComponent c, int x, int y, int w, int h) -> {
        Window jlf = SwingUtilities.getWindowAncestor(c);
        if (jlf != JLightweightFrame.this) {
            return;
        }
        Point p = SwingUtilities.convertPoint(c, x, y, jlf);
        Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
                new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
                              bbImage.getHeight() / scaleFactor));

        if (!r.isEmpty()) {
            notifyImageUpdated(r.x, r.y, r.width, r.height);
        }
    };

    SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
        RepaintManager.currentManager(this), repaintListener);
}
项目:lookaside_java-1.8.0-openjdk    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };

    repaintListener = (JComponent c, int x, int y, int w, int h) -> {
        Window jlf = SwingUtilities.getWindowAncestor(c);
        if (jlf != JLightweightFrame.this) {
            return;
        }
        Point p = SwingUtilities.convertPoint(c, x, y, jlf);
        Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
                new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
                              bbImage.getHeight() / scaleFactor));

        if (!r.isEmpty()) {
            notifyImageUpdated(r.x, r.y, r.width, r.height);
        }
    };

    SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
        RepaintManager.currentManager(this), repaintListener);
}
项目:SweetHome3D    文件:FurnitureCatalogListPanel.java   
/**
 * Layouts the components displayed by this panel.
 */
private void layoutComponents()
{
    int labelAlignment = OperatingSystem.isMacOSX() ? GridBagConstraints.LINE_END : GridBagConstraints.LINE_START;
    // First row
    Insets labelInsets = new Insets(0, 2, 5, 3);
    Insets componentInsets = new Insets(0, 2, 3, 0);
    if (!OperatingSystem.isMacOSX())
    {
        labelInsets.top = 2;
        componentInsets.top = 2;
        componentInsets.right = 2;
    }
    add(this.categoryFilterLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL, labelInsets, 0, 0));
    add(this.categoryFilterComboBox, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.LINE_START,
            GridBagConstraints.HORIZONTAL, componentInsets, 0, 0));
    // Second row
    if (OperatingSystem.isMacOSXLeopardOrSuperior())
    {
        add(this.searchTextField, new GridBagConstraints(0, 1, 2, 1, 0, 0, GridBagConstraints.LINE_START,
                GridBagConstraints.HORIZONTAL, new Insets(0, 0, 3, 0), 0, 0));
    }
    else
    {
        add(this.searchLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0, labelAlignment, GridBagConstraints.NONE,
                labelInsets, 0, 0));
        add(this.searchTextField, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.LINE_START,
                GridBagConstraints.HORIZONTAL, componentInsets, 0, 0));
    }
    // Last row
    JScrollPane listScrollPane = new JScrollPane(this.catalogFurnitureList);
    listScrollPane.getVerticalScrollBar().addAdjustmentListener(
            SwingTools.createAdjustmentListenerUpdatingScrollPaneViewToolTip(listScrollPane));
    listScrollPane.setPreferredSize(new Dimension(250, 250));
    listScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    add(listScrollPane, new GridBagConstraints(0, 2, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0), 0, 0));
    SwingTools.installFocusBorder(this.catalogFurnitureList);

    setFocusTraversalPolicyProvider(true);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy()
    {
        @Override
        public Component getDefaultComponent(Container aContainer)
        {
            EventQueue.invokeLater(new Runnable()
            {
                public void run()
                {
                    // Return furniture list only at the first request  
                    setFocusTraversalPolicyProvider(false);
                }
            });
            return catalogFurnitureList;
        }
    });
}
项目:infobip-open-jdk-8    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };

    repaintListener = (JComponent c, int x, int y, int w, int h) -> {
        Window jlf = SwingUtilities.getWindowAncestor(c);
        if (jlf != JLightweightFrame.this) {
            return;
        }
        Point p = SwingUtilities.convertPoint(c, x, y, jlf);
        Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
                new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
                              bbImage.getHeight() / scaleFactor));

        if (!r.isEmpty()) {
            notifyImageUpdated(r.x, r.y, r.width, r.height);
        }
    };

    SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
        RepaintManager.currentManager(this), repaintListener);
}
项目:jdk8u-dev-jdk    文件:JLightweightFrame.java   
/**
 * Constructs a new, initially invisible {@code JLightweightFrame}
 * instance.
 */
public JLightweightFrame() {
    super();
    copyBufferEnabled = "true".equals(AccessController.
        doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));

    add(rootPane, BorderLayout.CENTER);
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
    if (getGraphicsConfiguration().isTranslucencyCapable()) {
        setBackground(new Color(0, 0, 0, 0));
    }

    layoutSizeListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            Dimension d = (Dimension)e.getNewValue();

            if ("preferredSize".equals(e.getPropertyName())) {
                content.preferredSizeChanged(d.width, d.height);

            } else if ("maximumSize".equals(e.getPropertyName())) {
                content.maximumSizeChanged(d.width, d.height);

            } else if ("minimumSize".equals(e.getPropertyName())) {
                content.minimumSizeChanged(d.width, d.height);
            }
        }
    };

    repaintListener = (JComponent c, int x, int y, int w, int h) -> {
        Window jlf = SwingUtilities.getWindowAncestor(c);
        if (jlf != JLightweightFrame.this) {
            return;
        }
        Point p = SwingUtilities.convertPoint(c, x, y, jlf);
        Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
                new Rectangle(0, 0, bbImage.getWidth() / scaleFactor,
                              bbImage.getHeight() / scaleFactor));

        if (!r.isEmpty()) {
            notifyImageUpdated(r.x, r.y, r.width, r.height);
        }
    };

    SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
        RepaintManager.currentManager(this), repaintListener);
}
项目:jabref    文件:StringDialog.java   
public StringDialog(JabRefFrame frame, BasePanel panel, BibDatabase base) {
    super(frame, StringDialog.class);
    this.panel = panel;
    this.base = base;

    sortStrings();

    helpAction = new HelpAction(Localization.lang("Help"), HelpFile.STRING_EDITOR);

    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            closeAction.actionPerformed(null);
        }
    });

    // We replace the default FocusTraversalPolicy with a subclass
    // that only allows the StringTable to gain keyboard focus.
    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {

        @Override
        protected boolean accept(Component c) {
            return super.accept(c) && (c instanceof StringTable);
        }
    });

    JPanel pan = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    pan.setLayout(gbl);
    GridBagConstraints con = new GridBagConstraints();
    con.fill = GridBagConstraints.BOTH;
    con.weighty = 1;
    con.weightx = 1;

    StringTableModel stm = new StringTableModel(this, base);
    table = new StringTable(stm);
    if (!base.hasNoStrings()) {
        table.setRowSelectionInterval(0, 0);
    }

    gbl.setConstraints(table.getPane(), con);
    pan.add(table.getPane());

    JToolBar tlb = new OSXCompatibleToolbar();
    InputMap im = tlb.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap am = tlb.getActionMap();
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.STRING_DIALOG_ADD_STRING), "add");
    NewStringAction newStringAction = new NewStringAction(this);
    am.put("add", newStringAction);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.STRING_DIALOG_REMOVE_STRING), "remove");
    RemoveStringAction removeStringAction = new RemoveStringAction(this);
    am.put("remove", removeStringAction);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.SAVE_DATABASE), "save");
    am.put("save", saveAction);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close");
    am.put("close", closeAction);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.HELP), "help");
    am.put("help", helpAction);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.UNDO), "undo");
    UndoAction undoAction = new UndoAction();
    am.put("undo", undoAction);
    im.put(Globals.getKeyPrefs().getKey(KeyBinding.REDO), "redo");
    RedoAction redoAction = new RedoAction();
    am.put("redo", redoAction);

    tlb.add(newStringAction);
    tlb.add(removeStringAction);
    tlb.addSeparator();
    tlb.add(helpAction);
    Container conPane = getContentPane();
    conPane.add(tlb, BorderLayout.NORTH);
    conPane.add(pan, BorderLayout.CENTER);

    setTitle(STRINGS_TITLE + ": "
            + panel.getBibDatabaseContext().getDatabaseFile().map(File::getName).orElse(GUIGlobals.UNTITLED_TITLE));
    WindowLocation pw = new WindowLocation(this, JabRefPreferences.STRINGS_POS_X, JabRefPreferences.STRINGS_POS_Y,
            JabRefPreferences.STRINGS_SIZE_X, JabRefPreferences.STRINGS_SIZE_Y);
    pw.displayWindowAtStoredLocation();
}
项目:jdk8u-jdk    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:openjdk-jdk10    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:openjdk9    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:jdk8u_jdk    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:lookaside_java-1.8.0-openjdk    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:infobip-open-jdk-8    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:jdk8u-dev-jdk    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:OLD-OpenJDK8    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:openjdk-jdk7u-jdk    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}
项目:openjdk-icedtea7    文件:InitialFTP_Swing.java   
public static void main(String[] args) {
    SwingFrame f0 = new SwingFrame("frame0");
    f0.setVisible(true);

    InitialFTP.test(f0, LayoutFocusTraversalPolicy.class);

    SwingFrame f1 = new SwingFrame("frame1");
    f1.setVisible(true);

    InitialFTP.test(f1, LayoutFocusTraversalPolicy.class);

    System.out.println("Test passed.");
}