Skip to content

Commit

Permalink
8205138: Remove Applet references from Font2DTest
Browse files Browse the repository at this point in the history
Reviewed-by: serb, psadhukhan
  • Loading branch information
prrace committed Aug 13, 2021
1 parent bd7f9b4 commit 0af645a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 106 deletions.
49 changes: 0 additions & 49 deletions src/demo/share/jfc/Font2DTest/Font2DTest.html

This file was deleted.

25 changes: 8 additions & 17 deletions src/demo/share/jfc/Font2DTest/Font2DTest.java
Expand Up @@ -133,7 +133,7 @@ public final class Font2DTest extends JPanel
private static boolean canDisplayCheck = true;

/// Initialize GUI variables and its layouts
public Font2DTest( JFrame f, boolean isApplet ) {
public Font2DTest( JFrame f) {
parent = f;

rm = new RangeMenu( this, parent );
Expand Down Expand Up @@ -165,8 +165,8 @@ public Font2DTest( JFrame f, boolean isApplet ) {
contrastSlider.setPaintLabels(true);
contrastSlider.addChangeListener(this);
setupPanel();
setupMenu( isApplet );
setupDialog( isApplet );
setupMenu();
setupDialog();

if(canDisplayCheck) {
fireRangeChanged();
Expand Down Expand Up @@ -256,7 +256,7 @@ private void addLabeledComponentToGBL( String name,
}

/// Sets up menu entries
private void setupMenu( boolean isApplet ) {
private void setupMenu() {
JMenu fileMenu = new JMenu( "File" );
JMenu optionMenu = new JMenu( "Option" );

Expand All @@ -268,11 +268,7 @@ private void setupMenu( boolean isApplet ) {
fileMenu.add( new MenuItemV2( "Page Setup...", this ));
fileMenu.add( new MenuItemV2( "Print...", this ));
fileMenu.addSeparator();
if ( !isApplet )
fileMenu.add( new MenuItemV2( "Exit", this ));
else
fileMenu.add( new MenuItemV2( "Close", this ));

fileMenu.add( new MenuItemV2( "Exit", this ));
displayGridCBMI = new CheckboxMenuItemV2( "Display Grid", true, this );
force16ColsCBMI = new CheckboxMenuItemV2( "Force 16 Columns", false, this );
showFontInfoCBMI = new CheckboxMenuItemV2( "Display Font Info", false, this );
Expand Down Expand Up @@ -326,11 +322,8 @@ private void setupMenu( boolean isApplet ) {
}

/// Sets up the all dialogs used in Font2DTest...
private void setupDialog( boolean isApplet ) {
if (!isApplet)
filePromptDialog = new JFileChooser( );
else
filePromptDialog = null;
private void setupDialog() {
filePromptDialog = new JFileChooser();

/// Prepare user text dialog...
userTextDialog = new JDialog( parent, "User Text", false );
Expand Down Expand Up @@ -432,8 +425,6 @@ public void fireRangeChanged() {

/// Changes the message on the status bar
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 );
if ( error )
fp.showingError = true;
Expand Down Expand Up @@ -1030,7 +1021,7 @@ public static void main(String[] argv) {

UIManager.put("swing.boldMetal", Boolean.FALSE);
final JFrame f = new JFrame( "Font2DTest" );
final Font2DTest f2dt = new Font2DTest( f, false );
final Font2DTest f2dt = new Font2DTest( f);
f.addWindowListener( new WindowAdapter() {
public void windowOpening( WindowEvent e ) { f2dt.repaint(); }
public void windowClosing( WindowEvent e ) { System.exit(0); }
Expand Down
42 changes: 2 additions & 40 deletions src/demo/share/jfc/Font2DTest/README.txt
Expand Up @@ -4,35 +4,17 @@ Font2DTest
To run Font2DTest:

% java -jar Font2DTest.jar
or
% appletviewer Font2DTest.html

These instructions assume that the 1.7 versions of the java
and appletviewer commands are in your path. If they aren't,
then you should either specify the complete path to the commands
These instructions assume that the java command is in your path.
If they aren't, then you should either specify the complete path to the commands
or update your PATH environment variable as described in the
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
the contents of the Font2DTest.jar file by executing this command:

% 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
-----------------------------------------------------------------------
Expand Down Expand Up @@ -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.

====================================================================

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.

1 comment on commit 0af645a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.