File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" UTF-8" ?>
22<projectDescription >
3- <name >Baseprogram </name >
3+ <name >BaseProgram </name >
44 <comment ></comment >
55 <projects >
66 </projects >
Original file line number Diff line number Diff line change 1+ import base.Baseprogram;
2+
3+ println("Integer: " + Baseprogram.readInt());
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ ant.description=ProcessingLibs Ant build file.
7272# Project details.
7373# Give your library a name. The name must not contain spaces or special characters.
7474
75- project.name =Baseprogram
75+ project.name =BaseProgram
7676
7777# The name as the user will see it. This can contain spaces and special characters.
7878
Original file line number Diff line number Diff line change 4242 *
4343 */
4444
45- public class Baseprogram
45+ public class BaseProgram
4646{
4747
4848 public final static String VERSION = "##library.prettyVersion##" ;
4949
50+ /**
51+ * Open a dialog so that the user can enter an integer value
52+ *
53+ * @return -1 in case of error, the entered number otherwise
54+ */
5055 public static int readInt ()
5156 {
5257 while (true )
5358 {
5459 try
5560 {
56- String lInput = JOptionPane .showInputDialog ("Bla" );
61+ String lInput = JOptionPane .showInputDialog ("Please enter a number" );
62+ if (lInput == null )
63+ {
64+ return -1 ;
65+ }
5766 return Integer .parseInt (lInput );
5867 }
5968 catch (NumberFormatException pExc )
You can’t perform that action at this time.
0 commit comments