Skip to content

Commit

Permalink
Merge pull request #50 from EliasAAradsson/docs-improvements
Browse files Browse the repository at this point in the history
Docs improvements
  • Loading branch information
bjornregnell authored Nov 17, 2024
2 parents f65e99e + 9a7d156 commit ac5824d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/scala/introprog/Dialog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ object Dialog:
/** Show a dialog with a `message` text. */
def show(message: String): Unit = JOptionPane.showMessageDialog(null, message)

/** Show a `message` asking for input with `init` value. Return user input.
/**
* Show a `message` asking for input with `init` value. Return user input.
*
* Returns empty string on Cancel. */
* @param message prompt text displayed for user
* @param init intitial value displayed in input dialog
* @return user input, or an empty string on Cancel
*/
def input(message: String, init: String = ""): String =
Option(JOptionPane.showInputDialog(message, init)).getOrElse("")

Expand Down

0 comments on commit ac5824d

Please sign in to comment.