8205138: Remove Applet references from Font2DTest

Reviewed-by: serb, psadhukhan
This commit is contained in:
Phil Race 2021-08-13 19:30:20 +00:00
parent bd7f9b4fb9
commit 0af645aa4f
3 changed files with 10 additions and 106 deletions

View File

@ -1,49 +0,0 @@
<html>
<!-- Changed by: Shinsuke Fukuda, 4-Aug-2000 -->
<head>
<title>
Font2DTest Demo
</title>
</head>
<BODY BGCOLOR="#FFFFFF">
<font size=-1>
<hr>
</font>
<h1>
Font2DTest
</h1>
An encompassing font/glyph demo application.
Source code is in <BR>
<a href=src/Font2DTest.java>Font2DTest.java</a>,<BR>
<a href=src/Font2DTestApplet.java>Font2DTestApplet.java</a>,<BR>
<a href=src/RangeMenu.java>RangeMenu.java</a> and<BR>
<a href=src/FontPanel.java>FontPanel.java</a>.<BR>
You can run this program either as an applet or as an application.<BR>
Detailed information about the program can be found in
<a href=README.txt>README.txt</a><BR>
<p>To run it as an application,
execute the <code>Font2DTest</code> class.
For example:
<blockquote>
<pre>
% <b>java -jar Font2DTest.jar</b>
</pre>
</blockquote>
<p>
Note: If AWTPermission's showWindowWithoutWarningBanner permission is not given,<BR>
the zoom feature will not look as good, as characters may be hidden by the warning banner.<BR>
<APPLET code="Font2DTestApplet.class" archive="Font2DTest.jar" width="850" height="700">
</APPLET>
<hr>
<font size=-1>
</font>
</body>
</html>

View File

@ -133,7 +133,7 @@ public final class Font2DTest extends JPanel
private static boolean canDisplayCheck = true; private static boolean canDisplayCheck = true;
/// Initialize GUI variables and its layouts /// Initialize GUI variables and its layouts
public Font2DTest( JFrame f, boolean isApplet ) { public Font2DTest( JFrame f) {
parent = f; parent = f;
rm = new RangeMenu( this, parent ); rm = new RangeMenu( this, parent );
@ -165,8 +165,8 @@ public final class Font2DTest extends JPanel
contrastSlider.setPaintLabels(true); contrastSlider.setPaintLabels(true);
contrastSlider.addChangeListener(this); contrastSlider.addChangeListener(this);
setupPanel(); setupPanel();
setupMenu( isApplet ); setupMenu();
setupDialog( isApplet ); setupDialog();
if(canDisplayCheck) { if(canDisplayCheck) {
fireRangeChanged(); fireRangeChanged();
@ -256,7 +256,7 @@ public final class Font2DTest extends JPanel
} }
/// Sets up menu entries /// Sets up menu entries
private void setupMenu( boolean isApplet ) { private void setupMenu() {
JMenu fileMenu = new JMenu( "File" ); JMenu fileMenu = new JMenu( "File" );
JMenu optionMenu = new JMenu( "Option" ); JMenu optionMenu = new JMenu( "Option" );
@ -268,11 +268,7 @@ public final class Font2DTest extends JPanel
fileMenu.add( new MenuItemV2( "Page Setup...", this )); fileMenu.add( new MenuItemV2( "Page Setup...", this ));
fileMenu.add( new MenuItemV2( "Print...", this )); fileMenu.add( new MenuItemV2( "Print...", this ));
fileMenu.addSeparator(); fileMenu.addSeparator();
if ( !isApplet ) fileMenu.add( new MenuItemV2( "Exit", this ));
fileMenu.add( new MenuItemV2( "Exit", this ));
else
fileMenu.add( new MenuItemV2( "Close", this ));
displayGridCBMI = new CheckboxMenuItemV2( "Display Grid", true, this ); displayGridCBMI = new CheckboxMenuItemV2( "Display Grid", true, this );
force16ColsCBMI = new CheckboxMenuItemV2( "Force 16 Columns", false, this ); force16ColsCBMI = new CheckboxMenuItemV2( "Force 16 Columns", false, this );
showFontInfoCBMI = new CheckboxMenuItemV2( "Display Font Info", false, this ); showFontInfoCBMI = new CheckboxMenuItemV2( "Display Font Info", false, this );
@ -326,11 +322,8 @@ public final class Font2DTest extends JPanel
} }
/// Sets up the all dialogs used in Font2DTest... /// Sets up the all dialogs used in Font2DTest...
private void setupDialog( boolean isApplet ) { private void setupDialog() {
if (!isApplet) filePromptDialog = new JFileChooser();
filePromptDialog = new JFileChooser( );
else
filePromptDialog = null;
/// Prepare user text dialog... /// Prepare user text dialog...
userTextDialog = new JDialog( parent, "User Text", false ); userTextDialog = new JDialog( parent, "User Text", false );
@ -432,8 +425,6 @@ public final class Font2DTest extends JPanel
/// Changes the message on the status bar /// Changes the message on the status bar
public void fireChangeStatus( String message, boolean error ) { public void fireChangeStatus( String message, boolean error ) {
/// If this is not ran as an applet, use own status bar,
/// Otherwise, use the appletviewer/browser's status bar
statusBar.setText( message ); statusBar.setText( message );
if ( error ) if ( error )
fp.showingError = true; fp.showingError = true;
@ -1030,7 +1021,7 @@ public final class Font2DTest extends JPanel
UIManager.put("swing.boldMetal", Boolean.FALSE); UIManager.put("swing.boldMetal", Boolean.FALSE);
final JFrame f = new JFrame( "Font2DTest" ); final JFrame f = new JFrame( "Font2DTest" );
final Font2DTest f2dt = new Font2DTest( f, false ); final Font2DTest f2dt = new Font2DTest( f);
f.addWindowListener( new WindowAdapter() { f.addWindowListener( new WindowAdapter() {
public void windowOpening( WindowEvent e ) { f2dt.repaint(); } public void windowOpening( WindowEvent e ) { f2dt.repaint(); }
public void windowClosing( WindowEvent e ) { System.exit(0); } public void windowClosing( WindowEvent e ) { System.exit(0); }

View File

@ -4,35 +4,17 @@ Font2DTest
To run Font2DTest: To run Font2DTest:
% java -jar Font2DTest.jar % java -jar Font2DTest.jar
or
% appletviewer Font2DTest.html
These instructions assume that the 1.7 versions of the java These instructions assume that the java command is in your path.
and appletviewer commands are in your path. If they aren't, If they aren't, then you should either specify the complete path to the commands
then you should either specify the complete path to the commands
or update your PATH environment variable as described in the or update your PATH environment variable as described in the
installation instructions for the Java(TM) SE Development Kit. installation instructions for the Java(TM) SE Development Kit.
To view Font2DTest within a web browser with Java Plugin,
load Font2DTest.html.
If you wish to modify any of the source code, you may want to extract If you wish to modify any of the source code, you may want to extract
the contents of the Font2DTest.jar file by executing this command: the contents of the Font2DTest.jar file by executing this command:
% jar -xvf Font2DTest.jar % jar -xvf Font2DTest.jar
NOTE:
When Font2DTest is ran as an applet, the browser plugin/viewer needs
following permissions given in order to run properly:
AWTPermission "showWindowWithoutWarningBanner"
RuntimePermission "queuePrintJob"
The program will run without these properties set,
but some of its features will be limited.
To enable all features, please add these permissions.
----------------------------------------------------------------------- -----------------------------------------------------------------------
Introduction Introduction
----------------------------------------------------------------------- -----------------------------------------------------------------------
@ -129,23 +111,3 @@ that are within the selected range. Third option, "Print all text..."
is similar, and it will print all lines of text that user has put in. is similar, and it will print all lines of text that user has put in.
==================================================================== ====================================================================
Known Problems:
- When a PostScript font is used, the characters may extend beyond the
enclosing grid or zoom rectangle. This is due to the problem with
FontMetrics.getMaxAscent() and getMaxDescent() functions; the functions
do not always return the right values for PostScript fonts.
- There are still some bugs around the error handling.
Most of these problems will usually get fixed when some parameters
are changed, or the screen is refreshed.
- Many fonts on Solaris fails to retrieve outlines properly,
and as the result, they do not align within the grid properly.
These are mainly F3 and fonts that was returned by X server.
- When showWindowWithoutWarningBanner AWTPermission is not given,
the "zoom" window will look really bad because of the
Applet warning label tacked at the bottom of the zoom window.
To remove this, follow the "NOTE:" instruction at the top.