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


Java JTable.getParent方法代码示例

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


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

示例1: getColumnLocation

import javax.swing.JTable; //导入方法依赖的package包/类
/**
 * 
 */
public int getColumnLocation(mxCellState edge, mxCellState terminal, int column) {
  Component[] c = components.get(terminal.getCell());
  int y = 0;

  if (c != null) {
    for (int i = 0; i < c.length; i++) {
      if (c[i] instanceof JTableRenderer) {
        JTableRenderer vertex = (JTableRenderer) c[i];

        JTable table = vertex.table;
        JViewport viewport = (JViewport) table.getParent();
        double dy = -viewport.getViewPosition().getY();
        y = (int) Math.max(terminal.getY() + 22,
            terminal.getY() + Math.min(terminal.getHeight() - 20, 30 + dy + column * 16));
      }
    }
  }

  return y;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:24,代码来源:SchemaGraphComponent.java

示例2: showWindow

import javax.swing.JTable; //导入方法依赖的package包/类
private void showWindow(JTable table, int row) {

		/* determine correct location */
		//TODO: throw away half of this rubbish
		Point offset = new Point();
		Point tablebase = table.getLocationOnScreen();
		Point framebase = owner.getLocationOnScreen();

		Rectangle cellRect = table.getCellRect(row, 0, true);
		int middle = table.getHeight() / 2;

		int deltax, deltay, width;

		deltay = tablebase.y - framebase.y;

		Component c = table.getParent();
		if (c instanceof JViewport) { //we are in a JScrollPane
			c = c.getParent();
			deltax = c.getLocationOnScreen().x - framebase.x;
			width = c.getWidth();
		} else {
			deltax = tablebase.x - framebase.x;
			width = table.getWidth();
		}

		offset.x = cellRect.x + deltax;

		if (cellRect.y > middle) {
			offset.y = cellRect.y - ldWindow.getHeight() + deltay;
		} else {
			offset.y = cellRect.y + cellRect.height + deltay;
		}
		//ldWindow.setBase(framebase);
		//ldWindow.setOffset(offset);

		ldWindow.centerWindow(width, ldWindow.getHeight());
		ldWindow.show();
	}
 
开发者ID:max6cn,项目名称:jmt,代码行数:39,代码来源:LDEditor.java

示例3: getColumnLocation

import javax.swing.JTable; //导入方法依赖的package包/类
/**
 * 
 */
public int getColumnLocation(mxCellState edge, mxCellState terminal,
		int column)
{
	Component[] c = components.get(terminal.getCell());
	int y = 0;

	if (c != null)
	{
		for (int i = 0; i < c.length; i++)
		{
			if (c[i] instanceof JTableRenderer)
			{
				JTableRenderer vertex = (JTableRenderer) c[i];

				JTable table = vertex.table;
				JViewport viewport = (JViewport) table.getParent();
				double dy = -viewport.getViewPosition().getY();
				y = (int) Math.max(terminal.getY() + 22, terminal.getY()
						+ Math.min(terminal.getHeight() - 20, 30 + dy
								+ column * 16));
			}
		}
	}

	return y;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:30,代码来源:SchemaGraphComponent.java


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