本文整理匯總了Java中javax.swing.tree.DefaultTreeCellRenderer.getBorderSelectionColor方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultTreeCellRenderer.getBorderSelectionColor方法的具體用法?Java DefaultTreeCellRenderer.getBorderSelectionColor怎麽用?Java DefaultTreeCellRenderer.getBorderSelectionColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.tree.DefaultTreeCellRenderer
的用法示例。
在下文中一共展示了DefaultTreeCellRenderer.getBorderSelectionColor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: paintRow
import javax.swing.tree.DefaultTreeCellRenderer; //導入方法依賴的package包/類
private void paintRow(TreeCellRenderer renderer,
DefaultTreeCellRenderer dtcr, SynthContext treeContext,
SynthContext cellContext, Graphics g, Rectangle clipBounds,
Insets insets, Rectangle bounds, Rectangle rowBounds,
TreePath path, int row, boolean isExpanded,
boolean hasBeenExpanded, boolean isLeaf) {
// Don't paint the renderer if editing this row.
boolean selected = tree.isRowSelected(row);
JTree.DropLocation dropLocation = tree.getDropLocation();
boolean isDrop = dropLocation != null
&& dropLocation.getChildIndex() == -1
&& path == dropLocation.getPath();
int state = ENABLED;
if (selected || isDrop) {
state |= SELECTED;
}
if (tree.isFocusOwner() && row == getLeadSelectionRow()) {
state |= FOCUSED;
}
cellContext.setComponentState(state);
if (dtcr != null && (dtcr.getBorderSelectionColor() instanceof
UIResource)) {
dtcr.setBorderSelectionColor(style.getColor(
cellContext, ColorType.FOCUS));
}
SynthLookAndFeel.updateSubregion(cellContext, g, rowBounds);
cellContext.getPainter().paintTreeCellBackground(cellContext, g,
rowBounds.x, rowBounds.y, rowBounds.width,
rowBounds.height);
cellContext.getPainter().paintTreeCellBorder(cellContext, g,
rowBounds.x, rowBounds.y, rowBounds.width,
rowBounds.height);
if (editingComponent != null && editingRow == row) {
return;
}
int leadIndex;
if (tree.hasFocus()) {
leadIndex = getLeadSelectionRow();
}
else {
leadIndex = -1;
}
Component component = renderer.getTreeCellRendererComponent(
tree, path.getLastPathComponent(),
selected, isExpanded, isLeaf, row,
(leadIndex == row));
rendererPane.paintComponent(g, component, tree, bounds.x, bounds.y,
bounds.width, bounds.height, true);
}
示例2: paintRow
import javax.swing.tree.DefaultTreeCellRenderer; //導入方法依賴的package包/類
private void paintRow(TreeCellRenderer renderer, DefaultTreeCellRenderer dtcr, SeaGlassContext treeContext, SeaGlassContext cellContext,
Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, Rectangle rowBounds, TreePath path, int row, boolean isExpanded,
boolean hasBeenExpanded, boolean isLeaf) {
// Don't paint the renderer if editing this row.
boolean selected = tree.isRowSelected(row);
JTree.DropLocation dropLocation = tree.getDropLocation();
boolean isDrop = dropLocation != null && dropLocation.getChildIndex() == -1 && path == dropLocation.getPath();
int state = ENABLED;
if (selected || isDrop) {
state |= SELECTED;
}
if (tree.isFocusOwner() && row == getLeadSelectionRow()) {
state |= FOCUSED;
}
cellContext.setComponentState(state);
if (dtcr != null && (dtcr.getBorderSelectionColor() instanceof UIResource)) {
dtcr.setBorderSelectionColor(style.getColor(cellContext, ColorType.FOCUS));
}
SeaGlassLookAndFeel.updateSubregion(cellContext, g, rowBounds);
cellContext.getPainter().paintTreeCellBackground(cellContext, g, rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height);
cellContext.getPainter().paintTreeCellBorder(cellContext, g, rowBounds.x, rowBounds.y, rowBounds.width, rowBounds.height);
if (editingComponent != null && editingRow == row) {
return;
}
int leadIndex;
if (tree.hasFocus()) {
leadIndex = getLeadSelectionRow();
} else {
leadIndex = -1;
}
Component component = renderer.getTreeCellRendererComponent(tree, path.getLastPathComponent(), selected, isExpanded, isLeaf, row,
(leadIndex == row));
rendererPane.paintComponent(g, component, tree, bounds.x, bounds.y, bounds.width, bounds.height, true);
}