Example usage for javax.swing JTree getRowBounds

List of usage examples for javax.swing JTree getRowBounds

Introduction

In this page you can find the example usage for javax.swing JTree getRowBounds.

Prototype

public Rectangle getRowBounds(int row) 

Source Link

Document

Returns the Rectangle that the node at the specified row is drawn in.

Usage

From source file:com.mirth.connect.client.ui.codetemplate.ContextTreeTableCellEditor.java

@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
        int column) {
    Pair<Integer, ?> pair = (Pair<Integer, ?>) value;
    if (pair != null) {
        checkBox.setState(pair.getLeft());
        if (pair.getRight() instanceof String) {
            contextType = null;//w w w.j  a v a 2 s .  co m
            checkBox.setText((String) pair.getRight());
        } else {
            contextType = (ContextType) pair.getRight();
            checkBox.setText(contextType.getDisplayName());
        }
    }

    MirthTreeTable treeTable = (MirthTreeTable) table;
    JTree tree = (JTree) treeTable.getCellRenderer(0, treeTable.getHierarchicalColumn());
    panel.setOffset(tree.getRowBounds(row).x);
    panel.setBackground(row % 2 == 0 ? UIConstants.HIGHLIGHTER_COLOR : UIConstants.BACKGROUND_COLOR);
    checkBox.setBackground(panel.getBackground());
    return panel;
}

From source file:com.mirth.connect.client.ui.codetemplate.CodeTemplateTreeTableCellEditor.java

@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
        int column) {
    MirthTreeTable treeTable = (MirthTreeTable) table;
    JTree tree = (JTree) treeTable.getCellRenderer(0, treeTable.getHierarchicalColumn());
    panel.setOffset(tree.getRowBounds(row).x);
    field.setText((String) value);
    return panel;
}