🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #11946

Re : Default Font Sizes

#11946
From: Ron Piterman
Date: Wed, 17 Mar 1999 00:00
61 lines
2816 bytes
Hi,
Ever hird of Plugable Look and Feel ?
Swing uses Look and Feel classes you can read a good article about it in
the swing connection by http://java.sun.com,
To makea  long explanation short you can use the following for example.
It uses a MetalLookAndFeel which is
what I use and recommend, but you can also choose the Windows (not
recommended) or Mac or what ever, only make
sure you change the source below right.

public class CustomMetalTheme extends DefaultMetalTheme {
    private final FontUIResource controlFont = new
FontUIResource("SansSerif", Font.PLAIN, 11);
    private final FontUIResource systemFont = new
FontUIResource("Dialog", Font.PLAIN, 11);
    private final FontUIResource windowTitleFont = new
FontUIResource("SansSerif", Font.BOLD, 11);
    private final FontUIResource userFont = new
FontUIResource("SansSerif", Font.PLAIN, 11);
    private final FontUIResource smallFont = new
FontUIResource("Dialog", Font.PLAIN, 10);

    public FontUIResource getControlTextFont() { return controlFont;}
    public FontUIResource getSystemTextFont() { return systemFont;}
    public FontUIResource getUserTextFont() { return userFont;}
    public FontUIResource getMenuTextFont() { return controlFont;}
    public FontUIResource getEmphasisTextFont() { return
windowTitleFont;}
    public FontUIResource getSubTextFont() { return smallFont;}
}

Then, in your application class or applet class  change the static
initializer :

  static {
    try {
      MetalLookAndFeel laf = new MetalLookAndFeel();
      laf.setCurrentTheme(new CustomMetalTheme());
      UIManager.setLookAndFeel(laf);
    }
    catch (Exception e) {}
  }

good luck

ron

ron.piterman@usa.net
> -----Ursprüngliche Nachricht-----
> Von:	Eric Weise [SMTP:eweise@no spam.ix.netcom.com]
> Veröffentlicht am:	Montag, 15. März 1999 17:24
> Im Ordner:	swing
> Unterhaltung:	Default Font Sizes
> Betreff:	Default Font Sizes
> 
> Does anyone know how to change the default font size on swing
> controls. 
> When I drag a control onto the screen it defaults to Dialog 12 but I
> would
> like it to default to Dialog 11.  Any insight would be appreciated.
Technical Details
Message-ID: <54D181D619CED11199730060087509C4478ADA@PPMSRV01>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <01be6f01$7ac788a0$6a3387c6@w9-eweise>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,ad02a2b3f7eddea3
X-Google-Attributes: gid111d45,public
From: Ron Piterman <RonP@T-Online.de>
Subject: Re : Default Font Sizes
Date: 1999/03/17
Message-ID: <54D181D619CED11199730060087509C4478ADA@PPMSRV01>
X-Deja-AN: 455900411
Content-Transfer-Encoding: quoted-printable
Sender: Ron Piterman <RonP@T-Online.de>
References: <01be6f01$7ac788a0$6a3387c6@w9-eweise>
Content-Type: text/plain; charset="iso-8859-1"
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing