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


Java Component.getLocation方法代码示例

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


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

示例1: getPreferredSize

import java.awt.Component; //导入方法依赖的package包/类
@Override
public Dimension getPreferredSize() {
  Dimension size = super.getPreferredSize();
  if(getItemCount() <= maximumFastChoices && size.width > maximumWidth) {
    setSize(maximumWidth, Integer.MAX_VALUE);
    doLayout();
    int compCnt = getComponentCount();
    if(compCnt > 0) {
      Component lastComp = getComponent(compCnt - 1);
      Point compLoc = lastComp.getLocation();
      Dimension compSize = lastComp.getSize();
      size.width = maximumWidth;
      size.height = compLoc.y + compSize.height + getInsets().bottom;
    }
  }
  return size;
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:18,代码来源:JChoice.java

示例2: paint

import java.awt.Component; //导入方法依赖的package包/类
@Override
public void paint(Graphics g) {
    Rectangle r = getBounds();
    g.setColor(Color.lightGray);
    g.draw3DRect(0, 0, r.width, r.height, false);

    int n = getComponentCount();
    for (int i = 0; i < n; i++) {
        Component comp = getComponent(i);
        if (comp instanceof Checkbox) {
            Point loc = comp.getLocation();
            Dimension d = comp.getSize();
            g.setColor(comp.getForeground());
            g.drawRect(loc.x - 1, loc.y - 1, d.width + 1, d.height + 1);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:DrawTest.java

示例3: getIconAt

import java.awt.Component; //导入方法依赖的package包/类
protected JInternalFrame.JDesktopIcon getIconAt(JDesktopPane desktop,
    JInternalFrame.JDesktopIcon icon, int x, int y) {

    JInternalFrame.JDesktopIcon currentIcon = null;
    Component[] components = desktop.getComponents();

    for (int i=0; i<components.length; i++) {
        Component comp = components[i];
        if (comp instanceof JInternalFrame.JDesktopIcon &&
            comp != icon) {

            Point p = comp.getLocation();
            if (p.x == x && p.y == y) {
                return (JInternalFrame.JDesktopIcon)comp;
            }
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:MotifDesktopPaneUI.java

示例4: paintDropGesture

import java.awt.Component; //导入方法依赖的package包/类
private void paintDropGesture( Graphics g ) {
    Component c = toolbar.getComponentAtIndex( dropIndex );
    if( null == c )
        return;

    Point location = c.getLocation();
    int cursorLocation = location.x;
    if( !dropBefore ) {
        cursorLocation += c.getWidth();
        if( dropIndex == toolbar.getComponentCount()-1 )
            cursorLocation -= 3;
    }
    drawDropLine( g, cursorLocation );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ToolbarContainer.java

示例5: WindowMover

import java.awt.Component; //导入方法依赖的package包/类
WindowMover(Component parent, Component component, int movePolicy) {
    window = parent;
    com = component;
    loc = component.getLocation();
    init(movePolicy);
    addListeners(com);

}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:9,代码来源:WindowMover.java


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