javax.swing.JTree.setBorder()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中javax.swing.JTree.setBorder()方法的一些代码示例,展示了JTree.setBorder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.setBorder()方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:setBorder

JTree.setBorder介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public static void main(String[] args) {

  JTree tree = new JTree();
  tree.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

  JFrame frame = new JFrame("Test");
  frame.add(new JScrollPane(tree));
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.pack();
  frame.setVisible(true);
}

代码示例来源:origin: ron190/jsql-injection

this.tree.setBorder(BorderFactory.createEmptyBorder(0, 0, LightScrollPane.THUMB_SIZE, 0));
LightScrollPane scroller = new LightScrollPane(1, 0, 0, 0, this.tree);

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

private void initializeJTree()
{
 DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("<html><body style=\"font-weight:bold;font-size:1.1em;\">Empty: "
                    + "</body></html>");
 rootNode.add(new DefaultMutableTreeNode("GZ Sim:"));
 rootNode.add(new DefaultMutableTreeNode("SCS Controller:"));
 currentSelection = new JTree(rootNode);
 currentSelection.setBorder(BorderFactory.createEmptyBorder(15, 10, 15, 0));
 
 setCloudStatusItemIcon(currentSelection, null);
 
 ((JPanel) scrollPane.getViewport().getView()).add(currentSelection);
 this.revalidate();
}

代码示例来源:origin: org.geotools/gt2-widgets-swing

/**
 * Constructs a new browser for the tree.
 *
 * @param model The tree model built from the rendering chain to browse.
 */
private OperationTreeBrowser(final TreeModel model) {
  super(new BorderLayout());
  final Listeners listeners = new Listeners();
  final JTree tree = new JTree(model);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  tree.setCellRenderer(new CellRenderer());
  tree.setBorder(BorderFactory.createEmptyBorder(6,6,0,0));
  tree.addTreeSelectionListener(listeners);
  final JSplitPane split;
  split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(tree), cards);
  split.setDividerLocation(220);
  add(split, BorderLayout.CENTER);
  setPreferredSize(new Dimension(600,250));
}

代码示例来源:origin: cytoscape.corelibs/task

/**
 * Creates Center Panel with Error Details.
 *
 * @return JScrollPane Object.
 */
private JScrollPane createCenterPanel() {
  detailsPane = new JScrollPane();
  if ( t != null ) {
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Root Error");
    processThrowable(t,top);
    //  Create a JTree Object
    JTree tree = new JTree(top);
    //  Open all Nodes
    tree.scrollPathToVisible(new TreePath(top.getPath()));
    tree.setBorder(new EmptyBorder(4, 10, 10, 10));
    detailsPane.setViewportView(tree);
    detailsPane.setPreferredSize(new Dimension(10, 150));
  }
  //  By default, do not show
  detailsPane.setVisible(false);
  return detailsPane;
}

代码示例来源:origin: org.apache.uima/uimaj-tools

/**
 * Inits the IR tree.
 */
private void initIRTree() {
 DefaultMutableTreeNode root = new DefaultMutableTreeNode(noIndexReposLabel);
 DefaultTreeModel model = new DefaultTreeModel(root);
 this.indexTree = new JTree(model);
 this.indexTree.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 2));
 // Only one node can be selected at any one time.
 this.indexTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 this.indexTree.addTreeSelectionListener(new IndexTreeSelectionListener(this));
 // No icons.
 DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer();
 cellRenderer.setLeafIcon(null);
 // cellRenderer.setIcon(null);
 cellRenderer.setClosedIcon(null);
 cellRenderer.setOpenIcon(null);
 this.indexTree.setCellRenderer(cellRenderer);
}

代码示例来源:origin: org.geotools/gt2-widgets-swing

super(new BorderLayout());
final JTree tree = new JTree(model);
tree.setBorder(BorderFactory.createEmptyBorder(6, 6, 0, 0));
add(new JScrollPane(tree), BorderLayout.CENTER);

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

rootNode.add(new DefaultMutableTreeNode("SCS Controller:"));
currentSelection = new JTree(rootNode);
currentSelection.setBorder(BorderFactory.createEmptyBorder(15, 10, 15, 0));

代码示例来源:origin: aterai/java-swing-tips

tree.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
add(new JScrollPane(tree));
setPreferredSize(new Dimension(320, 240));

代码示例来源: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: nz.ac.waikato.cms.weka.thirdparty/bounce

tree.setBorder( new EmptyBorder( 2, 0, 2, 0));
tree.setRootVisible( false);
tree.setShowsRootHandles( true);

代码示例来源:origin: org.apache.uima/uimaj-tools

/**
 * Inits the FS tree.
 */
private void initFSTree() {
 FSTreeModel treeModel = new FSTreeModel();
 this.fsTree = new JTree(treeModel);
 this.fsTree.addMouseListener(new StringFsPopupEventAdapter());
 this.fsTree.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 2));
 this.fsTree.setLargeModel(true);
 // Only one node can be selected at any one time.
 this.fsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 this.fsTree.addTreeSelectionListener(new FSTreeSelectionListener(this));
 DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer();
 cellRenderer.setLeafIcon(null);
 // cellRenderer.setIcon(null);
 cellRenderer.setClosedIcon(null);
 cellRenderer.setOpenIcon(null);
 this.fsTree.setCellRenderer(cellRenderer);
}

代码示例来源:origin: us.ihmc/DarpaRoboticsChallenge

rootNode.add(new DefaultMutableTreeNode("SCS Controller:"));
JTree tree = new JTree(rootNode);
tree.setBorder(BorderFactory.createEmptyBorder(15, 10, 15, 0));

代码示例来源:origin: sdedit/sdedit

navigator.setBorder(emptyBorder1);
navigator.setCellRenderer(this);
navigator.setModel(navigatorModel);

代码示例来源:origin: robward-scisys/sldeditor

symbolTree = new JTree(treeModel);
symbolTree.setEditable(true);
symbolTree.setBorder(new LineBorder(Color.black));
ComponentCellRenderer cellRenderer =
    new ComponentCellRenderer(symbolTree.getCellRenderer());

代码示例来源: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.codehaus.izpack/izpack-panel

checkTreeController = new CheckTreeController(this);
tree.addMouseListener(checkTreeController);
tree.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
tree.setBackground(Color.white);
tree.setToggleClickCount(0);

代码示例来源: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-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: 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;
}

相关文章

JTree类方法