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


Java Component.getTreeLock方法代码示例

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


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

示例1: removeLayoutComponent

import java.awt.Component; //导入方法依赖的package包/类
public void removeLayoutComponent(Component comp) {
    synchronized (comp.getTreeLock()) {
        if (comp == center) {
            center = null;
            map.remove(center);
        } else if (comp == north) {
            north = null;
            map.remove(north);
        } else if (comp == south) {
            south = null;
            map.remove(south);
        } else if (comp == east) {
            east = null;
            map.remove(east);
        } else if (comp == west) {
            west = null;
            map.remove(west);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CrossBorderLayout.java

示例2: addLayoutComponent

import java.awt.Component; //导入方法依赖的package包/类
@Override
public void addLayoutComponent(String name, Component comp) {
	synchronized (comp.getTreeLock()) {
		if (name == null) {
			name = "Center";
		}

		/* Assign the component to one of the known regions of the layout.
		*/
		if ("Center".equals(name)) {
			center.add(comp);
		} else if ("North".equals(name)) {
			north.add(comp);
		} else if ("South".equals(name)) {
			south.add(comp);
		} else if ("East".equals(name)) {
			east.add(comp);
		} else if ("West".equals(name)) {
			west.add(comp);
		} else {
			throw new IllegalArgumentException("cannot add to layout: unknown constraint: " + name);
		}
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:25,代码来源:MultiBorderLayout.java

示例3: addLayoutComponent

import java.awt.Component; //导入方法依赖的package包/类
/**
 * Adds the specified component to the layout. A JToolBar passed into this
 * method will be docked at the edge specified by its associated
 * ToolBarHandler unless the caller passes in an alternate edge as the
 * constraint.
 */
public void addLayoutComponent(final String constraints, final Component component) {
    synchronized (component.getTreeLock()) {
        if (component instanceof JToolBar) {
            final JToolBar toolbar = (JToolBar) component;
            final Handler handler = getHandler(toolbar);

            DockBoundary boundary = null;
            if (constraints != null)
                boundary = getBoundary(constraints);
            if (boundary == null)
                boundary = getBoundary(handler.getDockEdge());

            boundary.addToolBar(toolbar, handler.getRowIndex(), handler
                    .getDockIndex());
            boundary.refreshHandlers();
        } else
            ourContent = component;
    }

}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:27,代码来源:ToolBarLayout.java

示例4: addLayoutComponent

import java.awt.Component; //导入方法依赖的package包/类
private void addLayoutComponent(Component comp, Integer[] constraints) {
    if (constraints.length == 0)
        throw new IllegalArgumentException("At least one location is required: " + // NOI18N
                                           toString(constraints));
    if (constraints.length > 3)
        throw new IllegalArgumentException("Up to three locations are required: " + // NOI18N
                                           toString(constraints));

    constraints = normalizedConstraints(constraints);

    synchronized (comp.getTreeLock()) {
        if (isNorth(constraints)) {
            north = comp;
            map.put(comp, constraints);
        } else if (isWest(constraints)) {
            west = comp;
            map.put(comp, constraints);
        } else if (isSouth(constraints)) {
            south = comp;
            map.put(comp, constraints);
        } else if (isEast(constraints)) {
            east = comp;
            map.put(comp, constraints);
        } else if (isCenter(constraints)) {
            center = comp;
            map.put(comp, constraints);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:CrossBorderLayout.java

示例5: removeLayoutComponent

import java.awt.Component; //导入方法依赖的package包/类
@Override
public void removeLayoutComponent(Component comp) {
	synchronized (comp.getTreeLock()) {
		south.remove(comp);
		north.remove(comp);
		center.remove(comp);
		west.remove(comp);
		east.remove(comp);
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:11,代码来源:MultiBorderLayout.java

示例6: focusLost

import java.awt.Component; //导入方法依赖的package包/类
/**
 * Handles focus lost events for any component that's using
 * this input context.
 * These events are generated by AWT when the keyboard focus
 * moves away from a component.
 * Besides actual client components, the source components
 * may also be the composition area or any component in an
 * input method window.
 *
 * @param source the component losing the focus
 * @isTemporary whether the focus change is temporary
 */
private void focusLost(Component source, boolean isTemporary) {

    // see the note on synchronization in focusGained
    synchronized (source.getTreeLock()) {
        synchronized (this) {

            // We need to suppress deactivation if removeNotify has been called earlier.
            // This is indicated by isInputMethodActive == false.
            if (isInputMethodActive) {
                deactivateInputMethod(isTemporary);
            }

            awtFocussedComponent = null;
            if (inputMethod instanceof InputMethodAdapter) {
                ((InputMethodAdapter) inputMethod).setAWTFocussedComponent(null);
            }

            // hides the composition area if currently it is visible
            InputMethodContext inputContext = ((InputMethodContext)this);
            if (inputContext.isCompositionAreaVisible()) {
                inputContext.setCompositionAreaVisible(false);
                compositionAreaHidden = true;
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:InputContext.java


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