Skip to content

Commit

Permalink
Merge pull request #49 from EliasAAradsson/docs-improvements
Browse files Browse the repository at this point in the history
Improve documentation for Dialog
  • Loading branch information
bjornregnell authored Nov 9, 2024
2 parents af4e1c0 + d629077 commit f65e99e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/scala/introprog/Dialog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ object Dialog:

Swing.init() // get platform-specific look and feel

/** Show a file choice dialog starting in `startDir` with confirm `button` text. */
/**
* Show a file choice dialog starting in `startDir` with confirm `button` text.
*
* @param button the text displayed in this file choice dialog's confirm button
* @param startDir the starting directory of this file choice dialog
* @return the file path entered by user upon pressing confirm button,
* an empty `String` if user pressed the file choice dialog's cancel button
*/
def file(button: String = "Open", startDir: String = "~"): String =
val fs = new JFileChooser(new java.io.File(startDir))
fs.showDialog(null, button) match
Expand Down

0 comments on commit f65e99e

Please sign in to comment.