facebook

I saw a post about not being able to set a default font…

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #285578 Reply

    Douglas M Hurst
    Participant

    … for Matisse/Swing.

    Do you think this is worth adding to the Preferences->Matisse dialog? The reason I say this is because, at least in my experience, Tahoma does not present itself at runtime the way it does in the designer. When I switch to Arial, it does present itself properly. In my case, I would like for the default font to be Arial. In fact, If I place a label on a form, then change that font to Tahoma in the properties editor, it then appears the same at runtime.

    I have screen dumps that depict what I see as a problem, but I don’t see any way to attach them to this post.

    I’ll be happy to send them along if you would like to see them.

    It’s a real pain to have to change the font (especially of every label) you place on a form… just to get it to appear at runtime the same as it does at design time.

    #285594 Reply

    Riyad Kalla
    Member

    This is actually a feature, but presented in a slightly odd way that we have an open enhancement on.

    The default font is determined by the LNF used. By default the Matisse designer picks up the platform LNF, so on Windows, that’s the Windows LNF. The problem is we don’t have a nice easy way for *you* to set the LNF in your code besides writing the code yourself. So you design in the platform LNF and when you run it, unless set otherwise, you get the default Metal/Ocean/Nimbus LNF which is where the confusion is coming from.

    The fix is easy enough, adding UIManager.setLookAndFeel(UIManager.getSystemLookAndFeel()); (or something approximately like that) to the first line of your code, then the design and runtime will look the same.

    #285626 Reply

    Douglas M Hurst
    Participant

    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeel());

    I tried putting this in my main and also in the constructor

    getSystemLookAndFeel()

    IS NOT a member of UIManager

    getLookandFeel()

    IS a member, but it didn’t make any difference

    UIManager.setLookAndFeel(UIManager.getLookAndFeel());

    Didn’t seem to be effective. It seems to me, this would simply setLookAndFeel to it’s current value.

    #285628 Reply

    Douglas M Hurst
    Participant

    Ah!!!!!

    getSystemLookAndFeelClassName()

    did the trick.

    #285636 Reply

    Riyad Kalla
    Member

    Good deal, sorry about the snaffu, was going from memory.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: I saw a post about not being able to set a default font…

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

You must be logged in to post in the forum log in