J
John L.
I'm trying to change the color of a JTextField. There are many
interesting discussions on much more detailed topics in other posts.
Here is my best attempt, which does NOT work as I might reasonably
expect:
class ITextField extends JTextField
{
private String s1 = null;
public void setText(String s) {
s1 = s;
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
if (s1 != null) {
g2.setPaint(Color.RED);
g2.drawString(s1,0,0);
}
}
}
Thanks in advance for any help or insight you may be able to provide.
interesting discussions on much more detailed topics in other posts.
Here is my best attempt, which does NOT work as I might reasonably
expect:
class ITextField extends JTextField
{
private String s1 = null;
public void setText(String s) {
s1 = s;
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
if (s1 != null) {
g2.setPaint(Color.RED);
g2.drawString(s1,0,0);
}
}
}
Thanks in advance for any help or insight you may be able to provide.