View Single Post
  #1 (permalink)  
Old 10-06-2008, 04:35 PM
keffie91's Avatar
keffie91 keffie91 is offline
Member
 
Join Date: Jun 2008
Location: The Netherlands
Posts: 35
keffie91 is on a distinguished road
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.
Reply With Quote
Sponsored Links