本文整理了Java中javax.swing.JTree.setBackground()
方法的一些代码示例,展示了JTree.setBackground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.setBackground()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:setBackground
暂无
代码示例来源:origin: mucommander/mucommander
public void focusGained(FocusEvent e) {
tree.setBackground(ThemeCache.backgroundColors[ThemeCache.ACTIVE][ThemeCache.NORMAL]);
}
代码示例来源:origin: mucommander/mucommander
public void focusLost(FocusEvent e) {
tree.setBackground(ThemeCache.backgroundColors[ThemeCache.INACTIVE][ThemeCache.NORMAL]);
}
代码示例来源:origin: mucommander/mucommander
public void colorChanged(ColorChangedEvent event) {
if (tree.hasFocus()) {
tree.setBackground(ThemeCache.backgroundColors[ThemeCache.ACTIVE][ThemeCache.NORMAL]);
} else {
tree.setBackground(ThemeCache.backgroundColors[ThemeCache.INACTIVE][ThemeCache.NORMAL]);
}
tree.repaint();
}
代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-explorer
/*******************************************************************************
*
******************************************************************************/
@Override
public void setBackground (final Color color)
{
super.setBackground(color);
if (tree != null)
{
tree.setBackground(color);
tree.putClientProperty("JTree.lineStyle", "None"); // FIXME: move elsewhere
}
}
代码示例来源:origin: stackoverflow.com
private JTree getJTree() {
JTree jTree = new JTree();
jTree.setOpaque(true);
jTree.setBackground(Color.white);
UIDefaults paneDefaults = new UIDefaults();
paneDefaults.put("Tree.selectionBackground",null);
JTextPane pane = new JTextPane();
jTree.putClientProperty("Nimbus.Overrides",paneDefaults);
jTree.putClientProperty("Nimbus.Overrides.InheritDefaults",false);
jTree.setCellRenderer( new LocalRenderer() );
return jTree;
}
代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge
public void valueChanged(TreeSelectionEvent e)
{
JTree tree = (JTree) e.getSource();
tree.getSelectionModel().clearSelection();
if (currentSelection != null)
{
currentSelection.setBackground(white);
((DefaultTreeCellRenderer) currentSelection.getCellRenderer()).setBackgroundNonSelectionColor(white);
}
currentSelection = tree;
currentSelection.setBackground(selectionColor);
((DefaultTreeCellRenderer) currentSelection.getCellRenderer()).setBackgroundNonSelectionColor(selectionColor);
}
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
@Override
public void configurarCores() {
labelVersao.setForeground(ColorController.COR_LETRA_TITULO);
arvoreExemplos.setBackground(ColorController.FUNDO_CLARO);
imagePane.setBackground(ColorController.FUNDO_ESCURO);
description.setForeground(ColorController.COR_LETRA);
scrollArvoreExemplos.setBackground(ColorController.FUNDO_CLARO);
scrollArvoreExemplos.setCorner(JScrollPane.LOWER_RIGHT_CORNER, null);
labelTitulo.setForeground(ColorController.COR_LETRA_TITULO);
labelTitulo.setBackground(ColorController.FUNDO_ESCURO);
textRecentes.setForeground(ColorController.COR_LETRA_TITULO);
textRecentes.setBackground(ColorController.FUNDO_ESCURO);
painelRecentesPrincipal.setBackground(ColorController.FUNDO_ESCURO);
painelRecentesMaster.setBackground(ColorController.FUNDO_ESCURO);
descriptionPanel.setBackground(ColorController.COR_DESTAQUE);
areaLogo.setBackground(ColorController.FUNDO_ESCURO);
painelDireita.setBackground(ColorController.COR_DESTAQUE);
if (WeblafUtils.weblafEstaInstalado()) {
WeblafUtils.configuraWebLaf(jScrollPane1);
WeblafUtils.configuraWebLaf(scrollArvoreExemplos);
WeblafUtils.configuraWebLaf(buscaExemplo.getCampoBusca());
WeblafUtils.configurarBotao(botaoAbrirExemplo, ColorController.AMARELO, ColorController.FUNDO_ESCURO, ColorController.FUNDO_MEDIO, ColorController.COR_LETRA, 10);
}
}
代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge
public void valueChanged(TreeSelectionEvent e)
{
JTree tree = (JTree) e.getSource();
tree.getSelectionModel().clearSelection();
if (currentSelection != null)
{
currentSelection.setBackground(white);
((DefaultTreeCellRenderer) currentSelection.getCellRenderer()).setBackgroundNonSelectionColor(white);
}
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private JScrollPane makeResultPane()
{
_varTree = new JTree( makeEmptyModel() );
_varTree.setBorder( null );
_varTree.setBackground( Scheme.active().getWindow() );
_varTree.setRootVisible( true );
_varTree.setShowsRootHandles( true );
_varTree.setRowHeight( 22 );
_varTree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
_varTree.setVisibleRowCount( 20 );
_varTree.setCellRenderer( new VarTreeCellRenderer( _varTree ) );
return new JScrollPane( _varTree );
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private JComponent makeTreePanel()
{
DefaultTreeModel model = new DefaultTreeModel( makeSettingsTree() );
_tree = new JTree( model );
_tree.setBackground( Scheme.active().getWindow() );
_tree.setRootVisible( false );
_tree.setShowsRootHandles( true );
_tree.setRowHeight( 22 );
_tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
_tree.setVisibleRowCount( 20 );
_tree.setCellRenderer( new SettingsTreeCellRenderer( _tree ) );
_tree.addTreeSelectionListener( new SelectionHandler() );
JScrollPane scroller = new JScrollPane( _tree );
scroller.setBorder( BorderFactory.createEmptyBorder() );
expandAll();
selectMruSettings();
TabPane tabPane = new TabPane( TabPosition.TOP, TabPane.MIN_MAX_REST );
tabPane.addTab( "Settings", null, scroller );
return tabPane;
}
代码示例来源:origin: net.sf.sfac/sfac-core
@Override
protected void synchronizeEditableState() {
if (theTree != null) {
boolean treeEnabled = isEditable() && isEnabled();
theTree.setEnabled(treeEnabled);
theTree.setBackground(treeEnabled ? Color.WHITE : Color.LIGHT_GRAY);
theTree.setForeground(treeEnabled ? Color.BLACK : Color.DARK_GRAY);
theTree.repaint();
}
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private TabPane makeFramePane()
{
_varTree = new JTree( new DefaultTreeModel( new VarTree( null ) ) );
_varTree.setBorder( null );
_varTree.setBackground( Scheme.active().getWindow() );
_varTree.setRootVisible( false );
_varTree.setShowsRootHandles( true );
_varTree.setRowHeight( 22 );
_varTree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
_varTree.setVisibleRowCount( 20 );
_varTree.setCellRenderer( new VarTreeCellRenderer( _varTree ) );
JScrollPane scroller = new JScrollPane( _varTree );
scroller.setBorder( null );
TabPane varTabPane = new TabPane( TabPosition.TOP, TabPane.MIN_MAX_REST );
varTabPane.addTab( "Frame", EditorUtilities.loadIcon( "images/single_frame.png" ), scroller );
ToolContainer toolbar = varTabPane.getToolContainer();
addTools( toolbar.getToolBar() );
return varTabPane;
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private void configUi()
{
_tree = new JTree();
_tree.setModel( new DefaultTreeModel( new MessageTree( _tree ) ) );
_tree.setBackground( Scheme.active().getWindow() );
_tree.setRootVisible( false );
_tree.setShowsRootHandles( true );
_tree.setRowHeight( 22 );
_tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
_tree.setVisibleRowCount( 20 );
_tree.setCellRenderer( new LabTreeCellRenderer( _tree ) );
_tree.addMouseListener( new MouseHandler() );
_tree.addKeyListener( new TreeKeyHandler() );
_scroller = new JScrollPane( _tree );
_scroller.setBorder( new MatteBorder( 0, 1, 1, 1, Scheme.active().getScrollbarBorderColor() ) );
add( _scroller, BorderLayout.CENTER );
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
public void load( Project project )
{
_splitPane.clearTop();
_project = project;
DefaultTreeModel model = new DefaultTreeModel( new FileTree( getProject() ) );
_tree = new JTree( model );
_tree.setBackground( EditorUtilities.WINDOW );
_tree.setShowsRootHandles( true );
_tree.setRowHeight( 22 );
_tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
_tree.setVisibleRowCount( 20 );
_tree.setCellRenderer( new FileTreeCellRenderer( _tree ) );
_tree.addMouseListener( new TreeMouseHandler() );
_tree.addKeyListener( new TreeKeyHankder() );
_scroller = new JScrollPane( _tree );
_scroller.setBorder( new MatteBorder( 0, 0, 1, 1, EditorUtilities.CONTROL_SHADOW ) );
expandToFirstSourcePath( 0, _tree.getRowCount() );
_splitPane.setTop( _scroller );
revalidate();
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private void configUi()
{
_tree = new JTree();
_tree.setModel( new DefaultTreeModel( new SearchTree( _tree ) ) );
_tree.setBackground( Scheme.active().getWindow() );
_tree.setRootVisible( false );
_tree.setShowsRootHandles( true );
_tree.setRowHeight( 22 );
_tree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION );
_tree.setVisibleRowCount( 20 );
_tree.setCellRenderer( new LabTreeCellRenderer( _tree ) );
_tree.addMouseListener( new MouseHandler() );
_tree.addKeyListener( new TreeKeyHandler() );
_tree.addTreeSelectionListener( new TreeSelectionHandler() );
JScrollPane scroller = new JScrollPane( _tree );
scroller.setBorder( new MatteBorder( 0, 1, 1, 1, Scheme.active().getScrollbarBorderColor() ) );
add( scroller, BorderLayout.CENTER );
add( makeToolbar(), BorderLayout.WEST );
addReplaceButtonsPanel();
}
代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-explorer
/*******************************************************************************
*
*
******************************************************************************/
private void initializeTree2()
{
if (!treeInitialized)
{
tree.setOpaque(isOpaque());
tree.setBackground(getBackground());
tree.setForeground(getForeground());
treeInitialized = true;
}
patchRenderer();
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
public void load( Experiment experiment )
{
_splitPane.clearTop();
_experiment = experiment;
DefaultTreeModel model = new DefaultTreeModel( new FileTree( getExperiment() ) );
_tree = new JTree( model );
_tree.setBackground( Scheme.active().getWindow() );
_tree.setShowsRootHandles( true );
_tree.setRowHeight( 22 );
_tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION );
_tree.setVisibleRowCount( 20 );
_tree.setCellRenderer( new FileTreeCellRenderer( _tree ) );
_tree.addMouseListener( new TreeMouseHandler() );
_tree.addKeyListener( new TreeKeyHandler() );
_scroller = new JScrollPane( _tree );
_scroller.setBorder( new MatteBorder( 0, 0, 1, 1, Scheme.active().getScrollbarBorderColor() ) );
//expandToFirstSourcePath( 0, _tree.getRowCount() );
expandFirstPath();
_splitPane.setTop( _scroller );
revalidate();
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-gui-minigui
/**
* Creates the JList used in the popup to display the items in the combo box
* model. This method is called when the UI class is created.
*
* @return a <code>JList</code> used to display the combo box items
*/
protected JTree createTree() {
JTree tree = new JTree(model);
tree.setName("TreePopup.tree");
tree.setFont(getFont());
tree.setForeground(getForeground());
tree.setBackground(getBackground());
tree.setBorder(null);
tree.setFocusable(true);
tree.addMouseListener(handler);
tree.addKeyListener(handler);
tree.setCellRenderer(new Renderer());
return tree;
}
代码示例来源:origin: elki-project/elki
/**
* Creates the JList used in the popup to display the items in the combo box
* model. This method is called when the UI class is created.
*
* @return a <code>JList</code> used to display the combo box items
*/
protected JTree createTree() {
JTree tree = new JTree(model);
tree.setName("TreePopup.tree");
tree.setFont(getFont());
tree.setForeground(getForeground());
tree.setBackground(getBackground());
tree.setBorder(null);
tree.setFocusable(true);
tree.addMouseListener(handler);
tree.addKeyListener(handler);
tree.setCellRenderer(new Renderer());
return tree;
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
/**
* Creates the JList used in the popup to display the items in the combo box
* model. This method is called when the UI class is created.
*
* @return a <code>JList</code> used to display the combo box items
*/
protected JTree createTree() {
JTree tree = new JTree(model);
tree.setName("TreePopup.tree");
tree.setFont(getFont());
tree.setForeground(getForeground());
tree.setBackground(getBackground());
tree.setBorder(null);
tree.setFocusable(true);
tree.addMouseListener(handler);
tree.addKeyListener(handler);
tree.setCellRenderer(new Renderer());
return tree;
}
内容来源于网络,如有侵权,请联系作者删除!