aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/examples
diff options
context:
space:
mode:
authorMatthias Klose <doko@gcc.gnu.org>2007-06-03 23:18:43 +0000
committerMatthias Klose <doko@gcc.gnu.org>2007-06-03 23:18:43 +0000
commite1bea0c0687c5f4551b3a6058ec37ce3705fa6cc (patch)
treea9c9e7d91c484d53fe154f9285fc57325572ce50 /libjava/classpath/examples
parentaf333b9a7f9e1cc1029bec56d48f2de63acdf686 (diff)
downloadgcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.zip
gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.gz
gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.bz2
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com> * javax/management/NotificationBroadcasterSupport.java (getNotificationInfo): Add cast. * native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include directories. * native/jni/qt-peer/Makefile.in: Regenerate. libjava/ChangeLog: 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/natFileWin32.cc (setFilePermissions): New (stub only). _access: Handle EXEC query, stub only. 2007-06-03 Matthias Klose <doko@ubuntu.com> Merged from classpath: * gnu/java/nio/SelectorProviderImpl.java: Whitespace merge. * java/lang/System.java(inheritedChannel): New. * java/lang/Character.java: Remove stray`;'. * java/net/MulticastSocket.java: Merged. * java/text/DateFormatSymbols.java(getInstance): New, comment updates. * java/text/Collator.java(getInstance): Merged. * java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG. getDisplayName, getDisplayNames: New. * java/util/logging/Logger.java: Merged. * Regenerate .class and .h files. 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/File.java: Merge with classpath-0.95, new method setFilePermissions, new attribute EXEC. * java/io/natFilePosix.cc (setFilePermissions): New. _access: Handle EXEC query. * classpath/lib/java/io/File.class, java/io/File.h: Regenerate. 2007-06-03 Matthias Klose <doko@ubuntu.com> Imported GNU Classpath 0.95. * classpath/Makefile.in, classpath/native/jni/midi-dssi/Makefile.in, classpath/native/jni/classpath/Makefile.in, classpath/native/jni/Makefile.in, classpath/native/jni/gconf-peer/Makefile.in, classpath/native/jni/java-io/Makefile.in, classpath/native/jni/native-lib/Makefile.in, classpath/native/jni/java-util/Makefile.in, classpath/native/jni/midi-alsa/Makefile.in, classpath/native/jni/java-lang/Makefile.in, classpath/native/jni/java-nio/Makefile.in, classpath/native/jni/java-net/Makefile.in, classpath/native/jni/xmlj/Makefile.in, classpath/native/jni/qt-peer/Makefile.in, classpath/native/jni/gtk-peer/Makefile.in, classpath/native/Makefile.in, classpath/native/jawt/Makefile.in, classpath/native/fdlibm/Makefile.in, classpath/native/plugin/Makefile.in, classpath/resource/Makefile.in, classpath/scripts/Makefile.in, classpath/tools/Makefile.in, classpath/doc/Makefile.in, classpath/doc/api/Makefile.in, classpath/lib/Makefile.in, classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in, classpath/external/sax/Makefile.in, classpath/external/w3c_dom/Makefile.in, classpath/external/relaxngDatatype/Makefile.in, classpath/include/Makefile.in, classpath/examples/Makefile.in: Regenerate. * classpath/config.guess, classpath/config.sub, classpath/ltmain.sh : Update. * classpath/configure, classpath/depcomp, classpath/missing, classpath/aclocal.m4, classpath/install-sh: Regenerate. * gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95. * sources.am: Regenerate. * Makefile.in: Regenerate. * Update the .class files and generated CNI header files, add new .class and generated CNI header files. * Remove generated files for removed java source files: classpath/gnu/java/net/BASE64.java, classpath/gnu/java/security/util/Base64.java, classpath/gnu/java/awt/peer/gtk/GThreadMutex.java, classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java, classpath/gnu/java/awt/font/autofit/Scaler.java, classpath/gnu/classpath/jdwp/util/Value.java, classpath/gnu/javax/net/ssl/Base64.java. * Remove empty directories. * Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc. * java/lang/Class.java(setAccessible): Merge from classpath. * java/util/Locale.java: Remove. * gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java, gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New. * gcj/javaprims.h: Update class declarations. * scripts/classes.pl: Update usage. * HACKING: Mention to build all peers. From-SVN: r125302
Diffstat (limited to 'libjava/classpath/examples')
-rw-r--r--libjava/classpath/examples/Makefile.am11
-rw-r--r--libjava/classpath/examples/Makefile.in38
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java4
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/awt/HintingDemo.java377
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/icons/aicas.png (renamed from libjava/classpath/examples/gnu/classpath/examples/awt/aicas.png)bin2320 -> 2320 bytes
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/icons/palme.gif (renamed from libjava/classpath/examples/gnu/classpath/examples/awt/palme.gif)bin502 -> 502 bytes
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java4
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/java2d/aicas.pngbin2320 -> 0 bytes
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/java2d/palme.gifbin502 -> 0 bytes
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java1
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch19
-rw-r--r--libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java2
12 files changed, 417 insertions, 39 deletions
diff --git a/libjava/classpath/examples/Makefile.am b/libjava/classpath/examples/Makefile.am
index 6940bdf..8d619e1 100644
--- a/libjava/classpath/examples/Makefile.am
+++ b/libjava/classpath/examples/Makefile.am
@@ -8,17 +8,17 @@ GLIBJ_CLASSPATH='$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip':'$(top_bui
#if FOUND_JIKES
#JCOMPILER = $(JIKES) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(top_builddir)/lib:.
#else
-if FOUND_GCJX
-JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
-else
if FOUND_ECJ
-JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
+JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -warn:-deprecation,serial,typeHiding,unchecked,unused,varargsCast -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
+else
+if FOUND_JAVAC
+JCOMPILER = $(JAVAC) -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
else
error dunno how to setup the JCOMPILER and compile
-endif
#endif
#endif
endif
+endif
# All our example java source files
EXAMPLE_JAVA_FILES = $(srcdir)/gnu/classpath/examples/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*.java $(srcdir)/gnu/classpath/examples/*/*/*/*.java
@@ -35,6 +35,7 @@ BUILT_SOURCES = $(EXAMPLE_ZIP)
# the png icons we use in some of the examples.
EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
+EXAMPLE_ICONS += $(srcdir)/gnu/classpath/examples/icons/*.gif
# the html pages we use in the swing demo example.
EXAMPLE_HTML = $(srcdir)/gnu/classpath/examples/swing/*.html
diff --git a/libjava/classpath/examples/Makefile.in b/libjava/classpath/examples/Makefile.in
index 014386b..731671c 100644
--- a/libjava/classpath/examples/Makefile.in
+++ b/libjava/classpath/examples/Makefile.in
@@ -45,16 +45,21 @@ am__aclocal_m4_deps = $(top_srcdir)/../../config/depstand.m4 \
$(top_srcdir)/../../config/lead-dot.m4 \
$(top_srcdir)/../../config/multi.m4 \
$(top_srcdir)/../../config/no-executables.m4 \
- $(top_srcdir)/../../libtool.m4 $(top_srcdir)/m4/acattribute.m4 \
- $(top_srcdir)/m4/accross.m4 $(top_srcdir)/m4/acinclude.m4 \
+ $(top_srcdir)/../../libtool.m4 \
+ $(top_srcdir)/../../ltoptions.m4 \
+ $(top_srcdir)/../../ltsugar.m4 \
+ $(top_srcdir)/../../ltversion.m4 \
+ $(top_srcdir)/m4/acattribute.m4 $(top_srcdir)/m4/accross.m4 \
+ $(top_srcdir)/m4/acinclude.m4 \
$(top_srcdir)/m4/ax_create_stdint_h.m4 \
+ $(top_srcdir)/m4/ax_func_which_gethostbyname_r.m4 \
$(top_srcdir)/m4/gcc_attribute.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = Makefile.jawt Makefile.java2d
SOURCES =
@@ -73,12 +78,15 @@ ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
+AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_CLASS_FILES_FALSE = @BUILD_CLASS_FILES_FALSE@
BUILD_CLASS_FILES_TRUE = @BUILD_CLASS_FILES_TRUE@
+CAIRO_CFLAGS = @CAIRO_CFLAGS@
+CAIRO_LIBS = @CAIRO_LIBS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -124,6 +132,7 @@ DATE = @DATE@
DEFAULT_PREFS_PEER = @DEFAULT_PREFS_PEER@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
@@ -136,15 +145,16 @@ ERROR_CFLAGS = @ERROR_CFLAGS@
EXAMPLESDIR = @EXAMPLESDIR@
EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
+FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
-FOUND_GCJX_FALSE = @FOUND_GCJX_FALSE@
-FOUND_GCJX_TRUE = @FOUND_GCJX_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
FOUND_GCJ_TRUE = @FOUND_GCJ_TRUE@
+FOUND_JAVAC_FALSE = @FOUND_JAVAC_FALSE@
+FOUND_JAVAC_TRUE = @FOUND_JAVAC_TRUE@
FOUND_JIKES_FALSE = @FOUND_JIKES_FALSE@
FOUND_JIKES_TRUE = @FOUND_JIKES_TRUE@
FOUND_KJC_FALSE = @FOUND_KJC_FALSE@
@@ -152,7 +162,6 @@ FOUND_KJC_TRUE = @FOUND_KJC_TRUE@
FREETYPE2_CFLAGS = @FREETYPE2_CFLAGS@
FREETYPE2_LIBS = @FREETYPE2_LIBS@
GCJ = @GCJ@
-GCJX = @GCJX@
GCONF_CFLAGS = @GCONF_CFLAGS@
GCONF_LIBS = @GCONF_LIBS@
GDK_CFLAGS = @GDK_CFLAGS@
@@ -162,6 +171,7 @@ GENINSRC_TRUE = @GENINSRC_TRUE@
GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
+GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@@ -173,6 +183,7 @@ INSTALL_GLIBJ_ZIP_TRUE = @INSTALL_GLIBJ_ZIP_TRUE@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+JAVAC = @JAVAC@
JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION = @JAVA_LANG_SYSTEM_EXPLICIT_INITIALIZATION@
JAVA_MAINTAINER_MODE_FALSE = @JAVA_MAINTAINER_MODE_FALSE@
JAVA_MAINTAINER_MODE_TRUE = @JAVA_MAINTAINER_MODE_TRUE@
@@ -182,6 +193,7 @@ JIKES = @JIKES@
JIKESENCODING = @JIKESENCODING@
JIKESWARNINGS = @JIKESWARNINGS@
KJC = @KJC@
+LD = @LD@
LDFLAGS = @LDFLAGS@
LIBDEBUG = @LIBDEBUG@
LIBICONV = @LIBICONV@
@@ -201,6 +213,7 @@ MKDIR = @MKDIR@
MOC = @MOC@
MOZILLA_CFLAGS = @MOZILLA_CFLAGS@
MOZILLA_LIBS = @MOZILLA_LIBS@
+NM = @NM@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
@@ -222,6 +235,7 @@ RANLIB = @RANLIB@
REGEN_PARSERS_FALSE = @REGEN_PARSERS_FALSE@
REGEN_PARSERS_TRUE = @REGEN_PARSERS_TRUE@
REMOVE = @REMOVE@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_WARNING_CFLAGS = @STRICT_WARNING_CFLAGS@
@@ -249,8 +263,10 @@ X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ZIP = @ZIP@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
@@ -283,6 +299,7 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
multi_basedir = @multi_basedir@
@@ -301,7 +318,7 @@ target_vendor = @target_vendor@
toolexeclibdir = @toolexeclibdir@
vm_classes = @vm_classes@
GLIBJ_CLASSPATH = '$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip':'$(top_builddir)/tools/tools.zip'
-@FOUND_ECJ_TRUE@@FOUND_GCJX_FALSE@JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
+@FOUND_ECJ_FALSE@@FOUND_JAVAC_TRUE@JCOMPILER = $(JAVAC) -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
# Setup the compiler to use the GNU Classpath library we just build
#if FOUND_GCJ
@@ -310,7 +327,7 @@ GLIBJ_CLASSPATH = '$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip':'$(top_b
#if FOUND_JIKES
#JCOMPILER = $(JIKES) -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(top_builddir)/lib:.
#else
-@FOUND_GCJX_TRUE@JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
+@FOUND_ECJ_TRUE@JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -warn:-deprecation,serial,typeHiding,unchecked,unused,varargsCast -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
#endif
#endif
@@ -328,7 +345,8 @@ EXAMPLE_ZIP = examples.zip
BUILT_SOURCES = $(EXAMPLE_ZIP)
# the png icons we use in some of the examples.
-EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png
+EXAMPLE_ICONS = $(srcdir)/gnu/classpath/examples/icons/*.png \
+ $(srcdir)/gnu/classpath/examples/icons/*.gif
# the html pages we use in the swing demo example.
EXAMPLE_HTML = $(srcdir)/gnu/classpath/examples/swing/*.html
@@ -540,7 +558,7 @@ uninstall-am: uninstall-exampleDATA uninstall-info-am uninstall-local
uninstall uninstall-am uninstall-exampleDATA uninstall-info-am \
uninstall-local
-@FOUND_ECJ_FALSE@@FOUND_GCJX_FALSE@error dunno how to setup the JCOMPILER and compile
+@FOUND_ECJ_FALSE@@FOUND_JAVAC_FALSE@error dunno how to setup the JCOMPILER and compile
# Make sure all sources and icons are also installed so users can use them.
# (Be careful to strip off the srcdir part of the path when installing.)
diff --git a/libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java b/libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java
index ed18fd4..5bb4ec4 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java
@@ -100,8 +100,8 @@ public class AicasGraphicsBenchmark extends Panel
public AicasGraphicsBenchmark()
{
- pngTestImage = loadImage("aicas.png");
- gifTestImage = loadImage("palme.gif");
+ pngTestImage = loadImage("../icons/aicas.png");
+ gifTestImage = loadImage("../icons/palme.gif");
setLayout(new BorderLayout());
testLabel = new Label();
diff --git a/libjava/classpath/examples/gnu/classpath/examples/awt/HintingDemo.java b/libjava/classpath/examples/gnu/classpath/examples/awt/HintingDemo.java
new file mode 100644
index 0000000..75b6f67
--- /dev/null
+++ b/libjava/classpath/examples/gnu/classpath/examples/awt/HintingDemo.java
@@ -0,0 +1,377 @@
+/* Demo.java -- Shows examples of AWT components
+ Copyright (C) 1998, 1999, 2002, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath examples.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA. */
+
+package gnu.classpath.examples.awt;
+
+import gnu.java.awt.font.*;
+import gnu.java.awt.font.opentype.*;
+
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.font.*;
+import java.io.*;
+import java.nio.*;
+import java.nio.channels.*;
+import java.text.*;
+
+import javax.swing.BoxLayout;
+import javax.swing.JCheckBox;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+public class HintingDemo extends JFrame {
+
+ FontDelegate font;
+ GNUGlyphVector glyph;
+ GlyphPreview glyphPreview;
+ HintPanel hintPanel;
+ StringViewer stringViewer;
+ Chooser chooser;
+ char character;
+ Options options;
+ boolean antiAlias;
+ int flags;
+
+ class StringViewer extends JPanel
+ implements ActionListener
+ {
+ JTextField input;
+ GNUGlyphVector gv;
+ Viewer viewer;
+ StringViewer()
+ {
+ setLayout(new GridLayout(0, 1));
+ setBorder(new TitledBorder("Use this field to render complete strings"));
+ input = new JTextField();
+ input.addActionListener(this);
+ add(input);
+ viewer = new Viewer();
+ add(viewer);
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ refresh();
+ }
+
+ void refresh()
+ {
+ gv = (GNUGlyphVector)
+ font.createGlyphVector(new Font("Dialog", 0, 12),
+ new FontRenderContext(null, false, false),
+ new StringCharacterIterator(input.getText()));
+ viewer.repaint();
+ }
+
+ class Viewer extends JPanel
+ {
+ protected void paintComponent(Graphics g)
+ {
+ if (gv != null && g instanceof Graphics2D)
+ {
+ Graphics2D g2d = (Graphics2D) g;
+ if (antiAlias)
+ {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ }
+ else
+ {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_OFF);
+ }
+ g2d.clearRect(0, 0, getWidth(), getHeight());
+ g2d.setColor(Color.BLACK);
+ Shape outline = gv.getOutline(0, 0,
+ flags | FontDelegate.FLAG_FITTED);
+ g2d.translate(20, Math.floor(outline.getBounds2D().getHeight()) + 2);
+ g2d.fill(outline);
+ }
+ }
+ }
+ }
+
+ class HintPanel extends JPanel
+ {
+
+ HintPanel()
+ {
+ setBorder(new TitledBorder("Detailed glyph view"));
+ }
+ protected void paintComponent(Graphics g)
+ {
+ if (glyph != null && g instanceof Graphics2D)
+ {
+ Graphics2D g2d = (Graphics2D) g.create();
+ Insets i = getInsets();
+ g2d.clearRect(i.left, i.top, getWidth() - i.left - i.right,
+ getHeight() - i.top - i.bottom);
+ g2d.setColor(Color.GRAY);
+ for (int x = 20; x < getWidth(); x += 20)
+ {
+ g2d.drawLine(x, i.top, x, getHeight() - i.top - i.bottom);
+ }
+ for (int y = 20; y < getHeight(); y += 20)
+ {
+ g2d.drawLine(i.left, y, getWidth() - i.left - i.right, y);
+ }
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.translate(40, 300);
+ g2d.scale(20., 20.);
+ g2d.setStroke(new BasicStroke((float) (1/20.)));
+ g2d.setColor(Color.RED);
+ g2d.draw(glyph.getOutline(0, 0, flags & ~FontDelegate.FLAG_FITTED));
+ g2d.setColor(Color.GREEN);
+ g2d.draw(glyph.getOutline(0, 0, flags | FontDelegate.FLAG_FITTED));
+ }
+ }
+
+ }
+
+ class GlyphPreview extends JPanel
+ {
+ protected void paintComponent(Graphics g)
+ {
+ if (glyph != null && g instanceof Graphics2D)
+ {
+ Graphics2D g2d = (Graphics2D) g;
+ if (antiAlias)
+ {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ }
+ else
+ {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_OFF);
+ }
+ g2d.clearRect(0, 0, getWidth(), getHeight());
+ g2d.setColor(Color.BLACK);
+ Shape outline = glyph.getOutline(0, 0,
+ flags | FontDelegate.FLAG_FITTED);
+ g2d.translate(20, outline.getBounds2D().getHeight() + 2);
+ g2d.fill(outline);
+ }
+ }
+
+ }
+
+ HintingDemo()
+ {
+ File file = new File("/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerif.ttf");
+ loadFont(file);
+ setLayout(new BorderLayout());
+ chooser = new Chooser();
+ add(chooser, BorderLayout.NORTH);
+ hintPanel = new HintPanel();
+ character = 'A';
+ add(hintPanel);
+
+ options = new Options();
+ add(options, BorderLayout.EAST);
+
+ stringViewer = new StringViewer();
+ add(stringViewer, BorderLayout.SOUTH);
+ refresh();
+
+ JMenuBar mb = new JMenuBar();
+ setJMenuBar(mb);
+ JMenu fileMenu = new JMenu("File");
+ mb.add(fileMenu);
+ JMenuItem loadFont = new JMenuItem("Load font");
+ loadFont.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent ev)
+ {
+ JFileChooser fc = new JFileChooser()
+ {
+ public boolean accept(File f)
+ {
+ return f.isDirectory() || f.getName().endsWith(".ttf");
+ }
+ };
+ int status = fc.showOpenDialog(HintingDemo.this);
+ if (status == JFileChooser.APPROVE_OPTION)
+ {
+ File file = fc.getSelectedFile();
+ loadFont(file);
+ }
+ }
+ });
+ fileMenu.add(loadFont);
+ }
+
+ void refresh()
+ {
+ if (chooser != null)
+ chooser.refresh();
+ if (glyphPreview != null)
+ glyphPreview.repaint();
+ if (hintPanel != null)
+ hintPanel.repaint();
+ if (stringViewer != null)
+ stringViewer.refresh();
+ }
+
+ class Options extends JPanel
+ implements ActionListener
+ {
+ JCheckBox antiAliasOpt;
+ JCheckBox hintHorizontalOpt;
+ JCheckBox hintVerticalOpt;
+ JCheckBox hintEdgeOpt;
+ JCheckBox hintStrongOpt;
+ JCheckBox hintWeakOpt;
+ Options()
+ {
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ setBorder(new TitledBorder("Hinting options"));
+ antiAliasOpt = new JCheckBox("Antialias");
+ antiAliasOpt.setSelected(true);
+ antiAliasOpt.addActionListener(this);
+ add(antiAliasOpt);
+ hintHorizontalOpt = new JCheckBox("Hint horizontal");
+ hintHorizontalOpt.setSelected(true);
+ hintHorizontalOpt.addActionListener(this);
+ add(hintHorizontalOpt);
+ hintVerticalOpt = new JCheckBox("Hint vertical");
+ hintVerticalOpt.setSelected(true);
+ hintVerticalOpt.addActionListener(this);
+ add(hintVerticalOpt);
+ hintEdgeOpt = new JCheckBox("Hint edge points");
+ hintEdgeOpt.setSelected(true);
+ hintEdgeOpt.addActionListener(this);
+ add(hintEdgeOpt);
+ hintStrongOpt = new JCheckBox("Hint strong points");
+ hintStrongOpt.setSelected(true);
+ hintStrongOpt.addActionListener(this);
+ add(hintStrongOpt);
+ hintWeakOpt = new JCheckBox("Hint weak points");
+ hintWeakOpt.setSelected(true);
+ hintWeakOpt.addActionListener(this);
+ add(hintWeakOpt);
+ sync();
+ }
+
+ void sync()
+ {
+ antiAlias = antiAliasOpt.isSelected();
+ if (hintHorizontalOpt.isSelected())
+ flags &= ~FontDelegate.FLAG_NO_HINT_HORIZONTAL;
+ else
+ flags |= FontDelegate.FLAG_NO_HINT_HORIZONTAL;
+ if (hintVerticalOpt.isSelected())
+ flags &= ~FontDelegate.FLAG_NO_HINT_VERTICAL;
+ else
+ flags |= FontDelegate.FLAG_NO_HINT_VERTICAL;
+ if (hintEdgeOpt.isSelected())
+ flags &= ~FontDelegate.FLAG_NO_HINT_EDGE_POINTS;
+ else
+ flags |= FontDelegate.FLAG_NO_HINT_EDGE_POINTS;
+ if (hintStrongOpt.isSelected())
+ flags &= ~FontDelegate.FLAG_NO_HINT_STRONG_POINTS;
+ else
+ flags |= FontDelegate.FLAG_NO_HINT_STRONG_POINTS;
+ if (hintWeakOpt.isSelected())
+ flags &= ~FontDelegate.FLAG_NO_HINT_WEAK_POINTS;
+ else
+ flags |= FontDelegate.FLAG_NO_HINT_WEAK_POINTS;
+
+ refresh();
+ }
+
+ public void actionPerformed(ActionEvent event)
+ {
+ sync();
+ }
+ }
+
+ class Chooser extends JPanel
+ {
+ JSpinner spin;
+ Chooser()
+ {
+ setLayout(new GridLayout(1, 0));
+ setBorder(new TitledBorder("Choose and preview the character to render"));
+ spin = new JSpinner();
+ spin.addChangeListener(new ChangeListener()
+ {
+
+ public void stateChanged(ChangeEvent event)
+ {
+ int val = ((Integer) spin.getValue()).intValue();
+ setGlyph((char) val);
+ }
+ });
+ add(spin);
+ glyphPreview = new GlyphPreview();
+ add(glyphPreview);
+ }
+ void refresh()
+ {
+ spin.setValue(new Integer(character));
+ repaint();
+ }
+ }
+
+ private void loadFont(File file)
+ {
+ try
+ {
+ RandomAccessFile raf = new RandomAccessFile(file, "r");
+ FileChannel chan = raf.getChannel();
+ ByteBuffer buf = chan.map(FileChannel.MapMode.READ_ONLY, 0, raf.length());
+ FontDelegate[] fonts = OpenTypeFontFactory.createFonts(buf);
+ font = fonts[0];
+ setGlyph(character);
+ refresh();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ void setGlyph(char ch)
+ {
+ character = ch;
+ glyph = (GNUGlyphVector)
+ font.createGlyphVector(new Font("Dialog", 0, 12),
+ new FontRenderContext(null, false, false),
+ new StringCharacterIterator(new String(new char[]{ch})));
+ refresh();
+ }
+
+ public static void main(String[] args) {
+ HintingDemo f = new HintingDemo();
+ f.setSize(500, 500);
+ f.setVisible(true);
+ }
+}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/awt/aicas.png b/libjava/classpath/examples/gnu/classpath/examples/icons/aicas.png
index dcf3965..dcf3965 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/awt/aicas.png
+++ b/libjava/classpath/examples/gnu/classpath/examples/icons/aicas.png
Binary files differ
diff --git a/libjava/classpath/examples/gnu/classpath/examples/awt/palme.gif b/libjava/classpath/examples/gnu/classpath/examples/icons/palme.gif
index 6947946..6947946 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/awt/palme.gif
+++ b/libjava/classpath/examples/gnu/classpath/examples/icons/palme.gif
Binary files differ
diff --git a/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java b/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java
index 118ae24..6d35918 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/java2d/J2dBenchmark.java
@@ -174,8 +174,8 @@ public class J2dBenchmark
public String init()
{
boolean loadError = false;
- pngTestImage = loadImage("aicas.png");
- gifTestImage = loadImage("palme.gif");
+ pngTestImage = loadImage("../icons/aicas.png");
+ gifTestImage = loadImage("../icons/palme.gif");
if (texture != null)
{
diff --git a/libjava/classpath/examples/gnu/classpath/examples/java2d/aicas.png b/libjava/classpath/examples/gnu/classpath/examples/java2d/aicas.png
deleted file mode 100644
index dcf3965..0000000
--- a/libjava/classpath/examples/gnu/classpath/examples/java2d/aicas.png
+++ /dev/null
Binary files differ
diff --git a/libjava/classpath/examples/gnu/classpath/examples/java2d/palme.gif b/libjava/classpath/examples/gnu/classpath/examples/java2d/palme.gif
deleted file mode 100644
index 6947946..0000000
--- a/libjava/classpath/examples/gnu/classpath/examples/java2d/palme.gif
+++ /dev/null
Binary files differ
diff --git a/libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java b/libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java
index a13e514..fe09346 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/management/TestOS.java
@@ -33,5 +33,6 @@ public class TestOS
System.out.println("OS Version: " + osBean.getVersion());
System.out.println("Architecture: " + osBean.getArch());
System.out.println("Processors: " + osBean.getAvailableProcessors());
+ System.out.println("System Load Average: " + osBean.getSystemLoadAverage());
}
}
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch b/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch
deleted file mode 100644
index 7d041a0..0000000
--- a/libjava/classpath/examples/gnu/classpath/examples/swing/ClasspathSwingActivityBoard.launch
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<launchConfiguration type="org.eclipse.cdt.launch.localCLaunch">
-<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="org.eclipse.cdt.debug.mi.core.CDebugger"/>
-<stringAttribute key="org.eclipse.cdt.launch.protocol" value="mi"/>
-<booleanAttribute key="org.eclipse.cdt.debug.mi.core.STOP_ON_SOLIB_EVENTS" value="false"/>
-<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
-<listAttribute key="org.eclipse.cdt.debug.mi.core.SOLIB_PATH"/>
-<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_REGISTER_BOOKKEEPING" value="false"/>
-<booleanAttribute key="org.eclipse.cdt.debug.mi.core.AUTO_SOLIB" value="true"/>
-<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
-<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="jamvm"/>
-<booleanAttribute key="org.eclipse.cdt.launch.ENABLE_VARIABLE_BOOKKEEPING" value="false"/>
-<stringAttribute key="org.eclipse.cdt.debug.mi.core.DEBUG_NAME" value="gdb"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="src/jamvm"/>
-<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel gnu.classpath.examples.swing.Demo"/>
-<stringAttribute key="org.eclipse.cdt.debug.mi.core.GDB_INIT" value=""/>
-</launchConfiguration>
diff --git a/libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java b/libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java
index 5184e5b..a7472df 100644
--- a/libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java
+++ b/libjava/classpath/examples/gnu/classpath/examples/swing/NavigationFilterDemo.java
@@ -183,7 +183,7 @@ public class NavigationFilterDemo
return pos;
case SwingConstants.WEST:
// Calculate the next word start.
- newpos = Utilities.getWordStart(text, newpos);;
+ newpos = Utilities.getWordStart(text, newpos);
// If that means that the caret will not move, return
// the start of the previous word.