List of usage examples for javax.swing SwingUtilities getAncestorOfClass
public static Container getAncestorOfClass(Class<?> c, Component comp)
comp
in the component hierarchy and returns the first object of class c
it finds. From source file:org.freeplane.main.application.MapViewDockingWindows.java
static private View getContainingDockedWindow(final Component pNewMap) { return (View) SwingUtilities.getAncestorOfClass(View.class, pNewMap); }
From source file:org.freeplane.main.application.MapViewDockingWindows.java
protected void addDockedView(View dynamicView) { DockingWindow lastFocusedChildWindow = getLastFocusedChildWindow(rootWindow); if (lastFocusedChildWindow == null) { DockingUtil.addWindow(dynamicView, rootWindow); } else {//from ww w . j av a2 s . c o m Container parent = SwingUtilities.getAncestorOfClass(DockingWindow.class, lastFocusedChildWindow); if (parent instanceof TabWindow) ((TabWindow) parent).addTab(dynamicView); else DockingUtil.addWindow(dynamicView, lastFocusedChildWindow.getRootWindow()); } }
From source file:org.intermine.common.swing.WindowUtils.java
/** * Get the internal frame parent of the given component. * // ww w . ja v a2s . com * @param c The child component. * * @return <code>c</code>'s parent JInternalFrame, or <code>null</code> if there * is no such parent. */ public static JInternalFrame getInternalFrameAncestor(Component c) { return (JInternalFrame) SwingUtilities.getAncestorOfClass(JInternalFrame.class, c); }
From source file:org.intermine.common.swing.WindowUtils.java
/** * Get the viewport parent of the given component. * //from ww w . j a v a 2 s .c om * @param c The child component. * * @return <code>c</code>'s parent JViewPort, or <code>null</code> if there * is no such parent. */ public static JViewport getViewportAncestor(Component c) { return (JViewport) SwingUtilities.getAncestorOfClass(JViewport.class, c); }
From source file:org.yccheok.jstock.gui.Utils.java
private static JScrollPane getScrollPane(BasicComboPopup popup) { JList list = popup.getList(); Container c = SwingUtilities.getAncestorOfClass(JScrollPane.class, list); return (JScrollPane) c; }
From source file:pl.otros.vfs.browser.JOtrosVfsBrowserDialog.java
protected JDialog createDialog(Component parent) throws HeadlessException { Frame toUse = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent); final JDialog dialog = new JDialog(toUse); dialog.getContentPane().add(vfsBrowser); dialog.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { cancelSelection();/* w w w.ja va2 s. c o m*/ } }); vfsBrowser.setApproveAction(new AbstractAction(Messages.getMessage("general.openButtonText")) { @Override public void actionPerformed(ActionEvent actionEvent) { returnValue = ReturnValue.Approve; dialog.dispose(); } }); vfsBrowser.setCancelAction(new AbstractAction(Messages.getMessage("general.cancelButtonText")) { @Override public void actionPerformed(ActionEvent actionEvent) { cancelSelection(); dialog.dispose(); } }); dialog.setModal(true); dialog.invalidate(); dialog.repaint(); return dialog; }
From source file:plugins.ImageRectificationPanel.java
@Override public void actionPerformed(ActionEvent e) { String ac = e.getActionCommand().toLowerCase(); switch (ac) { case "close": JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, this); d.dispose();//from w w w. ja v a 2 s . c o m cancelOp = true; break; case "ok": if (!isRunning) { // you only want one of these threads running at a time. cancelOp = false; task = new Task(); task.addPropertyChangeListener(this); task.execute(); } break; case "cancel": cancelOp = true; break; } }
From source file:wsattacker.sso.openid.attacker.gui.MainGui.java
@Override public void actionPerformed(ActionEvent e) { JButton pressedButton = (JButton) e.getSource(); //System.out.println("pressed button: " + pressedButton.getText()); if (pressedButton == lastPressedButton) { // do nothing return;//from ww w . j a v a2s.co m } // remove selection from LAST pressed button lastPressedButton.setFont(defaultFont); lastPressedButton = pressedButton; // add selection to pressed button pressedButton.setFont(boldUnderline); JXTaskPane taskPaneOfPressedButton = (JXTaskPane) SwingUtilities.getAncestorOfClass(JXTaskPane.class, pressedButton); if (taskPaneOfPressedButton.getTitle().equals("Attacker IdP")) { switch (pressedButton.getText()) { case "Server Configuration": splitPane.setRightComponent(attackerIdpServerConfigurationGui); break; case "HTML Discovery": splitPane.setRightComponent(attackerIdpHtmlConfigurationGui); break; case "XRDS Discovery": splitPane.setRightComponent(attackerIdpXrdsConfigurationGui); break; case "Valid Data": splitPane.setRightComponent(attackerIdpValidDataGui); break; case "Attack Data": splitPane.setRightComponent(attackerIdpAttackDataGui); break; case "Attack Overview": splitPane.setRightComponent(attackerIdpAttackOverviewGui); break; } } else { switch (pressedButton.getText()) { case "Server Configuration": splitPane.setRightComponent(analyzerIdpServerConfigurationGui); break; case "HTML Discovery": splitPane.setRightComponent(analyzerIdpHtmlConfigurationGui); break; case "XRDS Discovery": splitPane.setRightComponent(analyzerIdpXrdsConfigurationGui); break; case "Valid Data": splitPane.setRightComponent(analyzerIdpValidDataGui); break; case "Attack Data": splitPane.setRightComponent(analyzerIdpAttackDataGui); break; case "Parameter Overview": splitPane.setRightComponent(analyzerIdpAttackOverviewGui); break; case "Automated Analysis": splitPane.setRightComponent(evaluationGui); break; case "Reports": splitPane.setRightComponent(reportGui); break; case "Log": splitPane.setRightComponent(logGui); break; } } }