Browse Source

Update add KeyAdapter

main
Berkan Sarp 2 years ago
parent
commit
a2a83698e4
  1. 2
      src/main/java/GameFrame.java
  2. 12
      src/main/java/MenuPanel.java

2
src/main/java/GameFrame.java

@ -0,0 +1,2 @@
public class GameFrame {
}

12
src/main/java/MenuPanel.java

@ -1,5 +1,7 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
public class MenuPanel extends JPanel {
MenuPanel() {
@ -23,3 +25,13 @@ public class MenuPanel extends JPanel {
g.drawString("Created by Hells Gamers", 450, 450);
}
public class AL extends KeyAdapter {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
GameFrame gameFrame = new GameFrame();
}
}
}
}
Loading…
Cancel
Save