From: <ton...@us...> - 2008-03-09 02:16:08
|
Revision: 696 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=696&view=rev Author: tonytacker Date: 2008-03-08 18:16:01 -0800 (Sat, 08 Mar 2008) Log Message: ----------- add an example tree in new window for tests Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-08 05:23:20 UTC (rev 695) +++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2008-03-09 02:16:01 UTC (rev 696) @@ -36,7 +36,7 @@ private static final long serialVersionUID = 1643304576470046636L; - private JButton runButton, stopButton; + private JButton runButton, stopButton, treeButton; private JTextArea infoArea; private Config config; @@ -67,11 +67,13 @@ runButton = new JButton("Run"); runButton.addActionListener(this); + showPanel.add(runButton); stopButton = new JButton("Stop"); stopButton.addActionListener(this); - - showPanel.add(runButton); showPanel.add(stopButton); + treeButton = new JButton("Tree"); + treeButton.addActionListener(this); + showPanel.add(treeButton); infoPanel.setLayout(gridbag); constraints.anchor = GridBagConstraints.WEST; @@ -149,6 +151,10 @@ if (e.getSource() == stopButton && config.getLearningAlgorithm() != null) { thread.exit(); } + // tree + if (e.getSource() == treeButton) { + TreeWindow a = new TreeWindow(config); + } } /** Added: trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java 2008-03-09 02:16:01 UTC (rev 696) @@ -0,0 +1,65 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import javax.swing.*; +import javax.swing.tree.*; + +/** + * TreeWindow + * + * @author Tilo Hielscher + */ +public class TreeWindow extends JFrame { + + private static final long serialVersionUID = -5807192061389763835L; + + @SuppressWarnings("unused") + private Config config; + + public TreeWindow(Config config) { + this.config = config; + this.setTitle("DL-Learner Tree"); + this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); + this.setLocationByPlatform(true); + this.setSize(300, 400); + + // set icon + setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage( + this.getClass().getResource("icon.gif"))); + + // tree + DefaultMutableTreeNode root = new DefaultMutableTreeNode( "root" ); + for ( int knot = 0; knot < 4; knot++ ) + { + DefaultMutableTreeNode node = new DefaultMutableTreeNode( "knot " + knot ); + root.add( node ); + for ( int leaf = 1; leaf < 4; leaf++ ) + node.add( new DefaultMutableTreeNode("leaf " + (knot*3+leaf )) ); + } + JTree tree = new JTree( root ); + this.add( new JScrollPane( tree ) ); + + this.setVisible(true); + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |