Example usage for javax.swing JTable getHeight

List of usage examples for javax.swing JTable getHeight

Introduction

In this page you can find the example usage for javax.swing JTable getHeight.

Prototype

@BeanProperty(bound = false)
public int getHeight() 

Source Link

Document

Returns the current height of this component.

Usage

From source file:Main.java

public static BufferedImage createImage(JTable table) {
    JTableHeader tableHeaderComp = table.getTableHeader();
    int totalWidth = tableHeaderComp.getWidth() + table.getWidth();
    int totalHeight = tableHeaderComp.getHeight() + table.getHeight();
    BufferedImage tableImage = new BufferedImage(totalWidth, totalHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2D = (Graphics2D) tableImage.getGraphics();
    tableHeaderComp.paint(g2D);//ww w.ja v  a  2 s .  c  o  m
    g2D.translate(0, tableHeaderComp.getHeight());
    table.paint(g2D);
    return tableImage;
}

From source file:table.FrequencyTablePanel.java

public static BufferedImage createImage(JTable table) {
    JTableHeader tableHeaderComp = table.getTableHeader();
    int totalWidth = tableHeaderComp.getWidth();
    int totalHeight = tableHeaderComp.getHeight() + table.getHeight();
    BufferedImage tableImage = new BufferedImage(totalWidth, totalHeight, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2D = (Graphics2D) tableImage.getGraphics();
    tableHeaderComp.paint(g2D);/*from   w  w w.  j a  v a  2 s  . co m*/
    g2D.translate(0, tableHeaderComp.getHeight());
    table.paint(g2D);
    return tableImage;
}