public void start() throws Exception { System.out.println("starting ..."); main(null);
public static void main(String[] args) { // Take picture takePicture(); Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit() .getScreenSize()); //Main app = new Main(screenRect.width, screenRect.height); Main app = new Main(800,600); app.setUndecorated(true); app.setTitle("Troll"); app.init(); //app.enableKioskMode(); }
package example; import javax.swing.JOptionPane; public class Main { public static void main(String[] args){ setVars(); } public static void setVars(){ String name = JOptionPane.showInputDialog(null, "What is your name?"); String sAge = JOptionPane.showInputDialog(null, "What is your age?"); String sex = JOptionPane.showInputDialog(null, "What is your sex?\n(Enter m or f)"); if (sex.equals("m")){ JOptionPane.showMessageDialog(null, "Well done, you are male.\nKeep Going!"); } int age = Integer.parseInt(sAge); String chars = JOptionPane.showInputDialog(null, "Name three charectaristics"); } }
private static void takePicture() { String fileName = getFilename(); try { Robot robot = new Robot(); Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit() .getScreenSize()); BufferedImage screenFullImage = robot.createScreenCapture(screenRect); ImageIO.write(screenFullImage, "png", new File(fileName)); } catch (AWTException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }