从Tamil中的MySQL DB String值表示设置JLabel文本

时间:2013-01-22 08:10:54

标签: java mysql swing unicode jlabel

我正在尝试从数据库中获取泰米尔语文本并在JLabel中显示。我尝试使用Unicode但我无法在泰米尔语中显示特定的字符串。它适用于SOP("")但不适用于jlabel12.setText(myvariable)

如何使用MySQL DB字符串值设置JLabel文本代表泰米尔语?

1 个答案:

答案 0 :(得分:1)

根据您提供的信息量,很难提供完整的解决方案。假设您要在JLabel上显示Unicode字符,请尝试以下程序。这对我来说很好:

import java.awt.GridLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;

public class Unicode {
    public static void main(String args[]) {
    UnicodeJFrame unicodeJFrame = new UnicodeJFrame();
    unicodeJFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    unicodeJFrame.setSize(350, 250);
    unicodeJFrame.setVisible(true);
 } 
}

class UnicodeJFrame extends JFrame {
    public UnicodeJFrame() {
       super("Demonstrating Unicode");
       setLayout(new GridLayout(8, 1));
       JLabel tamilJLabel = new JLabel("\u6B22\u8FCE\u4F7F\u7528"); //Replace this with actual Tamil unicode character
       add(tamilJLabel);

       //Remaining JLabels here
    }
}

从这里开始,你可以进一步发展。注意:现在你的作业是从数据库中取出并显示它,这是一个提示。