import javax.swing.JOptionPane; public class WelcomeText extends Actor { /** * Act - do whatever the WelcomeText wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { // Add your action code here. String longString = "Welcome to Highway Traffic (Ver. Mandarin)" + System.getProperty("line.separator")+"click here to play"; setImage(new GreenfootImage( longString, 30, Color.YELLOW, Color.PINK)); if (Greenfoot.mouseClicked(this)){ String inputValue = JOptionPane.showInputDialog("Enter name.. "); LevOne lev = new LevOne(); Greenfoot.setWorld(lev); } } }