-3

データベースからタミル語のテキストを取得して、JLabel. Unicode を使用してみましたが、タミル語で特定の文字列を表示できません。では動作しますSOP("")が、 では動作しませんjlabel12.setText(myvariable)

JLabelタミル語で表現されたMySQL DB文字列値からテキストを設定するには?

4

1 に答える 1

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
    }
}

ここからは、さらに進めることができます。注: DB から取得して表示するのは宿題です。これはヒントです。

于 2013-01-22T08:30:42.450 に答える