I am trying to create a xml editor which must have a content assistant. I am new in java so my code isn't working properly.
I am trying to change a text color while typing (words between '<' and '>' including '<' and '>' must be blue), my non working code:
textPane.addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent arg0) {
char key = arg0.getKeyChar();
switch(key){
case '<': textPane.setForeground(Color.blue); break;
case '>': textPane.setForeground(Color.black); break;
}
}
Thanks