Font size « Development « Java Swing Q&A





1. Are there any built-in methods in Java to increase Font size?    stackoverflow.com

Are there any built-in methods in Java to increase Font size?

2. Changing font-size at runtime in a Swing application    stackoverflow.com

A lot of web sites these days have an option to let the user increase or decrease the size of the font that appears on the site. I'd like to ...

3. Getting fonts, sizes, bold,...etc    stackoverflow.com

I'm having trouble finding stuff on accessing Windows fonts or predefined fonts, and sizes. So for my java program I have a JComboBox with fonts, sizes, and colors. The problem is ...

4. How to set a custom font's size and other attributes (bold, italic, etc) in Java SWING    stackoverflow.com

Usually, when I initialize the fonts I want to use in my SWING applications, I do it this way:

public static final Font TITLEFONT = new Font("Calibri", Font.BOLD, 40);
Now, I have to ...

5. Changing the font size in java GUI    stackoverflow.com

The problem: when I change the font size in Display Properties (specifically in Control Panel), the font in the GUI does not change. The following steps give more explanation about the problem: ...

6. Change Font based on screen size change    stackoverflow.com

In my Java Swing application, I have buttons. If the screen size is changed, I want to change the font of my button text also. How do I implement it?

7. GUI: font size issue, and Preview not representative    forums.netbeans.org

gwideman Joined: 01 Nov 2009 Posts: 7 Posted: Sun Nov 01, 2009 11:21 am Post subject: GUI: font size issue, and Preview not representative Hi folks: (If this ...

8. font size with PrintJob    coderanch.com

Hi, I have the following problem : I'm using ICE Browser, the web page I'm on is like a form. In ICE I see it perfectly, but when I print it the size of the font almost double and the input box get also bigger. Since I must use jdk 1.1 here my code for the printing : private void imprimer(){ ...

9. How do i apply font styles and sizes to a string ?    coderanch.com

Here's a basic demo from this site import java.applet.Applet; import java.awt.Graphics; import java.awt.Font; public class DemoFont extends Applet { private Font font1, font2, font3; public void init(){ // create a font object: 12-point bold times roman font1 = new Font( "Serif", Font.BOLD, 12 ); // create a font object: 24-point italic courier font2 = new Font( "Monospaced", Font.ITALIC, 24 ); // ...





10. Font size    coderanch.com

Ummm... actually it's really easy to do this... import java.awt.*; import javax.swing.*; public class MenuTest extends JFrame { public static void main( String[] arg ) { new MenuTest(); } public MenuTest() { Font bigFont = new Font( "Serif", Font.BOLD, 24 ); Font littleFont = new Font( "Monospaced", Font.ITALIC, 10 ); JMenuBar mb = new JMenuBar(); JMenu fileMenu = new JMenu( "File" ...

11. changing font type and size    coderanch.com

12. Changing the font size of iorder    coderanch.com

Hi guys I have a problem related to the TitledBorder.When we draw a titled border in a component it takes some space inside the component.In my case it is messing up the painting of my custom component because the font size of the titledborder is quite big. I want to know is it possible to reduce the size of the font ...

13. Changing Font Size - Swing    coderanch.com

14. Increase font size across application    coderanch.com

FontUIResource f = new FontUIResource(new Font("Gothic", Font.PLAIN, 10 + (int) (Math.random() * 20))); for (Enumeration enum = UIManager.getDefaults().keys(); enum.hasMoreElements() :wink: { Object k = enum.nextElement(); Object v = UIManager.getDefaults().get(k); System.out.println(k + " " + v.getClass().getName()); if (v instanceof FontUIResource){ f = (FontUIResource) v; if (f != null) { f = new FontUIResource(new Font(f.getName(),f.getStyle() , f.getSize() + 2)); } UIManager.getDefaults().put(k, f); } ...

16. font size and style    coderanch.com

import java.awt.*; import java.awt.event.*; import javax.swing.*; public class FontChanges implements ActionListener { Font hiFont, loFont; JTextField hiField, loField; public FontChanges() { hiFont = new Font("dialog", Font.PLAIN, 18); // lucida fonts found in your sdk src folder: jre/lib/fonts/ loFont = new Font("lucida bright regular", Font.PLAIN, 18); } public void actionPerformed(ActionEvent e) { JButton button = (JButton)e.getSource(); String ac = button.getActionCommand(); if(ac.equals("style")) changeStyle(); ...





17. font size, and dialogbox    coderanch.com

18. How to find font size defined in user environment    coderanch.com

Hi experts. I am writing a stand-alone desktop application on Linux. On Linux, a user can change font style/font size etc from the gui easily. So, I would like to know about the font setting that a user choose to display. I am using UIManager to get a look and feel. By knowing the font size defined by a user, I ...

19. changing font style and size    coderanch.com

20. How to change cursor height based on Font size    coderanch.com

Hello friends, sir, madam I am using JTextPane and in that textpane I have certain paragraphs. If I select certain words on a line and change the font then the cursor height automatically increases. Now I press the right arrow key to move the cursor towards right. When the cursor is on a font of smaller size then the height of ...

21. Puzzle in getting OS's FONT_SIZE    coderanch.com

There is no single list of system-wide font sizes. Sometimes fonts are available in a few discrete sizes only (bitmapped fonts), but they're rare these days. Most fonts are PostScript, TrueType or OpenType fonts, all of which can be scaled to any desired size. So unless you know that -for whichever font you need to display the sizes- only some sizes ...

22. headerFormat font size problem    coderanch.com

The Printable constrains what it draws to the printable area of each page that it prints. Under certain circumstances, it may find it impossible to fit all of a page's content into that area. In these cases the output may be clipped, but the implementation makes an effort to do something reasonable. Here are a few situations where this is known ...

23. change metal L&F font size    coderanch.com

24. Different font size on different monitors?    coderanch.com

Hi! I'm making an application for multiple monitors. The first monitor is a normal monitor, the second one is a 5 megapixel monitor. The application instantiates a JFrame for each graphic device. Is there any possibility to set different font sizes for the frames, and to have all the components added to the frame with the set font size? (I mean, ...

25. How can I increase the size of a Font?    coderanch.com

26. font size for entire application    coderanch.com

import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Enumeration; class Testing { public void buildGUI() { //setApplicationFont(new javax.swing.plaf.FontUIResource(new Font("monospaced",Font.ITALIC,18)));//run this with the second method final JComboBox cbo = new JComboBox(new String[]{"6","8","10","12","14","16","18","20"}); JPanel p = new JPanel(new GridLayout(0,1)); p.add(new JLabel("I'm a label")); p.add(new JButton("I'm a button")); p.add(cbo); final JFrame f = new JFrame(); f.getContentPane().add(p); f.pack(); f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); cbo.setSelectedIndex(3); cbo.addActionListener(new ActionListener(){ public void ...

27. Bold Style is not applicable for font of float size    coderanch.com

Hi, We are using jawa.awt.font package to apply font styles to text in applet. We have to use font of float size that is 8.5 and 9.5 size. We use font.deriveFont(float size) to get a font object in float size. By using this we are able to apply regular and italic font styles for 8.5 point size. When we tried applying ...

29. Chars beyond 0x00ff not displaying correctly for certain font sizes - please help?    coderanch.com

Hi, I have an swt table, where i use the character 0x25ba (among a few others) to denote an arrow. it works well, except one issue - For font sizes <9, it shows up as a vertical line, as well as for sizes 10, 12, 14. these are the sizes i care about, since the user is able to change the ...

30. Changing the font size in java GUI    coderanch.com

31. how can I change font size?    java-forums.org

In a JPanel component, I can draw text: JPanel myPanel = new JPanel() myPanel.getGraphics().drawString("hallo world", 50, 50); But I can't see how to change the *size* of the text (which is point size 12). There is no 'setFontSize(...)' method. There *is* a setFont() method. But that looks like you have to define a new font of your own. So I'm thinking ...

32. Changing the font size in java GUI    java-forums.org

1) The titlebar Is actually a Windows component. Swing components are just displayed in a native OS frame. So I guess the native frame which is displaying the native titlebar is aware of the font size. 2) These are Swing components. The Font properties of each component are controlled by the UIManager. They are not aware of the OS font settings. ...