I am trying to print particular images(which include some drawn symbols) on textarea when I type a particular Alphabet on my keyboard. How?
I want to update a particular image on TextArea(swing) ,when I enter a particular Alphabet on my keyboard. How?
57 Views Asked by JavaJitendra At
2
There are 2 best solutions below
0

You can't use a JTextArea since it can only display text.
You can use a JTextPane
as it supports the display of Icons
.
Check out: Auto Replace Smiles. It shows how to replace the two text characters :)
with an Icon.
You are asking me to do your homework, but still. I will give you only the pseudo code, you will have to write it on your own.
JFrame
.JLabel
to theJFrame
(using a label is easier than using a text pane, and it is impossible to use a text area).JFrame
or theJLabel
depending on your application.ImageIcon
to theJLabel
when the key you want is pressed or whatever.Cheers!