Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public static void writeString(Terminal t, String s) {
  2. for(char c : s.toCharArray())
  3. try {
  4. t.putCharacter(c);
  5. } catch (IOException e) {
  6. e.printStackTrace();
  7. }
  8. }
  9. public static void main(String[] args) throws Exception {
  10.  
  11. DefaultTerminalFactory terminalFactory = new DefaultTerminalFactory();
  12. Terminal t = terminalFactory.createTerminal();
  13. writeString(t, "Hello!");
  14. Timer s = new Timer(2000,new ActionListener() {
  15. @Override
  16. public void actionPerformed(ActionEvent e) {
  17. System.out.println("aaa");
  18. writeString(t,"Yoinks");
  19. }
  20. });
  21.  
  22. s.setRepeats(false);
  23. s.start();
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement