Non mi funge
codice:
// IMPORT ....
public class kera extends JFrame implements ActionListener,KeyListener{
//variabili di classe....
kera(){
//.....
//imposto i menu
//aggiungo gli actionlistener
testo[testo_]= new JTextArea(22,65);
jsp[testo_]=new JScrollPane(testo[testo_],ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jtb = new JTabbedPane();
JPanel pan = new JPanel();
//aggiungo keylistener al pannello (si puo'?)
pan.addKeyListener(this);
//aggiungo pannello
setContentPane(pan);
//aggiungo il pannello e aggiungo un oggetto sul primo tab
jtb.addTab("Untitled" , jsp[testo_]);
getContentPane().add(jtb);
}
public void actionPerformed(ActionEvent ae){
Object found = ae.getSource();
//.......
}
//definisco i metodi essenziali per l'interfaccia KeyListener
public void keyTyped(KeyEvent kt){
}
public void keyPressed(KeyEvent kp){
}
public void keyReleased(KeyEvent kr){
int id = kr.getID();
//
if(id==KeyEvent.VK_ENTER){
testo_++;
testo[testo_]= new JTextArea(22,65);
jsp[testo_]=new JScrollPane(testo[testo_],ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
jtb.addTab("Untitled" , jsp[testo_]);
jtb.setSelectedIndex(testo_);
}
}
public static void main(String[] args){
.......
}
}
help me please