java.awt.DefaultFocusTraversalPolicy Java Examples
The following examples show how to use
java.awt.DefaultFocusTraversalPolicy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectionAction.java From netbeans with Apache License 2.0 | 4 votes |
private void initComponents() { setLayout(new BorderLayout(4, 0)); setBorder(new EmptyBorder(0, 2, 0, 8)); setOpaque(false); setFocusTraversalPolicyProvider(true); setFocusTraversalPolicy(new DefaultFocusTraversalPolicy() { @Override public Component getDefaultComponent(Container aContainer) { if (!SwingUtilities.isEventDispatchThread()) { return null; } final EditorCookie ec = actionContext.lookup( EditorCookie.class); if (ec != null) { JEditorPane[] panes = ec.getOpenedPanes(); if (panes != null) { for (JEditorPane pane : panes) { if (pane.isShowing()) { return pane; } } } } return null; } }); combo = new JComboBox(); combo.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { DatabaseConnection dbconn = (DatabaseConnection)combo.getSelectedItem(); combo.setToolTipText(dbconn != null ? dbconn.getDisplayName() : null); } }); combo.setOpaque(false); combo.setModel(new DefaultComboBoxModel( new String[] { NbBundle.getMessage(ToolbarPresenter.class, "ConnectionAction.ToolbarPresenter.LoadingConnections") })); combo.setRenderer(new DatabaseConnectionRenderer()); String accessibleName = NbBundle.getMessage(ConnectionAction.class, "LBL_DatabaseConnection"); combo.getAccessibleContext().setAccessibleName(accessibleName); combo.getAccessibleContext().setAccessibleDescription(accessibleName); combo.setPreferredSize (new Dimension (400, combo.getPreferredSize ().height)); add(combo, BorderLayout.CENTER); comboLabel = new JLabel(); Mnemonics.setLocalizedText(comboLabel, NbBundle.getMessage(ConnectionAction.class, "LBL_ConnectionAction")); comboLabel.setOpaque(false); comboLabel.setLabelFor(combo); add(comboLabel, BorderLayout.WEST); }
Example #2
Source File: PdfDockable.java From gcs with Mozilla Public License 2.0 | 4 votes |
public PdfDockable(PdfRef pdfRef, int page, String highlight) { super(new BorderLayout()); mPath = pdfRef.getPath(); int pageCount = 9999; try { mPdf = PDDocument.load(pdfRef.getPath().toFile(), MemoryUsageSetting.setupMixed(50 * 1024 * 1024)); pageCount = mPdf.getNumberOfPages(); } catch (Exception exception) { Log.error(exception); } mToolbar = new Toolbar(); mZoomInButton = new IconButton(Images.ZOOM_IN, formatWithKey(I18n.Text("Scale Document Up"), KeyStroke.getKeyStroke('=')), () -> mPanel.zoomIn()); mToolbar.add(mZoomInButton); mZoomOutButton = new IconButton(Images.ZOOM_OUT, formatWithKey(I18n.Text("Scale Document Down"), KeyStroke.getKeyStroke('-')), () -> mPanel.zoomOut()); mToolbar.add(mZoomOutButton); mActualSizeButton = new IconButton(Images.ACTUAL_SIZE, formatWithKey(I18n.Text("Actual Size"), KeyStroke.getKeyStroke('1')), () -> mPanel.actualSize()); mToolbar.add(mActualSizeButton); mZoomStatus = new JLabel("100%"); mToolbar.add(mZoomStatus); mPageField = new EditorField(new DefaultFormatterFactory(new IntegerFormatter(1, pageCount, false)), event -> { if (mPanel != null) { int pageIndex = ((Integer) mPageField.getValue()).intValue() - 1; int newPageIndex = mPanel.goToPageIndex(pageIndex, null); if (pageIndex == newPageIndex) { mPanel.requestFocusInWindow(); } else { mPageField.setValue(Integer.valueOf(newPageIndex + 1)); } } }, SwingConstants.RIGHT, Integer.valueOf(Math.max(page, 1)), Integer.valueOf(9999), null); mToolbar.add(mPageField, Toolbar.LAYOUT_EXTRA_BEFORE); mPageStatus = new JLabel("/ -"); mToolbar.add(mPageStatus); mPreviousPageButton = new IconButton(Images.PAGE_UP, formatWithKey(I18n.Text("Previous Page"), KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0)), () -> mPanel.previousPage()); mToolbar.add(mPreviousPageButton); mNextPageButton = new IconButton(Images.PAGE_DOWN, formatWithKey(I18n.Text("Next Page"), KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0)), () -> mPanel.nextPage()); mToolbar.add(mNextPageButton); add(mToolbar, BorderLayout.NORTH); mPanel = new PdfPanel(this, mPdf, pdfRef, page, highlight); add(new JScrollPane(mPanel), BorderLayout.CENTER); setFocusCycleRoot(true); setFocusTraversalPolicy(new DefaultFocusTraversalPolicy()); }
Example #3
Source File: InitialFTP_AWT.java From dragonwell8_jdk with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #4
Source File: InitialFTP_AWT.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #5
Source File: InitialFTP_AWT.java From jdk8u60 with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #6
Source File: InitialFTP_AWT.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #7
Source File: InitialFTP_AWT.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #8
Source File: InitialFTP_AWT.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #9
Source File: InitialFTP_AWT.java From jdk8u-jdk with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #10
Source File: InitialFTP_AWT.java From hottub with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #11
Source File: InitialFTP_AWT.java From openjdk-8-source with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #12
Source File: InitialFTP_AWT.java From openjdk-8 with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #13
Source File: InitialFTP_AWT.java From jdk8u_jdk with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #14
Source File: InitialFTP_AWT.java From jdk8u-jdk with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }
Example #15
Source File: InitialFTP_AWT.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 3 votes |
public static void main(String[] args) { AWTFrame f0 = new AWTFrame("frame0"); f0.setVisible(true); InitialFTP.test(f0, DefaultFocusTraversalPolicy.class); AWTFrame f1 = new AWTFrame("frame1"); f1.setVisible(true); InitialFTP.test(f1, DefaultFocusTraversalPolicy.class); System.out.println("Test passed."); }