Here you can find the source of ApplyFilter(DefaultMutableTreeNode node, String filter)
public static void ApplyFilter(DefaultMutableTreeNode node, String filter)
//package com.java2s; /**//from ww w. jav a 2 s. c o m * CEDP: Computer Evaluator for Dependability and Performance * This file is distributed under the University of Illinois Open Source * License. See LICENSE.TXT for details. */ import javax.swing.tree.DefaultMutableTreeNode; public class Main { public static void ApplyFilter(DefaultMutableTreeNode node, String filter) { if (node.getChildCount() == 0) { if (!node.toString().endsWith(filter)) { node.removeFromParent(); } return; } for (int i = 0; i < node.getChildCount(); i++) { ApplyFilter((DefaultMutableTreeNode) node.getChildAt(i), filter); } } }