|
set * at tab title
Hello I am building a Programming editor. It make us of a JTabbedPane. Now I wat that there appears a * at the tab when your file is not saved.
I wrote this:
private class MyKeyListener implements KeyListener{
public void keyPressed(KeyEvent e){
String title = tab.getTitleAt(tab.getSelectedIndex());
String update = title + "*";
tab.setTitleAt(tab.getSelectedIndex(),update);
}
}
This works not correct. Everytime I press a key, there is a * added to the tab title. You understand that I only want one *. I have tried something with a bool, but it was not a suc6.
Does anyone have any suggestions?
__________________
Never give up! To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|