Re: How to combine characters
- From: Chris <chrisliapis@xxxxxxxxx>
- Date: Sun, 22 Jun 2008 20:27:08 -0700 (PDT)
On Jun 22, 8:18 pm, Chris <chrislia...@xxxxxxxxx> wrote:
Okay, I'm still not getting it.
Does anyone know how to combine char's from a KeyEvent to combine into
a string?
Thank you....
My current code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class InputObject {
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable() {
public void run() {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextField tf = new JTextField(30);
tf.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent ke)
{
String s = "" + ke.getKeyChar();
final StringBuffer strb = new StringBuffer (s);
if(!s.equals(" "))
{
System.out.println (strb.toString());
strb.append (s);
}
ke.consume();
}
});
f.add(tf,BorderLayout.CENTER);
f.pack();
f.setVisible(true);
}
});
}
}- Hide quoted text -
- Show quoted text -
Nevermind. Got it...
.
- Follow-Ups:
- Re: How to combine characters
- From: Daniele Futtorovic
- Re: How to combine characters
- References:
- How to combine characters
- From: Chris
- Re: How to combine characters
- From: Daniele Futtorovic
- Re: How to combine characters
- From: Chris
- Re: How to combine characters
- From: Chris
- How to combine characters
- Prev by Date: Re: How to combine characters
- Next by Date: a very tricky question...
- Previous by thread: Re: How to combine characters
- Next by thread: Re: How to combine characters
- Index(es):
Relevant Pages
|