本文整理汇总了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);
}
}
}
}
示例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;
}
}
示例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;
}
示例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);
}
示例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");
}
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例9: isKnownComponent
import java.awt.Component; //导入方法依赖的package包/类
@Override
public boolean isKnownComponent(Component c) {
return c.equals(password) || password.isAncestorOf(c);
}
示例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);
}
}
示例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);
}