Font 1 « Development « Java Swing Q&A





1. How can I create a Java/Swing text component that is both styled and has a custom font?    stackoverflow.com

How can I create a Java/Swing text component that is both styled and has a custom font? I want to highlight a small portion of the text in red, but at ...

2. the right way to select monospaced fonts in Swing    stackoverflow.com

I'm messing around with DefaultStyledDocument and am trying to figure out the right way to set a style to the proper monospaced font. By "proper" I mean that the font selected ...

3. bold fixed fonts in Java Swing    stackoverflow.com

I'm trying to use fixed width fonts in Java. I can use Courier or Lucida Console, but when I apply a "bold" style, it makes the characters larger in width and ...

4. Testing whether a Font is monospaced in Java    stackoverflow.com

I'm trying list all of the monospaced fonts available on a user's machine. I can get all of the font families in Swing via:

String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment()
     ...

5. Java: Altering UI fonts (Nimbus) doesn't work!    stackoverflow.com

I'm referring to this Nimbus reference. I tried to set global Font to be slightly larger:

UIManager.put("defaultFont", new Font(Font.SANS_SERIF, 0, 16));
...works only for the menu but nothing else (buttons, ...

6. Strike through java.awt.Font    stackoverflow.com

Is there a way to make a java.awt.Font strike through?

7. sun.font.TrueTypeFont Memory Leak?    stackoverflow.com

I've been profiling some Java software using heap dumps and there is 350 instances of sun.font.TrueTypeFont, in other heap dumps I have taken there have been more. There is only ...

8. Getting system font properties in Java/Swing    stackoverflow.com

I am working on a Java application using Swing and I want to set up the GUI using the "proper" fonts and font sizes. With proper I mean the fonts (+size) ...

9. Java Swing Font Chooser    stackoverflow.com

In my Java Swing application I want to allow the user to pick their font. To my surprise there is no core swing library to pick fonts. I expected to find ...





10. SWING: cannot reset font superscript    stackoverflow.com

I have textpane getting generated. i need to supercript the text when the text is selected and during click of superscript button, i need to superscript the text. if the ...

11. Really slow obtaining font metrics    stackoverflow.com

So the problem I have is that I start my application by displaying a simple menu. To size and align the text correctly I need to obtain font metrics and I ...

12. Swing load available font family slow down the performance    stackoverflow.com

After I add in this code to load the available font family and add it in to combobox

 GraphicsEnvironment ge = GraphicsEnvironment.
  getLocalGraphicsEnvironment();
String[] fontNames = ge.getAvailableFontFamilyNames();
It load very slow took ...

13. Why does Java Swing html font rendering look so crappy?    stackoverflow.com

To display a complex multi-line label with multiple styling I use Swing's html rendering capabilities and end up with really crappy font rendering. I have tried to explicitly set the font family ...

14. How to set Font from String in Java    stackoverflow.com

I have an CMS application which is written using C# ,and i should Save FONT's as VARCHAR in a Database ,than i should get the specified FONT from a Java Application ...

15. how change font of all of my components in java    stackoverflow.com

I want to change or modify font of all om my JFrame. Like just one time I change font and all the frame font size change to new thing. Previous time I changed ...

16. Java Native language Application Doesnt work outside IDE    stackoverflow.com

I have a program developed under java with netbeans. It has a text pane that takes text written in non English language and do some operation including save open new..... The program ...





17. Setting the Global Font for a Java Application    stackoverflow.com

I need to set the the default font for my application. Is there a way to do this that is not LaF dependent?

18. Font Selection for Form Application    stackoverflow.com

I am bit confused about chosing font for my winform application. I want to chose a font which will go smoothly on Win7/XP/Vista. My application has been designed with windows Office2007 ...

19. Is it possible/How to to embbed a font set in a Java Swing application?    stackoverflow.com

Possible Duplicates:
Accessing custom font from Jar
embedding a font in Java
Java offers a Font class which can be use to ...

20. How to change the Font in the entire Swing UI application    stackoverflow.com

I have made a swing application. Now I want to change the Font of entire Swing Application , so that any component being added should follow that Font only. Is there any ...

21. swing: which fonts to use for better portability?    stackoverflow.com

I'm writing swing window. I need to display it on several OS (Windows/Linux/Solaris is minimal). Different controls in my window use different fonts - Tahoma, MS Sans Serif, Monospace and others) I tried ...

22. What is the difference between FontMetrics.stringWidth() and FontMetrics.getStringBounds()?    stackoverflow.com

I need to find the width of the text that is drawn on the screen. This thread suggests that the FontMetrics.stringWidth() will sometimes not be as accurate as FontMetrics.getStringBounds(). Does ...

23. Resize font based on string length    stackoverflow.com

From an xml file, I'm given a width, height and id. All of them can and do vary very quickly. Now, I'm asked to draw a rectangle using the width and ...

24. What font in Swing looks the same in all OS?    stackoverflow.com

I use Netbeans 7.0 with JDK6 under Windows 7 to design the user interface of my Java application. I apply System look and feel. But it looks the way I want ...

25. Java Swing Null Pointer Exception    stackoverflow.com

I tried to run this very basic Swing program: http://download.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java and got an error:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
   ...

26. Java Font problem    stackoverflow.com

Say I have a Swing JComponent and I set a Font for the text of that JComponent. I build the project and create a .jar file of my project. Now, If ...

27. How to do Font Smoothing for AWT/Swing Application    stackoverflow.com

I need to do font smoothing for a AWT application on Windows System. On doing googling I came to know that I can set following VM argument in Eclipse.

-Dawt.useSystemAAFontSettings=gasp
But this is not ...

28. WindowsLookAndFeel - What font is used - Is there a way to change it    stackoverflow.com

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); What font gets used? If I have an app, which is using the windowslookandfeel, is there a way to change the font used on a local system, by changing the default ...

29. Swing Scale a Text Font of Component    stackoverflow.com

I want to set the font size of button on componentResized event. I get the screensize and the size of the button. But can't get a way to calculate the preferred ...

30. swing create font    stackoverflow.com

I have some custom components with overriden paintComponent(Graphics g) method. In some components drawString() method from Graphics g object is used. I want to define custom fonts for such drawn strings. I have ...

31. Extremely small fonts in both installer and Netbeans itself using GTK LAF    forums.netbeans.org

In my Fedora 11 with KDE 4.3 using QtCurve theme Netbeans has very small fonts. Other swing applications are fine. netbeans.conf options are:

32. GUI designer: See font settings instead of "quick brown fox"    forums.netbeans.org

Hi folks: In the GUI designer, for components that have text, the Properties pane's font slot shows a sample of the text instead of the actual font settings. Ie: it shows ...

33. Font property of Swing Component    forums.netbeans.org

Hi I want to modify the font property of Swing components and in its creation of a new component to have the definite font previously. Is it possible? In the attachment figure, in the inferior right side, has the definition standard for one component JTextField with the font "Tahoma 11 Plano". Can I modify - I do not know where - ...

34. Problem with ide gui font    forums.netbeans.org

Hello can someone please help , I have a problem where I can't read The startup page correctly because of a font language problem. Have attached a screen shot you can see my problem. Also can't read help files have same problem

35. Changing the font of a Swing Application Title at Runtime    forums.netbeans.org

Hi, I am using NB to develop a swing application. I want to change the font of the application title by italicising it during runtime when some changes are made to the application. How can I do this. I know I can change the title by getFrame().setTitle(). But how do I change the title of the font? Thanks.

36. Scaling Fonts    coderanch.com

37. Bitstream .PFR Fonts    coderanch.com

38. New Fonts in Java Runtime    coderanch.com

OK... for windows, you would copy the font file to the windows font directory... I am not sure how to install fonts on other systems, but the first step to make this work is to actually install a font to your system. Anyway, once you have the font installed, you need to find out what the font is actually named, according ...

39. using two fonts at time    coderanch.com

40. Is there a Font Choosing component available in Swings ?!!    coderanch.com

Hi I need to popup a Font Selection Dialog(similar to a ColorChooser or a FileChooser dialog) when a mouseclicked event occurs in a button. The user must be able to select the font type, name and size when the dialog pops up. Is there a FontChooser type in Swings ?!!If so, please mail me the link or any sample code otherwise. ...

41. weirdness with fonts    coderanch.com

I've created a dialog that acts as a font chooser. It seems to work most of the time. The font style (bold, italic, etc) doesn't always update the text in the textfield (I also tried label) until I modify the size of the font. I even look at the font to see if it is set right (it is), and I've ...

42. Font - Webdings    coderanch.com

43. Universal Font    coderanch.com

I would just like to know what the default font is in Windows so that I can set that as the default so that when I take my App over to Linux, it looks the same. As it is now, the font is spaced and seized different and appears larger. ------------------ Happy Coding, Gregg Bolinger

44. Getting the font list    coderanch.com

45. Font type supported by java    coderanch.com

46. Changing Font    coderanch.com

48. External Font usage    coderanch.com

49. Font    coderanch.com

50. Setting RowHeader Font ???    coderanch.com

51. To show PFM Font    coderanch.com

52. font portability    coderanch.com

I'm working on a GUI project and we're having some issues with fonts between running the app on windows and linux. I develop on windows... get it looking sharp.... move it to linux and it looks like crap. The guy I'm working with develops on linux, gets it looking sharp, moves it to windows and it looks like crap. Everything is ...

53. Java Font, help!!! URGENT!!!    coderanch.com

54. Font    coderanch.com

55. Listing fonts is a problem here    coderanch.com

56. Problem in Font    coderanch.com

57. LineBreakMeasurer and Fonts    coderanch.com

58. Changing the font of few words in a line in awt    coderanch.com

hi, I like to change the font of only few words in line not the entire line. i dont know how to do that in awt. for eg. if we get tag in the line i should be able to display only those particular words as bold and others as plain. i am attaching the code i have worked on,the ...

59. font in chinese operating system    coderanch.com

hi there, maybe i will rephrase my problem. am using a canvas and displaying a message on this canvas. have set the font for the canvas to verdana. problem is this works fine running it on my system. the moment i run this on a chinese operating system or on a system whose locale is set to china the applet on ...

60. Font Merics, playing Tricks.    coderanch.com

Howdy! All! Well, I have noted that there seems to be some problem between the Rectangle2D objects' getHeight method. The one in JDK 1.3 gives a height greater than that in JDK 1.4. Has anyone else come across this problem?? Is there is a work around?? Am I alone?? Regds Lupo import javax.swing.*; import java.awt.*; import java.awt.font.*; import java.awt.geom.Rectangle2D; public class ...

61. Fixed font in java    coderanch.com

Hi, I am displaying text in an scroll pane. i am presently using "Dialog" font with font size of 12 . i have to display all the text in fixed font, do i need to change the entire font itself or just need to do some modification using fontmetrics . Thanks Regards Chandhrasekar Saravanan

62. how to change fonts    coderanch.com

63. Font    coderanch.com

64. Java Font?    coderanch.com

66. java Font???    coderanch.com

67. Specify range of Fonts to use.    coderanch.com

I know that if I use HTML in my Label creation, I can use the Font tag to specify a range of Fonts to be used just like on an HTML page. But what I am wondering is if there is a way to do this with the Font object in JAVA without going through some if else logic. I know ...

68. Font type    coderanch.com

69. MS UI Gothic Font problem    coderanch.com

For MS UI Gothic font, I cann't see the differnce between plain style and bold for font size smaller than 9. Here is my sample application: import javax.swing.*; import java.awt.*; import java.awt.event.*; public class FontTest extends JFrame{ public FontTest(){ this.getContentPane().add(new CustomPanel(),BorderLayout.CENTER); pack(); setSize(300,400); show(); this.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent we){ System.exit(0); } }); } public static void main(String args[]){ new FontTest(); ...

70. Font not found?    coderanch.com

HI all, I am running a jsp to draw a JPEG graph and output to web browser. It`s running perfect on my pc, but when I execute it on my solaris server, the graph cannot be drawn, the error message is Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific] anyone know how to fix it??

71. Possible to Change Selected Text Font ?    coderanch.com

72. font problem    coderanch.com

Hai all i suspect this may not be the right place for the post!!! (if not inform me the right place) frankly i need urgent help... i have a GUI application. that has to display Indian Language text. the font has glyph code sequence from 32 to 254. but some glyphs are having out of sequence numbers. like after a glyph ...

73. Win XP Win 98 fonts    coderanch.com

74. Other Language Fonts    coderanch.com

75. Displaying fonts of different languages!!!!!    coderanch.com

Hello Everyone, I need some help regarding the display of fonts of languages other than English. I wish to display Hindi and Telugu fonts on Labels and text fields using Java Swing. Can some one tell me how to go about it? I have the required ttf files, which work on Windows. This a bit urgent!!! Thanks. Jyothsna.

76. Deferent Font    coderanch.com

where you build your gui //change gui theme MetalTheme theme = new myThemeClass(); MetalLookAndFeel.setCurrentTheme(theme); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch(Exception e) { System.out.println("Error loading gui theme"); }//end catch I'd just pop this in its own class, incase you want to extend your theme later. public class myThemeClass extends DefaultMetalTheme { //Fonts private final FontUIResource windowTitleFont = new FontUIResource("Monospaced", Font.PLAIN, 15); private final ...

77. Increase Fonts in Fraction    coderanch.com

78. How to change the font of a whole application?    coderanch.com

The easiest way to do this would be something like this : public static void setGlobalFont( Font font ) { Enumeration enum = UIManager.getDefaults().keys(); while ( enum.hasMoreElements() ) { Object key = enum.nextElement(); Object value = UIManager.get( key ); if ( value instanceof Font ) { UIManager.put( key, font ); } } } However, that means the font for *everything* is ...

79. Some fonts render, some fonts don't    coderanch.com

Using the normal drawString method of the Graphics object on a JPanel, I render different fonts (no fancy characters, just your basic abc). They can be selected by the user from a list of fonts obtained from the GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() method. Now some fonts can be rendered and some fonts only display squares. The same fonts can be used without problems by ...

80. Embeding fonts in Java    coderanch.com

81. Font problem    coderanch.com

There are multiple problems here... Under some JVM/OS combinations the JVM is pretty good at finding the installed fonts on the system and using those, under others, you have to go to great lengths to install fonts (i.e. install them in the lib/fonts directory of the JRE, then edit font.properties to include them correctly). This is for applications. You have an ...

82. Get the list of Fonts    coderanch.com

83. fonts problem with jdk1.4    coderanch.com

it is running on the same pc. i use jdk1.3 with JBuilder 6, and jdk1.4 with JBuilder 9, and i can run it both on the same time: JBuilder6 is showing my project ok, and jbuilder9 is showing my project with an entirely diffrent fonts(I should also say that it happens only with Text shown on a Jlabel, a text which ...

86. Telugu Font in SWINGS    coderanch.com

87. How to read glyphs in a font?    coderanch.com

Hi all, I'm pretty new to Java and am having trouble with what I thought would be a very simple project. What I want to do is simply load a font and loop through it; for each glyph in the font output the Unicode value. Sounds easy. I've been able to get the font open, and get some basic info about ...

88. Problem in changing the font    coderanch.com

89. Font Mapping    coderanch.com

90. using font created by createFont    coderanch.com

91. Adding fonts to GraphicsEnvironment    coderanch.com

93. Japanse font (Urgent! Please help)    coderanch.com

94. Cross Platform Fonts    coderanch.com

Hi, I am currently trying to develope a system which is required to run on various operating systems (windows\ linux\ solaris etc..). My problem is that i would like to use various fonts, however i cannot use the fonts specific to the devlopement enviroment (windows) as they are not present on the other platforms (and would therefore ruin the design). I ...

95. I can change fonts only once in the runtime    coderanch.com

Hi, I have a multi-language application. Sometimes I need fonts to be changed while working. I use JFontChooser in order to select a new font, then call the changeFonts(sf) method. In the first call of changeFonts(sf) everything works as expected. However, when I call the same method with a different sf parameter for a second, or more calls nothing happens. What ...

96. Changing Fonts.    coderanch.com

97. How to create a ttf font using java    coderanch.com

98. font family of empty DefaultStyledDocument    coderanch.com

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - ...

99. Fonts on two Solaris machines    coderanch.com

100. Help me with the font ... T_T    coderanch.com