Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JTextField Unicode Problem

Reply
Thread Tools

JTextField Unicode Problem

 
 
Badshah
Guest
Posts: n/a
 
      01-29-2007
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();
}
}

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      01-29-2007
On Jan 30, 1:05*am, "Badshah" <(E-Mail Removed)> wrote:
> I am not able to get "♣" symbol on console when I press enter in jtf
> after inserting "♣"


OK. It took me a little while to understand what
you mean, but I think I can help by adding..

The console does not understand the entire
range of characters as displayed in UTF-8.
If the console encounters a symbol for which
it has no equivalent, it will put '?' instead.

I suspect that dumping UTF-8 encoded data
to the console might not be very helpful in
telling what the inputs and outputs are.

What development environment or IDE are
you using? (Some have debugging tools
that might be especially helpful for finding
out what the inputs and outputs are.)

Andrew T.

 
Reply With Quote
 
 
 
 
Badshah
Guest
Posts: n/a
 
      01-30-2007
On Jan 29, 7:45*pm, "Andrew Thompson" <(E-Mail Removed)> wrote:
> On Jan 30, 1:05*am, "Badshah" <(E-Mail Removed)> wrote:
>
> > I am not able to get "♣" symbol on console when I press enter in jtf
> > after inserting "♣"

>
> OK. *It took me a little while to understand what
> you mean, but I think I can help by adding..
>
> The console does not understand the entire
> range of characters as displayed in UTF-8.
> If the console encounters a symbol for which
> it has no equivalent, it will put '?' instead.
>
> I suspect that dumping UTF-8 encoded data
> to the console might not be very helpful in
> telling what the inputs and outputs are.
>
>
> Andrew T.


Hello Andrew, I have checked that the console is supporting such
characters. I have pasted it on the console.

1) One more thing I will like to say to you that when I am getting
that particular character from database (mySql) [I have already
inserted this character in a field] and setting it in textbox , It is
showing a rectangle in textbox , But at the same time if I use
[after setText(rs.getString("Field Which Contains That Character"))]
"System.out.println(txtfield.getText());" it is showing that character
on console. Means the control is not able to display that character
properly if I use it with database connectivity.

2) And the thing I told you that when I press enter in the above given
code after inserting that character then also it doesnt show that
character on console.

> What development environment or IDE are
> you using? (Some have debugging tools
> that might be especially helpful for finding
> out what the inputs and outputs are.)


I am using Crimson Editor but it's debugger doesnt support this
characters.

Hope I am able to explain.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JTextField Unicode Mysql Badshah Java 16 01-29-2007 03:12 PM
JTextField Unicode Problem Badshah Java 0 01-29-2007 02:02 PM
JTable/Model/JTextField focus problem blue Java 1 12-11-2004 05:59 AM
JTextField.requestFocus problem Matthew Bailey Java 4 07-07-2004 11:38 PM
JTextField Problem Katie Moore Java 1 12-01-2003 04:59 PM



Advertisments