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


Java Component.equals方法代码示例

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


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

示例1: removeSection

import java.awt.Component; //导入方法依赖的package包/类
protected void removeSection(JComponent section)
{
	for( int i = 0, count = getComponentCount(); i < count; i++ )
	{
		Component c = getComponent(i);
		if( c.equals(section) )
		{
			remove(i);

			// Remove next component too if it's a JSeparator
			if( i < count && getComponent(i) instanceof JSeparator )
			{
				remove(i);
			}
		}
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:18,代码来源:Editor.java

示例2: removeLayoutComponent

import java.awt.Component; //导入方法依赖的package包/类
@Override
public void removeLayoutComponent(Component c)
{
	if( c.equals(nextButton) )
	{
		c = null;
	}
	else if( c.equals(previousButton) )
	{
		previousButton = null;
	}
	else if( c.equals(editor) )
	{
		editor = null;
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:FlatterSpinnerUI.java

示例3: add

import java.awt.Component; //导入方法依赖的package包/类
@Override
public Component add(Component comp) {
    setsize(comp.getPreferredSize());
    Component[] comps = getComponents();
    if (comps.length > 0) {
        oldComponent = comps[0];
    }
    if (comp.equals(oldComponent)) {
        return super.add(comp);
    }
    if (oldComponent != null) {
        putLayer((JComponent) oldComponent, JLayeredPane.DEFAULT_LAYER);
    }
    Component returnResult = super.add(comp);
    putLayer((JComponent) comp, JLayeredPane.DRAG_LAYER);
    comp.setSize(getPreferredSize());
    comp.setVisible(true);
    comp.setLocation(0, 0 - getPreferredSize().height);
    slideFromTop(comp, oldComponent);
    return returnResult;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:22,代码来源:SlideContainer.java

示例4: enableDisablePanel

import java.awt.Component; //导入方法依赖的package包/类
private void enableDisablePanel(boolean enabled) {
    loggersPanel.setEnabled(enabled);
    Component[] components = loggersPanel.getComponents();
    for (Component c : components) {
        if (!c.equals(btnRemove)) {
            c.setEnabled(enabled);
        }
    }
    btnRemove.setEnabled(enabled && !customLoggersList.isEmpty());
    loggersScrollPane.getViewport().getView().setEnabled(enabled);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:LoggerHintsCustomizer.java

示例5: testNodes

import java.awt.Component; //导入方法依赖的package包/类
/**
 * tests if nodes are all from the same tree
 *
 * @param nodes nodes
 * @throws IllegalArgumentException when given nodes does not pass
 */
protected void testNodes(Node[] nodes) {
    if ((nodes == null) || (nodes.length == 0)) {
        throw new IllegalArgumentException("argument nodes is null or empty");
    }
    Component nodesTree = nodes[0].tree().getSource();
    for (int i = 0; i < nodes.length; i++) {
        if (nodes[i] == null) {
            throw new IllegalArgumentException("argument nodes contains null value");
        }
        if (!nodesTree.equals(nodes[i].tree().getSource())) {
            throw new IllegalArgumentException(nodes[i].toString() + " is from different tree");
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:Action.java

示例6: enableComponent

import java.awt.Component; //导入方法依赖的package包/类
public static void enableComponent(Container con, boolean state, Component component) {
    for (Component c : con.getComponents()) {
        if (c instanceof Container) {
            enableComponent((Container) c, state, component);
        }
        if (component != null && component.equals(c)) {
            continue;
        }
        if (c instanceof JLabel) {
            c.setVisible(state);
        } else {
            c.setEnabled(state);
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:16,代码来源:Utility.java

示例7: getComponentAfter

import java.awt.Component; //导入方法依赖的package包/类
public Component getComponentAfter(Container focusCycleRoot, Component aComponent) 
{
	if (aComponent.equals(leftField))
		return rightField;
	else if (aComponent.equals(rightField)) 
		return set;
	
	return leftField;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:10,代码来源:DialinPane.java

示例8: getComponentBefore

import java.awt.Component; //导入方法依赖的package包/类
public Component getComponentBefore(Container focusCycleRoot, Component aComponent) 
{
	if (aComponent.equals(leftField))
		return set;
	else if (aComponent.equals(set)) 
		return rightField;
	
	return leftField;
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:10,代码来源:DialinPane.java

示例9: isKnownComponent

import java.awt.Component; //导入方法依赖的package包/类
@Override
public boolean isKnownComponent(Component c) {
    return c.equals(password) || password.isAncestorOf(c);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:RemotePlatformNode.java

示例10: closeTab

import java.awt.Component; //导入方法依赖的package包/类
/**
 * closes the selected tab
 *
 * @param tab {@link JTabPanel}
 */
public void closeTab(final JTabPanel tab) {
	JTabContent content;
	int index = -1;
	if (tab != null) {
		content = tab.getTabContent();
		for (int i = 0; i < frame.getWorkspacePane().getTabCount(); i++) {
			final Component c = frame.getWorkspacePane().getTabComponentAt(
					i);
			if (c.equals(tab)) {
				index = i;
				break;
			}
		}
	} else {
		index = frame.getWorkspacePane().getSelectedIndex();
		if (index != -1) {
			content = (JTabContent) frame.getWorkspacePane()
					.getComponentAt(index);
		} else {
			return;
		}
	}

	if (content != null) {
		content.onClose();
	}

	// TODO i18n
	if (content.isDirty()) {
		final int result = JOptionPane.showConfirmDialog(
				frame.getContentPane(),
				"The selected file has been modified. "
				+ "Do you wanto to save it?", "Save file?",
				JOptionPane.YES_NO_CANCEL_OPTION);
		if (result == JOptionPane.YES_OPTION) {
			final File f = content.getFile();
			if (f != null && f.exists()) {
				content.saveContent(f);
			} else {
				saveTabAs(tab);
			}
			frame.getWorkspacePane().removeTabAt(index);
		} else if (result == JOptionPane.NO_OPTION) {
			frame.getWorkspacePane().removeTabAt(index);
		} else if (result == JOptionPane.CANCEL_OPTION) {
		}
	} else {
		frame.getWorkspacePane().removeTabAt(index);
	}
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:56,代码来源:MainFrameController.java

示例11: selectsectionbutton

import java.awt.Component; //导入方法依赖的package包/类
private static void selectsectionbutton(Component selcomp){
	
	deselectallsectionbuttons();
	
	for(Component comp : panelSections.getComponents()){
		
		if(comp instanceof JLabel && selcomp.equals(comp)){
			
			JLabel lblcomp=(JLabel) comp;
			
			lblcomp.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
			lblcomp.setForeground(SystemColor.windowText);
			
		}
		
	}
	
	panelOptions.setVisible(selcomp.equals(lblFiles) && online && selectedSubject>=0);
	
}
 
开发者ID:davovoid,项目名称:faitic-checker,代码行数:21,代码来源:SubjectsGUI.java


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