org.jdesktop.swingx.JXTree Java Examples

The following examples show how to use org.jdesktop.swingx.JXTree. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DesktopTreeTable.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
protected void applyFont(JTable table, Font font) {
    JXTreeTable treeTable = (JXTreeTable) table;
    if (treeTable.getModel() != null && impl != null) {
        int hierarchicalColumn = treeTable.getHierarchicalColumn();
        TableCellRenderer cellRenderer = treeTable.getCellRenderer(0, hierarchicalColumn);
        if (cellRenderer instanceof DesktopAbstractTable.StylingCellRenderer) {
            cellRenderer = ((DesktopAbstractTable.StylingCellRenderer) cellRenderer).getDelegate();
        }
        if (cellRenderer instanceof JXTree) {
            // default JXTreeTable renderer for hierarchical column is JXTree
            ((JXTree) cellRenderer).setFont(font);
        }
    }
    super.applyFont(table, font);
}
 
Example #2
Source File: ProtocolTab.java    From aion-germany with GNU General Public License v3.0 4 votes vote down vote up
public ProtocolTab() {
	setLayout(new GridLayout(1, 2));

	_scrollPanePacketFormat = new JScrollPane(createTreeTable(null));

	_protocolTree = new JXTree();
	_protocolTree.setCellRenderer(new PacketTreeRenderer());
	_protocolTree.getSelectionModel().addTreeSelectionListener(
		new ProtocolTreeSelectionListener(_scrollPanePacketFormat));

	JScrollPane scrollPaneProtocolTree = new JScrollPane(_protocolTree);

	Container partsContainer = new Container();
	GridBagConstraints partsCons = new GridBagConstraints();
	GridBagLayout partsLayout = new GridBagLayout();
	partsContainer.setLayout(partsLayout);

	Container packetsContainer = new Container();
	GridBagConstraints packetsCons = new GridBagConstraints();
	GridBagLayout packetsLayout = new GridBagLayout();
	packetsContainer.setLayout(packetsLayout);

	Container partsToolBar = new Container();
	Container packetsToolBar = new Container();

	_partTypeCombo = new JComboBox<Object>(IconComboBoxRenderer.types);
	_partTypeCombo.setRenderer(new IconComboBoxRenderer());
	JButton addPartButton = new JButton(IconsTable.ICON_PLUS);
	addPartButton.addActionListener(new PacketEditorActionListener());
	addPartButton.setActionCommand("+");
	JButton removePartButton = new JButton(IconsTable.ICON_MINUS);
	removePartButton.addActionListener(new PacketEditorActionListener());
	removePartButton.setActionCommand("-");
	partsToolBar.add(_partTypeCombo);
	partsToolBar.add(addPartButton);
	partsToolBar.add(removePartButton);
	FlowLayout partsFlowLayout = new FlowLayout();
	partsFlowLayout.setAlignment(FlowLayout.CENTER);
	partsToolBar.setLayout(partsFlowLayout);

	JButton addPacketButton = new JButton(IconsTable.ICON_PLUS);
	addPacketButton.addActionListener(new PacketEditorActionListener());
	addPacketButton.setActionCommand("+p");
	JButton removePacketButton = new JButton(IconsTable.ICON_MINUS);
	removePacketButton.addActionListener(new PacketEditorActionListener());
	removePacketButton.setActionCommand("-p");
	packetsToolBar.add(addPacketButton);
	packetsToolBar.add(removePacketButton);
	FlowLayout packetsFlowLayout = new FlowLayout();
	packetsFlowLayout.setAlignment(FlowLayout.CENTER);
	packetsToolBar.setLayout(packetsFlowLayout);

	packetsCons.weightx = 0.5;
	packetsCons.fill = GridBagConstraints.BOTH;
	packetsCons.gridy = 0;
	packetsCons.gridx = 0;
	packetsContainer.add(packetsToolBar, packetsCons);
	packetsCons.gridy = 1;
	packetsCons.weighty = 0.5;
	packetsContainer.add(scrollPaneProtocolTree, packetsCons);

	partsCons.weightx = 0.5;
	partsCons.fill = GridBagConstraints.BOTH;
	partsCons.gridy = 0;
	partsCons.gridx = 0;
	partsContainer.add(partsToolBar, partsCons);
	partsCons.gridy = 1;
	partsCons.weighty = 0.5;
	partsContainer.add(_scrollPanePacketFormat, partsCons);

	add(packetsContainer);
	add(partsContainer);
}
 
Example #3
Source File: StructurePanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
public JXTree getStructureTree() {
    return structureTree;
}