package iryrwarosh;
import iryrwarosh.screens.StartScreen;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JFrame;
import asciiPanel.AsciiPanel;
public class ApplicationMain extends JFrame implements KeyListener {
private static final long serialVersionUID = 1L;
private AsciiPanel terminal;
private iryrwarosh.screens.Screen screen;
public ApplicationMain(){
super();
terminal = new AsciiPanel();
terminal.setDefaultBackgroundColor(Common.guiBackground);
terminal.setDefaultForegroundColor(Common.guiForeground);
add(terminal);
pack();
screen = new StartScreen();
addKeyListener(this);
repaint();
}
@Override
public void repaint(){
terminal.clear();
screen.displayOutput(terminal);
super.repaint();
}
@Override
public void keyPressed(KeyEvent e) {
screen = screen.respondToUserInput(e);
repaint();
}
@Override
public void keyReleased(KeyEvent e) { }
@Override
public void keyTyped(KeyEvent e) { }
public static void main(String[] args) {
ApplicationMain app = new ApplicationMain();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
app.setVisible(true);
}
}