2016-10-05 13:22 GMT+02:00 Sanel Zukan <san...@gmail.com>:
> Setting fonts under Seesaw isn't the most intuitive option, so you'd
> have to dig into Swing core for this and investigate
> java.swing.UIManager documentation.
>
> Here is a function that I often use in my applications:
>
> (defn set-font
>   "Set default font for the whole Swing application. Make sure
> to call it before UI was shown."
>   [name size]
>   (let [res  (FontUIResource. name Font/PLAIN size)
>         what ["Button.font" "ToggleButton.font"
>               "RadioButton.font" "CheckBox.font"
>               "ColorChooser.font" "ComboBox.font"
>               "Label.font" "List.font"
>               "MenuBar.font" "MenuItem.font"
>               "RadioButtonMenuItem.font"
>               "CheckBoxMenuItem.font" "Menu.font"
>               "PopupMenu.font" "OptionPane.font"
>               "Panel.font" "ProgressBar.font"
>               "ScrollPane.font" "Viewport.font"
>               "TabbedPane.font" "Table.font"
>               "TableHeader.font" "TextField.font"
>               "PasswordField.font" "TextArea.font"
>               "TextPane.font" "EditorPane.font"
>               "TitledBorder.font" "ToolBar.font"
>               "ToolTip.font" "Tree.font"]]
>     (doseq [key what]
>       (UIManager/put key res))))
>
> I use it like:
>
> (defn runner []
>   (seesaw/native!)
>   (seesaw/invoke-later
>    (set-font "Sans Serif" 11)
>    (seesaw/show! <here-comes-form-builder>)))

Thanks that works. I should put it always on my high-resolution screen then.

Two points:
When using:
    (seesaw/invoke-later
I get:
    Exception in thread "main" java.lang.RuntimeException: No such
namespace: seesaw

What do I need to do to get rid of this?

Is it possible to increase the font in the title from the window?
Probably not, because I think that is done by the Operating System.
But maybe I am wrong.


> On Wednesday, October 5, 2016 at 10:47:14 AM UTC+2, Cecil Westerhof wrote:
>>
>> I already asked it on Clojure-seesaw, but the last three months there
>> has been no activity there. So I ask it here also.
>>
>> Some time ago I wrote a Clojure program that uses SeeSaw. I just
>> bought a high resolution monitor and now I cannot read the text in my
>> JFrames anymore. How can I increase the default font size?
>>
>> I create the frames like:
>>       (let [
>>         ^JFrame
>>         other-frm     (frame :title "Other"              :on-close
>> :hide    :resizable? false)
>>
>> I now generate buttons like:
>>     ^JButton
>>     all-authors   (button :text "All Authors"
>>                           :font {:size 25}
>>                           :listen [:action (fn [e] (show-all-authors))])
>>
>> But I have to set the font for every label in this way.
>>
>> At another part I have:
>>           (grid-bag-layout
>>            search-panel
>>            :fill  :HORIZONTAL
>>            :ipadx 8
>>            :ipady 4
>>            :gridy i
>>            :gridx 0 ^JLabel (label description)
>>            :gridx 1 ^JTextField
>>            (text  :columns 40
>>                   :listen
>>                   [:action (fn [e]
>>                                (let [
>>                                  search-str (text e)
>>                                  ]
>>                                  (when (not (empty? search-str))
>>                                    (function search-str))))
>>                   ]))))
>>
>> At the moment I do not know how to set the font there.
>>
>> Is there also a way to increase/decrease the fontsize in the whole
>> application. I now have amiddle and high resolution screen. It would
>> be nice if when I put things on the other monitor, the fonts would
>> scale.

-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to