Skip to content

Commit d0c1aec

Browse files
committed
8263140: Japanese chars garble in console window in HSDB
Reviewed-by: iklam, prr, cjplummer
1 parent 70342e8 commit d0c1aec

File tree

5 files changed

+13
-24
lines changed

5 files changed

+13
-24
lines changed

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/AnnotatedMemoryPanel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -306,7 +306,7 @@ public void ancestorResized(HierarchyEvent e) {
306306
});
307307

308308
if (font == null) {
309-
font = GraphicsUtilities.lookupFont("Courier");
309+
font = GraphicsUtilities.getMonospacedFont();
310310
}
311311
if (font == null) {
312312
throw new RuntimeException("Error looking up monospace font Courier");

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/CommandProcessorPanel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -60,7 +60,7 @@ public CommandProcessorPanel(CommandProcessor cp) {
6060

6161
editor = new JTextArea();
6262
editor.setDocument(new EditableAtEndDocument());
63-
editor.setFont(GraphicsUtilities.lookupFont("Courier"));
63+
editor.setFont(GraphicsUtilities.getMonospacedFont());
6464
JScrollPane scroller = new JScrollPane();
6565
scroller.getViewport().add(editor);
6666
add(scroller, BorderLayout.CENTER);

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/DebuggerConsolePanel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@ public DebuggerConsolePanel(Debugger debugger) {
5858

5959
editor = new JTextArea();
6060
editor.setDocument(new EditableAtEndDocument());
61-
editor.setFont(GraphicsUtilities.lookupFont("Courier"));
61+
editor.setFont(GraphicsUtilities.getMonospacedFont());
6262
JScrollPane scroller = new JScrollPane();
6363
scroller.getViewport().add(editor);
6464
add(scroller, BorderLayout.CENTER);

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/GraphicsUtilities.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -34,21 +34,10 @@
3434
/** Useful utilities for drawing graphics */
3535

3636
public class GraphicsUtilities {
37-
/** Returns a plain-styled 12-point version of the given font, or
38-
null if the font could not be found */
39-
public static Font lookupFont(String fontName) {
40-
Font[] allFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
41-
Font font = null;
42-
for (int i = 0; i < allFonts.length; i++) {
43-
if (allFonts[i].getFontName().indexOf(fontName) != -1) {
44-
font = allFonts[i];
45-
break;
46-
}
47-
}
48-
if (font == null) {
49-
return null;
50-
}
51-
return font.deriveFont(Font.PLAIN, 12);
37+
private static final int FONT_SIZE = 12;
38+
39+
public static Font getMonospacedFont() {
40+
return new Font(Font.MONOSPACED, Font.PLAIN, FONT_SIZE);
5241
}
5342

5443
/** Compute the width and height of given string given the current

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/MemoryPanel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -130,7 +130,7 @@ public boolean isCellEditable(int row, int col) {
130130
table.setCellSelectionEnabled(true);
131131
table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
132132
table.setDragEnabled(true);
133-
Font font = GraphicsUtilities.lookupFont("Courier");
133+
Font font = GraphicsUtilities.getMonospacedFont();
134134
if (font == null) {
135135
throw new RuntimeException("Error looking up monospace font Courier");
136136
}

0 commit comments

Comments
 (0)