java - How can I add print from ArrayList in AWT? -


i'm trying print out contents of arraylist in awt using for-loop. however, when try compile code , run it, nothing shown. i'm new java, i'm not sure causing this.

import java.applet.applet; import java.awt.*; import java.awt.event.*; import java.time.*; import javax.swing.*; import java.util.arraylist;  public class timedisplay extends applet {     private city washingtondc, beijing, london, tokyo, moscow, timeretrieval;     string temp;     string []cities = {"washingtondc", "beijing", "london", "tokyo", "moscow"};     string [] gmt = {"-4", "+8", "+1", "+9", "+3"};     arraylist displaystrings;     boolean displaytype;  public void init() {     washingtondc = new city("-4", "washington d.c.");     beijing = new city("+8", "beijing");     london = new city("+1", "london");     tokyo = new city("+9", "tokyo");     moscow = new city("+3", "moscow");     displaytype = false;     displaystrings = new arraylist();      //timer     int delay = 1000; //milliseconds     actionlistener taskperformer = new actionlistener() {             public void actionperformed(actionevent evt) {                 if (displaytype = true) {                     (int i=0; i<gmt.length; i++) {                         displaystrings.add(timeretrieval.getcurrenttime12(gmt[i]).tostring());                     }                 }                 else {                     (int i=0; i<gmt.length; i++) {                         displaystrings.add(i, timeretrieval.getcurrenttime(gmt[i]).tostring());                     }                 }                 repaint();             }         };      new timer(delay, taskperformer).start(); }  public void paint (graphics g) {     (int i=0; i<cities.length; i++) {         g.drawstring(arrays.deeptostring(displaystrings.get(i))(), 25, (i+1)*50+25);     }     (int i=0; i<cities.length; i++) {         g.drawstring(cities[i], 25, (i+1)*50);     } } } 


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -