Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Application {
- public static void main(String[] args) throws IOException, FontFormatException, URISyntaxException {
- new Application().run();
- }
- private void run() throws IOException, FontFormatException, URISyntaxException {
- URL resource = getClass().getClassLoader().getResource("square.ttf");
- File fontFile = new File(resource.toURI());
- Font font = Font.createFont(Font.TRUETYPE_FONT, fontFile);
- GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
- ge.registerFont(font);
- DefaultTerminalFactory factory = new DefaultTerminalFactory();
- Font loadedFont = font.deriveFont(Font.PLAIN, 25);
- AWTTerminalFontConfiguration fontConfig = AWTTerminalFontConfiguration.newInstance(loadedFont);
- factory.setTerminalEmulatorFontConfiguration(fontConfig);
- factory.setForceAWTOverSwing(true);
- factory.setInitialTerminalSize(new TerminalSize(40, 20));
- Terminal terminal = factory.createTerminal();
- ((AWTTerminalFrame)terminal).addWindowListener(new WindowAdapter() {
- @Override
- public void windowClosing(WindowEvent e) {
- e.getWindow().dispose();
- }
- });
- Screen screen = new TerminalScreen(terminal);
- screen.setCursorPosition(null); // we don't need a cursor
- screen.startScreen(); // screens must be started
- screen.doResizeIfNecessary(); // resize screen if necessary
- screen.setCharacter(10, 10, TextCharacter.fromCharacter('C')[0]);
- screen.refresh();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement