javax.swing.JTable.getHeight()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中javax.swing.JTable.getHeight()方法的一些代码示例,展示了JTable.getHeight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTable.getHeight()方法的具体详情如下:
包路径:javax.swing.JTable
类名称:JTable
方法名:getHeight

JTable.getHeight介绍

暂无

代码示例

代码示例来源:origin: robotframework/SwingLibrary

private Point getCellCoordinates(int x, int y) {
  int columnCount = invoker.getModel().getColumnCount();
  int rowCount = invoker.getModel().getRowCount();
  int cellX = x / (invoker.getWidth() / columnCount);
  int cellY = y / (invoker.getHeight() / rowCount);
  return new Point(cellX, cellY);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public void showPopup(MouseEvent mevt) {
    if (isPopupAllowed()) {
      if ( mevt.getY() > treeTable.getHeight() )
        // clear selection, if click under the table
        treeTable.clearSelection();
      createPopup(mevt);
    }
  }
};

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public void showPopup(MouseEvent mevt) {
    if (isPopupAllowed()) {
      if ( mevt.getY() > treeTable.getHeight() )
        // clear selection, if click under the table
        treeTable.clearSelection();
      createPopup(mevt);
    }
  }
};

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

/**
 * @param rectangles List of rectangles to paint, maybe null
 * @param cellLocation the location of the cell, guaranteed to be not null
 * @param paintRow boolean indicating whether the row should be painted
 * @param paintColumn boolean indicating whether the column should be painted
 * @return list of rectangles to paint, maybe null
 */
private List<Rectangle> getPaintRectangles(List<Rectangle> rectangles, Point cellLocation,
    boolean paintRow, boolean paintColumn) {
  if (!paintRow && !paintColumn) return rectangles;
  if (rectangles == null) {
    rectangles = new ArrayList<Rectangle>();
  }
  Rectangle r = component.getCellRect(cellLocation.y, cellLocation.x,
      false);
  if (paintRow) {
    rectangles.add(new Rectangle(0, r.y, component.getWidth(),
        r.height));
  }
  if (paintColumn) {
    rectangles.add(new Rectangle(r.x, 0, r.width, component
        .getHeight()));
  }
  return rectangles;
}

代码示例来源:origin: stackoverflow.com

JTable tbl; // your table
tbl.scrollRectToVisible(new Rectangle(0, tbl.getHeight() - 1, tbl.getWidth(), 1));

代码示例来源:origin: de.sciss/jtreetable

private Rectangle extendRect(Rectangle rect, boolean horizontal) {
  if (rect == null) {
    return rect;
  }
  if (horizontal) {
    rect.x = 0;
    rect.width = table.getWidth();
  } else {
    rect.y = 0;
    if (table.getRowCount() != 0) {
      Rectangle lastRect = table.getCellRect(table.getRowCount() - 1, 0, true);
      rect.height = lastRect.y + lastRect.height;
    } else {
      rect.height = table.getHeight();
    }
  }
  return rect;
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * @param rectangles List of rectangles to paint, maybe null
 * @param cellLocation the location of the cell, guaranteed to be not null
 * @param paintRow boolean indicating whether the row should be painted
 * @param paintColumn boolean indicating whether the column should be painted
 * @return list of rectangles to paint, maybe null
 */
private List<Rectangle> getPaintRectangles(List<Rectangle> rectangles, Point cellLocation,
    boolean paintRow, boolean paintColumn) {
  if (!paintRow && !paintColumn) return rectangles;
  if (rectangles == null) {
    rectangles = new ArrayList<Rectangle>();
  }
  Rectangle r = component.getCellRect(cellLocation.y, cellLocation.x,
      false);
  if (paintRow) {
    rectangles.add(new Rectangle(0, r.y, component.getWidth(),
        r.height));
  }
  if (paintColumn) {
    rectangles.add(new Rectangle(r.x, 0, r.width, component
        .getHeight()));
  }
  return rectangles;
}

代码示例来源:origin: org.java.net.substance/substance

private Rectangle extendRect(Rectangle rect, boolean horizontal) {
  if (rect == null) {
    return rect;
  }
  if (horizontal) {
    rect.x = 0;
    rect.width = table.getWidth();
  } else {
    rect.y = 0;
    if (table.getRowCount() != 0) {
      Rectangle lastRect = table.getCellRect(table.getRowCount() - 1,
          0, true);
      rect.height = lastRect.y + lastRect.height;
    } else {
      rect.height = table.getHeight();
    }
  }
  return rect;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * @param rectangles List of rectangles to paint, maybe null
 * @param cellLocation the location of the cell, guaranteed to be not null
 * @param paintRow boolean indicating whether the row should be painted
 * @param paintColumn boolean indicating whether the column should be painted
 * @return list of rectangles to paint, maybe null
 */
private List<Rectangle> getPaintRectangles(List<Rectangle> rectangles, Point cellLocation,
    boolean paintRow, boolean paintColumn) {
  if (!paintRow && !paintColumn) return rectangles;
  if (rectangles == null) {
    rectangles = new ArrayList<Rectangle>();
  }
  Rectangle r = component.getCellRect(cellLocation.y, cellLocation.x,
      false);
  if (paintRow) {
    rectangles.add(new Rectangle(0, r.y, component.getWidth(),
        r.height));
  }
  if (paintColumn) {
    rectangles.add(new Rectangle(r.x, 0, r.width, component
        .getHeight()));
  }
  return rectangles;
}

代码示例来源:origin: com.github.insubstantial/substance

private Rectangle extendRect(Rectangle rect, boolean horizontal) {
  if (rect == null) {
    return rect;
  }
  if (horizontal) {
    rect.x = 0;
    rect.width = table.getWidth();
  } else {
    rect.y = 0;
    if (table.getRowCount() != 0) {
      Rectangle lastRect = table.getCellRect(table.getRowCount() - 1,
          0, true);
      rect.height = lastRect.y + lastRect.height;
    } else {
      rect.height = table.getHeight();
    }
  }
  return rect;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * @param rectangles List of rectangles to paint, maybe null
 * @param cellLocation the location of the cell, guaranteed to be not null
 * @param paintRow boolean indicating whether the row should be painted
 * @param paintColumn boolean indicating whether the column should be painted
 * @return list of rectangles to paint, maybe null
 */
private List<Rectangle> getPaintRectangles(List<Rectangle> rectangles, Point cellLocation,
    boolean paintRow, boolean paintColumn) {
  if (!paintRow && !paintColumn) return rectangles;
  if (rectangles == null) {
    rectangles = new ArrayList<Rectangle>();
  }
  Rectangle r = component.getCellRect(cellLocation.y, cellLocation.x,
      false);
  if (paintRow) {
    rectangles.add(new Rectangle(0, r.y, component.getWidth(),
        r.height));
  }
  if (paintColumn) {
    rectangles.add(new Rectangle(r.x, 0, r.width, component
        .getHeight()));
  }
  return rectangles;
}

代码示例来源:origin: khuxtable/seaglass

/**
 * DOCUMENT ME!
 *
 * @param  rect       DOCUMENT ME!
 * @param  horizontal DOCUMENT ME!
 *
 * @return DOCUMENT ME!
 */
private Rectangle extendRect(Rectangle rect, boolean horizontal) {
  if (rect == null) {
    return rect;
  }
  if (horizontal) {
    rect.x     = 0;
    rect.width = table.getWidth();
  } else {
    rect.y = 0;
    if (table.getRowCount() != 0) {
      Rectangle lastRect = table.getCellRect(table.getRowCount() - 1, 0, true);
      rect.height = lastRect.y + lastRect.height;
    } else {
      rect.height = table.getHeight();
    }
  }
  return rect;
}

代码示例来源:origin: stackoverflow.com

JTable table = new JTable(new AncientSwingTeam());
 JTableHeader header =table.getTableHeader();
 table.setSize(table.getPreferredSize());
 header.setSize(header.getPreferredSize());
 int w = Math.max(table.getWidth(), header.getWidth());
 int h = table.getHeight() + header.getHeight();
 BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
 Graphics2D g2 = bi.createGraphics();
 header.paint(g2);
 g2.translate(0, header.getHeight());
 table.paint(g2);
 g2.dispose();
 JLabel label = new JLabel(new ImageIcon(bi));
 showInFrame(label, "image of table");

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@Override
  public void showPopup(MouseEvent mevt) {
    if (isPopupAllowed()) {
      if (mevt.getY() > treeTable.getHeight()) {
        // clear selection, if click under the table
        treeTable.clearSelection();
      } else {
        int selRow = treeTable.rowAtPoint( mevt.getPoint() );
        boolean isAlreadySelected = false;
        int[] currentSelection = tree.getSelectionRows();
        for( int i=0; null != currentSelection && i<currentSelection.length; i++ ) {
          if( selRow == currentSelection[i] ) {
            isAlreadySelected = true;
            break;
          }
        }
        if( !isAlreadySelected )
          tree.setSelectionRow( selRow );
      }
      createPopup(mevt);
    }
  }
};

代码示例来源:origin: stackoverflow.com

yOffset += table1.getHeight();

代码示例来源:origin: khuxtable/seaglass

paintStripesAndGrid(context, g, table, table.getWidth(), table.getHeight(), 0);

相关文章

JTable类方法