use of javax.swing.tree.DefaultTreeCellRenderer in project CodenameOne by codenameone.
the class PerformanceMonitor method refreshFrameActionPerformed.
// GEN-LAST:event_runGCActionPerformed
private void refreshFrameActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_refreshFrameActionPerformed
componentHierarchy.setModel(new ComponentTreeModel(Display.getInstance().getCurrent()));
componentHierarchy.setCellRenderer(new DefaultTreeCellRenderer() {
@Override
public java.awt.Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
String s = value.toString();
if (value instanceof Component) {
s = ((Component) value).getUIID() + ": " + s;
}
// To change body of generated methods, choose Tools | Templates.
return super.getTreeCellRendererComponent(tree, s, sel, expanded, leaf, row, hasFocus);
}
});
Display.getInstance().callSerially(new Runnable() {
public void run() {
trackDrawing = true;
Display.getInstance().getCurrent().repaint();
Display.getInstance().callSerially(new Runnable() {
public void run() {
// data collected
trackDrawing = false;
renderedItems.setModel(createTableModel());
}
});
}
});
}
use of javax.swing.tree.DefaultTreeCellRenderer in project netbeans-mmd-plugin by raydac.
the class MindMapTreeCellRenderer method getTreeCellRendererComponent.
@Override
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
final DefaultTreeCellRenderer result = (DefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
if (value instanceof Topic) {
result.setIcon(getIconForTopic((Topic) value));
result.setText(extractTextFromTopic((Topic) value));
}
return result;
}
use of javax.swing.tree.DefaultTreeCellRenderer in project netbeans-mmd-plugin by raydac.
the class MindMapTreeCellRenderer method getTreeCellRendererComponent.
@Override
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
final DefaultTreeCellRenderer result = (DefaultTreeCellRenderer) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
if (value instanceof Topic) {
result.setIcon(getIconForTopic((Topic) value));
result.setText(extractTextFromTopic((Topic) value));
}
return result;
}
use of javax.swing.tree.DefaultTreeCellRenderer in project java-swing-tips by aterai.
the class CellTextArea2 method updateUI.
@Override
public void updateUI() {
super.updateUI();
renderer = new DefaultTreeCellRenderer();
}
use of javax.swing.tree.DefaultTreeCellRenderer in project checkstyle by checkstyle.
the class TreeTableCellRenderer method updateUI.
/**
* UpdateUI is overridden to set the colors of the Tree's renderer
* to match that of the table.
*/
@Override
public void updateUI() {
super.updateUI();
// Make the tree's cell renderer use the table's cell selection
// colors.
final TreeCellRenderer tcr = getCellRenderer();
if (tcr instanceof DefaultTreeCellRenderer) {
final DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tcr;
// For 1.1 uncomment this, 1.2 has a bug that will cause an
// exception to be thrown if the border selection color is
// null.
// renderer.setBorderSelectionColor(null);
renderer.setTextSelectionColor(UIManager.getColor("Table.selectionForeground"));
renderer.setBackgroundSelectionColor(UIManager.getColor("Table.selectionBackground"));
}
}
Aggregations