JTextField Unicode Problem

B

Badshah

I am not able to get "♣" symbol on console when I press enter in jtf
after inserting "♣".

import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.awt.*;
import java.sql.*;

public class TestFrame
{
JTextField jtf = null;
public TestFrame()
{
try
{
JFrame fr = new JFrame("Testing Unicode Transfer From & To MySql
Database");
JPanel cp = new JPanel();
fr.setContentPane(cp);
cp.setLayout(null);

fr.setBounds(0,0,400,400);

jtf = new JTextField();
cp.add(jtf);
jtf.setBounds(20,300,100,40);

jtf.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
System.out.println(jtf.getText());
}
});
fr.setVisible(true);
}
catch(Exception ex)
{
System.out.println("Exception : " + ex);
}
}
public static void main(String args[])
{
new TestFrame();
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,979
Messages
2,570,185
Members
46,728
Latest member
FernMcmull

Latest Threads

Top