2017-05-15 9 views
0

如何修復此代碼以讀取阿姆哈拉語言?Swing GUI編碼讀取阿姆哈拉語字符

import java.awt.FlowLayout; 
import javax.swing.JButton;` 
import javax.swing.JFrame; 
import javax.swing.SwingUtilities; 

public class Gui { 

    public static void main(String[] args) { 
     SwingUtilities.invokeLater(() -> new Gui().start()); 
    } 

    public void start() { 
     JFrame frame = new JFrame(" አማረኛ "); 
     JButton btn = new JButton(" ስላም "); 
     JButton btn2 = new JButton(" ሃይ"); 

     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
     frame.getContentPane().setLayout(new FlowLayout(FlowLayout.LEFT)); 
     frame.getContentPane().add(btn); 
     frame.getContentPane().add(btn2); 
     frame.setSize(250, 220); 
     frame.setVisible(true); 
    } 

} 

click this link the output look like this Image

+1

您可能需要將外觀和感覺字體更改爲支持您要顯示的字符集的東西 - 並/或使用系統外觀 – MadProgrammer

回答

0

您可以嘗試使用Unicode符號。例如:

JButton btn = new JButton(" \u1235\u120B\u137F "); 

你可以通過簡單的谷歌搜索找到這些代碼。 只是試試這樣的:「ሃunicode」
找到代碼的十六進制值(最後4位數),並在開頭添加「\ u」。

+0

這不會改善任何內容,除非JButton的字體支持這些阿姆哈拉語字符。 –