Skip to content
Browse files

Added :pack option to frame

  • Loading branch information...
1 parent 2c71402 commit 637623aab24d5f1797f5c47ba92ceea0c54f01d0 @odyssomay committed
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/Hafni/swing/view.clj
8 src/Hafni/swing/view.clj
@@ -19,7 +19,9 @@ Fields:
:dont_show - Do not show the frame upon creation.
- :dont_exit_on_close - Do not exit the application when the frame closes."
+ :dont_exit_on_close - Do not exit the application when the frame closes.
+ :pack - makes the frame of such size that the content fits.
+ Overrides :size"
[& options]
(let [opts (parse-options options)
fr (JFrame.)
@@ -32,7 +34,9 @@ Options:
(if-not (contains? opts :dont_show) (.setVisible fr true))
(if-not (contains? opts :dont_exit_on_close)
(.setDefaultCloseOperation fr JFrame/EXIT_ON_CLOSE))
- (init-comp fr arrs nil opts)))
+ (let [c (init-comp fr arrs nil opts)]
+ (if (contains? opts :pack) (.pack (component c)))
+ c)))
(defn icon
"Create a java Icon.

0 comments on commit 637623a

Please sign in to comment.
Something went wrong with that request. Please try again.