2013-01-22 40 views
-3

我试图从数据库中获取泰米尔文文本并将其显示在JLabel中。我尝试使用Unicode,但我不能在泰米尔语中显示特定的字符串。它在SOP("")中工作,但在jlabel12.setText(myvariable)中不起作用。从泰米尔语中设置MySQL数据库字符串值的JLabel文本

如何设置JLabel文本与来自MySQL数据库的字符串值代表泰米尔语?

+0

提供更多信息,例如代码。 – goravine

+0

请正确构思您的问题,不清楚您要求的内容。还提供相关的代码。 – Swapnil

+0

我添加了泰米尔字符串值到我的数据库,现在我需要在标签中显示它们。他们用英语显示。我尝试使用unicodes,但是那些值显示他们的unicode值 我只想将泰米尔字符串值插入数据库并显示它inla jlabel – scofield

回答

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

从这里开始,你可以进一步了解它。注意:现在,您的作业是从数据库中获取并显示它,这是对您的暗示。

+0

它在双引号外不起作用。但如果我使用 JLabel tamilJLabel = new JLabel(myDbValue);它不工作。 它显示“\ u0069”值不是实际的字符串值。 – scofield

+0

@ user1999502,你可以请邮编(在你原来的问题),以便我可以看看? “Welcome”的中文翻译, –

+0

“Welcome”适用于我。 – trashgod

相关问题