From: <jen...@us...> - 2008-09-08 12:37:31
|
Revision: 1174 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1174&view=rev Author: jenslehmann Date: 2008-09-08 12:37:27 +0000 (Mon, 08 Sep 2008) Log Message: ----------- "about" and "quick tutorial" GUI windows Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java Modified: trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java 2008-09-08 11:45:09 UTC (rev 1173) +++ trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java 2008-09-08 12:37:27 UTC (rev 1174) @@ -1,12 +1,25 @@ package org.dllearner.gui; +import java.net.URL; + +import javax.swing.ImageIcon; import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JScrollPane; +import javax.swing.JTextPane; +import javax.swing.text.BadLocationException; +import javax.swing.text.Style; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyleContext; +import javax.swing.text.StyledDocument; +import org.dllearner.Info; + /** * Window displaying some information about DL-Learner and DL-Learner GUI. * * @author Jens Lehmann - * + * */ public class AboutWindow extends JFrame { @@ -14,19 +27,112 @@ public AboutWindow() { setTitle("About"); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setLocationByPlatform(true); - setSize(300, 300); + setSize(400, 400); + + URL imgURL = AboutWindow.class.getResource("dl-learner.gif"); - // display icon + String html = "<html><p align=\"center\"><img src=\""+imgURL+"\" alt=\"DL-Learner logo\"/></p>"; + html += "<p align=\"center\"><i>DL-Learner</i><br />Build " + Info.build + "</p>"; + html += "<br /><p align=\"center\"><i>License</i><br />GNU General Public License Version 3</p>"; + html += "<br /><p align=\"center\"><i>Homepage</i><br /><a href=\"http://dl-learner.org\">http://dl-learner.org</a></p>"; + html += "<br /><p align=\"center\"><i>DL-Learner GUI developers</i><br />"; + html += "Jens Lehmann<br />Tilo Hielscher</p>"; + html += "<br /><p align=\"center\"><i>DL-Learner contributors in general</i><br />"; + html += "Jens Lehmann<br />"; + html += " Sebastian Hellmann (SPARQL component and more)<br />"; + html += "Sebastian Knappe (DBpedia Navigator)<br />"; + html += "Tilo Hielscher (DL-Learner GUI)<br />"; + html += "Lorenz Bühmann (ORE Tool)<br />"; + html += "Maria Moritz, Vu Duc Minh (OntoWiki plugin)<br />"; + html += "Christian Kötteritzsch (Protégé 4 plugin)<br />"; + html += "Collette Hagert (DB to OWL converter)</p>"; + html += "</html>"; - // display build version + JLabel label = new JLabel(html); +// label.setFont(new Font("Serif", Font.PLAIN, 14)); - // display authors of GUI + add(label); - // display DL-Learner contributors - +// SimpleAttributeSet bold = new SimpleAttributeSet(); +// StyleConstants.setBold(bold, true); +// StyleConstants.setAlignment(bold, StyleConstants.ALIGN_CENTER); +// +// JTextPane textPane = new JTextPane(); +// StyledDocument doc = textPane.getStyledDocument(); +// +// +// textPane.setText("DL-Learner"); +// doc.setParagraphAttributes(0, doc.getLength(), bold, false); +// add(textPane); +// +// + + // Put the editor pane in a scroll pane. +// JTextPane textPane = createTextPane(); + JScrollPane editorScrollPane = new JScrollPane(label); + editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); +// editorScrollPane.setPreferredSize(new Dimension(250, 145)); +// editorScrollPane.setMinimumSize(new Dimension(10, 10)); + + add(editorScrollPane); + setVisible(true); } + + @SuppressWarnings("unused") + private JTextPane createTextPane() { + String[] initString = { " ", "DL-Learner ", "Build " + Info.build, + "DL-Learner GUI developers:", "Jens Lehmann\nTilo Hielscher\n" }; + + String[] initStyles = { "icon", "bold", "regular", "italic", "regular" }; + + JTextPane textPane = new JTextPane(); +// textPane.setSize(300, 200); + textPane.setEditable(false); + StyledDocument doc = textPane.getStyledDocument(); + addStylesToDocument(doc); + + try { + for (int i = 0; i < initString.length; i++) { + doc.insertString(doc.getLength(), initString[i] + "\n", doc.getStyle(initStyles[i])); + } + } catch (BadLocationException ble) { + System.err.println("Couldn't insert initial text into text pane."); + } + + return textPane; + } + + protected void addStylesToDocument(StyledDocument doc) { + Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); + + Style regular = doc.addStyle("regular", def); +// StyleConstants.setFontFamily(def, "SansSerif"); + + Style s = doc.addStyle("italic", regular); + StyleConstants.setItalic(s, true); + + s = doc.addStyle("bold", regular); + StyleConstants.setAlignment(s, StyleConstants.ALIGN_RIGHT); + StyleConstants.setBold(s, true); + + s = doc.addStyle("icon", regular); + StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER); + ImageIcon pigIcon = createImageIcon("dl-learner.gif", "DL-Learner logo"); + StyleConstants.setIcon(s, pigIcon); + } + + protected static ImageIcon createImageIcon(String path, String description) { + URL imgURL = AboutWindow.class.getResource(path); + if (imgURL != null) { + return new ImageIcon(imgURL, description); + } else { + System.err.println("Couldn't find file: " + path); + return null; + } + } + } Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-08 11:45:09 UTC (rev 1173) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-08 12:37:27 UTC (rev 1174) @@ -66,7 +66,7 @@ private JMenuItem exitItem = new JMenuItem("Exit"); private JMenu menuHelp = new JMenu("Help"); private JMenuItem aboutItem = new JMenuItem("About"); - private JMenuItem tutorialItem = new JMenuItem("Tutorial"); + private JMenuItem tutorialItem = new JMenuItem("Quick Tutorial"); public StartGUI() { this(null); @@ -153,6 +153,22 @@ if (args.length > 0) file = new File(args[args.length - 1]); + // force platform look and feel + try { + UIManager.setLookAndFeel( +// "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + UIManager.getSystemLookAndFeelClassName()); + // TODO: currently everything is in bold on Linux (and Win?) + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (InstantiationException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (UnsupportedLookAndFeelException e) { + e.printStackTrace(); + } + new StartGUI(file); } Modified: trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-08 11:45:09 UTC (rev 1173) +++ trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-08 12:37:27 UTC (rev 1174) @@ -1,6 +1,26 @@ +/** + * 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/>. + * + */ package org.dllearner.gui; import javax.swing.JFrame; +import javax.swing.JLabel; /** * Window displaying a tutorial for the DL-Learner GUI. @@ -14,11 +34,28 @@ public TutorialWindow() { setTitle("Quick Tutorial"); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setLocationByPlatform(true); setSize(300, 500); // display tutorial text + String text = "<html><h2>Quick Tutorial</h2><p align=\"justify\">DL-Learner has a component" + + " based design to make it easier to extend and use. There are four " + + "components corresponding to the tabs you see: knowledge source, " + + "reasoner, learning problem, and learning algorithm. There are various " + + "components available of each type (selectable at the top of each tab). " + + "Each component has configuration options associated with it (middle of the" + + " tab, scrollable), which you can use to specify the settings for the component.</p>" + + "<br /><p align=\"justify\">In order to create a learning problem, " + + "you have to choose and configure all four types of components." + + " The run tab plays a special role: It is used to start the learning algorithm" + + " and display statistical information.</p>" + + "<br /><p><i>Further references:</i><br />" + + "Homepage: <a href=\"http://dl-learner.org\">http://dl-learner.org</a><br />" + + "DL-Learner Architecture: <a href=\"http://dl-learner.org/wiki/Architecture\">http://dl-learner.org/wiki/Architecture</a>" + + "</p><br /><p>Please send questions to le...@in....</p></html>"; + JLabel label = new JLabel(text); + add(label); setVisible(true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |