3171N/A/*
3171N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3171N/A *
3171N/A * This code is free software; you can redistribute it and/or modify it
3171N/A * under the terms of the GNU General Public License version 2 only, as
3171N/A * published by the Free Software Foundation.
3171N/A *
3171N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3171N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3171N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3171N/A * version 2 for more details (a copy is included in the LICENSE file that
3171N/A * accompanied this code).
3171N/A *
3171N/A * You should have received a copy of the GNU General Public License version
3171N/A * 2 along with this work; if not, write to the Free Software Foundation,
3171N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3171N/A *
3171N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3171N/A * or visit www.oracle.com if you need additional information or have any
3171N/A * questions.
3171N/A *
3171N/A */
3171N/A
3171N/A/* @test @(#)TestOldHangul.java
3171N/A * @summary Verify Old Hangul display
3171N/A * @bug 6886358
3171N/A * @ignore Requires a special font installed.
3171N/A */
3171N/A
3171N/Aimport javax.swing.*;
3171N/Aimport javax.swing.border.LineBorder;
3171N/Aimport java.awt.*;
3171N/Aimport java.awt.event.ActionEvent;
3171N/A
3171N/Apublic class TestOldHangul {
3171N/A public static void main(String[] args) {
3171N/A SwingUtilities.invokeLater(new Runnable() {
3171N/A public void run() {
3171N/A new TestOldHangul().run();
3171N/A }
3171N/A });
3171N/A }
3171N/A public static boolean AUTOMATIC_TEST=true; // true; run test automatically, else manually at button push
3171N/A
3171N/A private void run() {
3171N/A Font ourFont = null;
3171N/A final String fontName = "UnBatangOdal.ttf"; // download from http://chem.skku.ac.kr/~wkpark/project/font/GSUB/UnbatangOdal/ and place in {user.home}/fonts/
3171N/A try {
3171N/A ourFont = Font.createFont(Font.TRUETYPE_FONT, new java.io.File(new java.io.File(System.getProperty("user.home"),"fonts"), fontName));
3171N/A ourFont = ourFont.deriveFont((float)48.0);
3171N/A } catch(Throwable t) {
3171N/A t.printStackTrace();
3171N/A System.err.println("Fail: " + t);
3171N/A return;
3171N/A }
3171N/A JFrame frame = new JFrame(System.getProperty("java.version"));
3171N/A frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
3171N/A JPanel panel = new JPanel();
3171N/A final JTextArea label = new JTextArea("(empty)");
3171N/A label.setSize(400, 300);
3171N/A label.setBorder(new LineBorder(Color.black));
3171N/A label.setFont(ourFont);
3171N/A final String str = "\u110A\u119E\u11B7\u0020\u1112\u119E\u11AB\uAE00\u0020\u1100\u119E\u11F9\u0020\u112B\u119E\u11BC\n";
3171N/A
3171N/A if(AUTOMATIC_TEST) { /* run the test automatically (else, manually) */
3171N/A label.setText(str);
3171N/A } else {
3171N/A JButton button = new JButton("Old Hangul");
3171N/A button.addActionListener(new AbstractAction() {
3171N/A public void actionPerformed(ActionEvent actionEvent) {
3171N/A label.setText(str);
3171N/A }
3171N/A });
3171N/A panel.add(button);
3171N/A }
3171N/A panel.add(label);
3171N/A
3171N/A frame.getContentPane().add(panel);
3171N/A frame.pack();
3171N/A frame.setVisible(true);
3171N/A }
3171N/A}
3171N/A