[Japi-cvs] SF.net SVN: japi: [385] tools/fontbrowser/trunk
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2007-06-09 18:30:56
|
Revision: 385 http://svn.sourceforge.net/japi/?rev=385&view=rev Author: christianhujer Date: 2007-06-09 11:30:55 -0700 (Sat, 09 Jun 2007) Log Message: ----------- Added fontbrowser implementation. Modified Paths: -------------- tools/fontbrowser/trunk/fontbrowser.iml Added Paths: ----------- tools/fontbrowser/trunk/src/ tools/fontbrowser/trunk/src/net/ tools/fontbrowser/trunk/src/net/sf/ tools/fontbrowser/trunk/src/net/sf/japi/ tools/fontbrowser/trunk/src/net/sf/japi/tools/ tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/ tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/FontBrowser.java tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/action.properties Modified: tools/fontbrowser/trunk/fontbrowser.iml =================================================================== --- tools/fontbrowser/trunk/fontbrowser.iml 2007-06-09 18:30:22 UTC (rev 384) +++ tools/fontbrowser/trunk/fontbrowser.iml 2007-06-09 18:30:55 UTC (rev 385) @@ -26,11 +26,12 @@ <SOURCES /> </library> </orderEntry> + <orderEntry type="module" module-name="libs-swing-action" /> <orderEntryProperties /> </component> <component name="copyright"> <Base> - <setting name="state" value="1" /> + <setting name="state" value="0" /> </Base> <LanguageOptions name="$TEMPLATE$"> <option name="templateOptions"> @@ -45,7 +46,7 @@ <option name="filler" value=" " /> </value> </option> - <option name="notice" value="Copyright (c) &#36;today.year, Your Corporation. All Rights Reserved." /> + <option name="notice" value="FontBrowser is a tool for showing all available fonts in Java. Copyright (C) &#36;today.year Christian Hujer This program 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 2 of the License, or (at your option) any later version. This program 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." /> <option name="keyword" value="Copyright" /> <option name="fileTypeOverride" value="4" /> <option name="relativeBefore" value="true" /> Added: tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/FontBrowser.java =================================================================== --- tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/FontBrowser.java (rev 0) +++ tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/FontBrowser.java 2007-06-09 18:30:55 UTC (rev 385) @@ -0,0 +1,72 @@ +/* + * FontBrowser is a tool for showing all available fonts in Java. + * Copyright (C) 2007 Christian Hujer + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.japi.tools.fontbrowser; + +import java.awt.Component; +import java.awt.GraphicsEnvironment; +import javax.swing.JFrame; +import javax.swing.JList; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE; +import net.sf.japi.swing.ActionFactory; + +/** A Font Browser. */ +public class FontBrowser { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.tools.fontbrowser"); + + /** Main program. + * @param args command line arguments + */ + public static void main(final String... args) { + //noinspection ResultOfObjectAllocationIgnored + new FontBrowser(); + } + + /** Create a font browser. */ + public FontBrowser() { + final JFrame frame = new JFrame(ACTION_FACTORY.getString("frame.title")); + final JTabbedPane tabs = new JTabbedPane(); + frame.add(tabs); + tabs.add(ACTION_FACTORY.getString("names.title"), createNamesTab()); + tabs.add(ACTION_FACTORY.getString("fonts.title"), createFontsTab()); + frame.pack(); + frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE); + frame.setVisible(true); + } + + /** Create the tab component for font names. + * @return The tab component for font names. + */ + private static Component createNamesTab() { + return new JScrollPane(new JList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames())); + } + + /** Create the tab component for fonts. + * @return The tab component for fonts. + */ + private static Component createFontsTab() { + final JList fontList = new JList(GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()); + return new JScrollPane(fontList); + } + +} // class FontBrowser Property changes on: tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/FontBrowser.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/action.properties =================================================================== --- tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/action.properties (rev 0) +++ tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/action.properties 2007-06-09 18:30:55 UTC (rev 385) @@ -0,0 +1,22 @@ +# +# FontBrowser is a tool for showing all available fonts in Java. +# Copyright (C) 2007 Christian Hujer +# +# This program 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 2 of the License, or +# (at your option) any later version. +# +# This program 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, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + +frame.title=Font Browser +names.title=Font Names +fonts.title=Fonts Property changes on: tools/fontbrowser/trunk/src/net/sf/japi/tools/fontbrowser/action.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |