當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。