🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.java
1 messages
1 total messages Started by Artur Tyloch Mon, 29 Sep 1997 00:00
KeyEvent, mnie nie slucha :(
#1074
Author: Artur Tyloch
Date: Mon, 29 Sep 1997 00:00
59 lines
1785 bytes
Czesc.

Moze ktos spojrzy i bedzie wiedzial?

Ma byc: po nacisnieciu klawisza na panelu wypsuje HELLO (wersja minimum
:) )
Jest: nic sie nie dzieje.

Nie wiem dlaczego, czy zdarzenie KeyEvent jest jakos inaczej obslugiwane
niz MouseEvent a to dziala !/?

Jest juz pozno i moze cos pomijam...? [ide spac!]

 public class MojApletKAnonim extends Applet
 {
  Panel panel = new Panel();
  Graphics panelKG; 	
  int mouseX,mouseY;
  public void start()
  {			
	panel.setBackground(Color.yellow);
	setLayout(new BorderLayout());
	add("Center",panel);
	panelKG = panel.getGraphics();

	//addKeyListener(  // < tez nie dziala
	panel.addKeyListener(  
		new KeyAdapter() 
		{
		  public void keyTyped(KeyEvent evt)
		  {
 		    String ch =evt.getKeyText(evt.getKeyCode());
//=======================================
		    //tu nie wypisuje "HELLO" na panelu!? Why	
		    panelKG.drawString("HELLO",20,20);  //mouseX,mouseY);
//=======================================
		  }
		}
	);
	panel.addMouseListener(
		new MouseAdapter() 
		{
		  public void mouseClicked(MouseEvent evt)
		  {
		    mouseX = evt.getX();
		    mouseY = evt.getY(); 
//====================== \/
		    // a tu dziala !
		    panelKG.drawString("to"+mouseX,10,10);
		  }
		}
	);		
  }
}

pozdrawiam
A/.t
mailto:art...@friko.onet.pl
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads