当前位置: 首页>>代码示例>>Java>>正文


Java SwingUtilities.getRoot方法代码示例

本文整理汇总了Java中javax.swing.SwingUtilities.getRoot方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.getRoot方法的具体用法?Java SwingUtilities.getRoot怎么用?Java SwingUtilities.getRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.SwingUtilities的用法示例。


在下文中一共展示了SwingUtilities.getRoot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: eventDispatched

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override public void eventDispatched(AWTEvent event) {
    if (ignoreMouseEvents) {
        return;
    }
    Component root = SwingUtilities.getRoot((Component) event.getSource());
    if (root instanceof IRecordingArtifact || root.getName().startsWith("###")) {
        return;
    }
    if (!(event instanceof MouseEvent)) {
        return;
    }
    MouseEvent mouseEvent = (MouseEvent) event;
    mouseEvent.consume();
    if (event.getID() == MouseEvent.MOUSE_PRESSED) {
        disposeOverlay();
        Component mouseComponent = SwingUtilities.getDeepestComponentAt(mouseEvent.getComponent(), mouseEvent.getX(),
                mouseEvent.getY());
        if (mouseComponent == null) {
            return;
        }
        mouseEvent = SwingUtilities.convertMouseEvent(mouseEvent.getComponent(), mouseEvent, mouseComponent);
        setComponent(mouseComponent, mouseEvent.getPoint(), true);
        return;
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:ContextMenuWindow.java

示例2: fillPanel

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void fillPanel() {
	customPanel.removeAll();

	gbc.weightx = 1;
	gbc.weighty = 1;
	gbc.gridy = 0;
	gbc.gridx = 0;
	gbc.fill = GridBagConstraints.BOTH;
	for (FiringModelMap map : firingModelMaps) {
		if ((map != onMap) && (map != offMap)) {
			ParameterBrowserPanel newMapPanel = new ParameterBrowserPanel(map);
			customPanel.add(newMapPanel, gbc);
			mapPanels.add(newMapPanel);
			gbc.gridy++;
			panelCounter++;
		}
	}
       JFrame frame = (JFrame) SwingUtilities.getRoot(customPanel);
       if (frame != null) {
		frame.pack();
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:23,代码来源:SpatioTemporalFusion.java

示例3: mapAdded

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void mapAdded() {
	if (panelCounter < (firingModelMaps.size()-2)) {
		ParameterBrowserPanel newMapPanel = new ParameterBrowserPanel(firingModelMaps.get(firingModelMaps.size()-1));
		if (!loading) {
			newMapPanel.toggleSelection();
		}
		customPanel.add(newMapPanel, gbc);
		mapPanels.add(newMapPanel);
		gbc.gridy++;
		panelCounter++;
        JFrame frame = (JFrame) SwingUtilities.getRoot(customPanel);
        if (frame != null) {
			frame.pack();
		}
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:17,代码来源:SpatioTemporalFusion.java

示例4: fillPanel

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
protected void fillPanel() {
//			removeAll();
			JPanel dummyPanel = new JPanel();
			dummyPanel.setLayout(new BorderLayout());
			dummyPanel.add(new JLabel("   "), BorderLayout.WEST);
			kernelPanel = new JPanel();
			dummyPanel.add(kernelPanel,BorderLayout.CENTER);
			kernelPanel.setLayout(new GridBagLayout());
			CollapsablePanel collapsablePanel = new CollapsablePanel("Input kernels",dummyPanel);
            for (SignalTransformationKernel stk : inputKernels) {
				ParameterBrowserPanel newPanel = new ParameterBrowserPanel(stk);
				newPanel.toggleSelection();
				kernelPanel.add(newPanel, gbcKernel);
				panels.add(newPanel);
				gbcKernel.gridy++;
				panelCounter++;
			}
            collapsablePanel.toggleSelection();
            add(collapsablePanel, gbc);
            gbc.gridy++;
	        JFrame frame = (JFrame) SwingUtilities.getRoot(this);
	        if (frame != null)
	        	frame.pack();
		}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:25,代码来源:FiringModelMap.java

示例5: actionPerformed

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
	Object source = e.getSource();
	if (source == editLayout) {
		proj.setCurrentCircuit(circuit);
		proj.getFrame().setEditorView(Frame.EDIT_LAYOUT);
	} else if (source == editAppearance) {
		proj.setCurrentCircuit(circuit);
		proj.getFrame().setEditorView(Frame.EDIT_APPEARANCE);
	} else if (source == analyze) {
		ProjectCircuitActions.doAnalyze(proj, circuit);
	} else if (source == stats) {
		JFrame frame = (JFrame) SwingUtilities.getRoot(this);
		StatisticsDialog.show(frame, proj.getLogisimFile(), circuit);
	} else if (source == main) {
		ProjectCircuitActions.doSetAsMainCircuit(proj, circuit);
	} else if (source == remove) {
		ProjectCircuitActions.doRemoveCircuit(proj, circuit);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:21,代码来源:Popups.java

示例6: stopCellEditing

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public boolean stopCellEditing() {
    String s = cell.toString();
    Window ancestorWindow = (Window)SwingUtilities.getRoot(cell);
    // #236458: options are now saved asynchronously. If the dialog was to 
    if (ancestorWindow == null) {
        return true;
    }
    // HACK: if this Editor creates a dialog, it will lose the focus and Swing
    // will remove the editor, calling JTable.cancelEditing. Any re-selections performed
    // by the JTable will occur BEFORE the dialog is finished, so we need to
    // reestablish the column selection later from here.
    // This binds the BCEditor to the KeymapTable layout / internals.
    JTable parent = (JTable)cell.getParent();
    
    ShortcutAction sca = (ShortcutAction) action;
    Set<ShortcutAction> conflictingAction = model.getMutableModel().findActionForShortcutPrefix(s);
    conflictingAction.remove(sca); //remove the original action
    
    Collection<ShortcutAction> sameScopeActions = model.getMutableModel().filterSameScope(conflictingAction, sca);
    
    if (!conflictingAction.isEmpty()) {
         if (!SwingUtilities.isEventDispatchThread()) {
             // #236458: options are now saved asynchronously, off EDT. If we display dialog, the IDE will lock up.
            cell.getTextField().setText(orig);
            fireEditingCanceled();
            return true;
         }
        //there is a conflicting action, show err dialog
        Object overrride = overrride(conflictingAction, sameScopeActions);
        
        // bring the focus back
        ancestorWindow.toFront();
        parent.requestFocus();
        if (overrride.equals(DialogDescriptor.YES_OPTION)) {
            for (ShortcutAction sa : conflictingAction) {
                removeConflictingShortcut(sa, s); //remove all conflicting shortcuts
            }
            //proceed with override
        } else if (overrride == DialogDescriptor.CANCEL_OPTION) {
            cell.getTextField().setText(orig);
            fireEditingCanceled();
            setBorderEmpty();
            return true;
        }
        // NO_OPTION fallls through and adds additional shortcut.
    }
    cell.getTextField().removeActionListener(delegate);
    cell.getTextField().removeKeyListener(escapeAdapter);
    model.getMutableModel().removeShortcut((ShortcutAction) action, orig);
    if (!(s.length() == 0)) // do not add empty shortcuts
        model.getMutableModel().addShortcut((ShortcutAction) action, s);
    fireEditingStopped();
    setBorderEmpty();
    model.update();
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:58,代码来源:ButtonCellEditor.java

示例7: showPopup

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public ContextMenuWindow showPopup(Component component, Point point) {
    Component root = SwingUtilities.getRoot(component);
    if (root instanceof Window) {
        setContextMenu(new ContextMenuWindow((Window) root, recorder, finder));
    } else {
        throw new RuntimeException("Unknown root for component");
    }
    contextMenu.setComponent(component, point, true);
    if (component instanceof JMenu) {
        contextMenu.show(((JMenu) component).getParent(), point.x, point.y);
    } else {
        contextMenu.show(component, point.x, point.y);
    }
    return contextMenu;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:ContextMenuHandler.java

示例8: initLocalData

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
protected void initLocalData(){
  differ = new AnnotationDiffer();
  pairings = new ArrayList<AnnotationDiffer.Pairing>();
  keyCopyValueRows = new ArrayList<Boolean>();
  resCopyValueRows = new ArrayList<Boolean>();
  significantFeatures = new HashSet<String>();
  keyDoc = null;
  resDoc = null;
  Component root = SwingUtilities.getRoot(AnnotationDiffGUI.this);
  isStandalone = (root instanceof MainFrame);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:12,代码来源:AnnotationDiffGUI.java

示例9: creatorChanged

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
protected void creatorChanged() {
	if (creatorPanel != null) {
		remove(creatorPanel);
	}
	if (schedulableFiringModelCreator == null) {
		FiringModelCreator firingModelCreator2 = getFiringModelCreator();
		if (firingModelCreator2 != null) {
			firingModelCreator2.setName("Unit parameters");
			creatorPanel = new ParameterBrowserPanel(
					firingModelCreator2, false);
		}
		else {
			creatorPanel = null;
		}
	} else {
		schedulableFiringModelCreator.setName("Unit parameters");
		creatorPanel = new ParameterBrowserPanel(
				schedulableFiringModelCreator, false);
	}
	if (creatorPanel != null) {
		add(creatorPanel, creatorConstraints);
	}
	JFrame frame = (JFrame) SwingUtilities.getRoot(this);
	if (frame != null) {
		frame.pack();
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:28,代码来源:SchedulableWrapperMap.java

示例10: toggleSelection

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void toggleSelection() {  
    selected = !selected;  
  
    if (contentPanel.isShowing())  
        contentPanel.setVisible(false);  
    else  
        contentPanel.setVisible(true);  
  
    validate();  
    JFrame frame = (JFrame) SwingUtilities.getRoot(this);
    if (frame != null)
    	frame.pack();
  
    headerPanel.repaint();  
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:16,代码来源:CollapsablePanel.java

示例11: mapRemoved

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void mapRemoved(int index) {
	if ((panelCounter > index) && (index >= 0)) {
		ParameterBrowserPanel panel = mapPanels.get(index);
		mapPanels.remove(index);
		customPanel.remove(panel);
		panelCounter--;
        JFrame frame = (JFrame) SwingUtilities.getRoot(customPanel);
        if (frame != null) {
			frame.pack();
		}
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:13,代码来源:SpatioTemporalFusion.java

示例12: kernelAdded

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void kernelAdded(boolean userAction) {
	if (panelCounter < inputKernels.size()) {
		ParameterBrowserPanel newPanel = new ParameterBrowserPanel(inputKernels.get(inputKernels.size()-1));
		if (userAction)
			newPanel.toggleSelection();
		kernelPanel.add(newPanel, gbcKernel);
		panels.add(newPanel);
		gbcKernel.gridy++;
		panelCounter++;
        JFrame frame = (JFrame) SwingUtilities.getRoot(this);
        if (frame != null)
        	frame.pack();
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:15,代码来源:FiringModelMap.java

示例13: kernelRemoved

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void kernelRemoved(int index) {
	if (index >= 0 && index < panelCounter) {
		ParameterBrowserPanel panel = panels.get(index);
		panels.remove(index);
		kernelPanel.remove(panel);
		panelCounter--;
        JFrame frame = (JFrame) SwingUtilities.getRoot(this);
        if (frame != null)
        	frame.pack();
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:12,代码来源:FiringModelMap.java

示例14: handleBitPress

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void handleBitPress(InstanceState state, int bit, MouseEvent e) {
	PinAttributes attrs = (PinAttributes) state.getAttributeSet();
	if (!attrs.isInput())
		return;

	java.awt.Component sourceComp = e.getComponent();
	if (sourceComp instanceof Canvas && !state.isCircuitRoot()) {
		Canvas canvas = (Canvas) e.getComponent();
		CircuitState circState = canvas.getCircuitState();
		java.awt.Component frame = SwingUtilities.getRoot(canvas);
		int choice = JOptionPane.showConfirmDialog(frame, Strings.get("pinFrozenQuestion"),
				Strings.get("pinFrozenTitle"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
		if (choice == JOptionPane.OK_OPTION) {
			circState = circState.cloneState();
			canvas.getProject().setCircuitState(circState);
			state = circState.getInstanceState(state.getInstance());
		} else {
			return;
		}
	}

	PinState pinState = getState(state);
	Value val = pinState.sending.get(bit);
	if (val == Value.FALSE) {
		val = Value.TRUE;
	} else if (val == Value.TRUE) {
		val = attrs.threeState ? Value.UNKNOWN : Value.FALSE;
	} else {
		val = Value.FALSE;
	}
	pinState.sending = pinState.sending.set(bit, val);
	state.fireInvalidated();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:34,代码来源:Pin.java

示例15: disp_percen

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
void disp_percen(int d) throws IOException {

        if (d >= 97) {

            JOptionPane.showMessageDialog(null, "Welcome Login\n" + "Similarity : " + d + " %");
            FaceRecognizeFrame.myThread.runnable = false;// stop thread
            FaceRecognizeFrame.webSource.release(); // stop caturing fron cam

            Component comp = SwingUtilities.getRoot(this);// dispose or close this Frame
            ((Window) comp).dispose();

            new MainMenu();

        } else {
            JOptionPane.showMessageDialog(null, " Login Failed \n" + "Similarity : " + d + " %");

        }
    }
 
开发者ID:javaspecial,项目名称:Face-detection-and-recognition-desktop-application,代码行数:19,代码来源:FaceRecognizeFrame.java


注:本文中的javax.swing.SwingUtilities.getRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。