Increase font size across application


Her is a piece of code which attempts to increase the font size by 2. While this works on most components it does not work on JLabel and does not affect already existing JTable headers and Menu.
Any ideas for resolving these issues are welcome.
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); } } if (applet != null) SwingUtilities.updateComponentTreeUI(applet);
Posted On: Tuesday 23rd of October 2012 11:36:40 PM Total Views:  218
View Complete with Replies

RELATED TOPICS OF Swing / AWT / SWT PROGRAMMING LANGUAGE




OutOfMemoryError eventhoug i increased memory size

When i am reading the .png images from server, by using below code. BufferedImage bi = null; InputStream is = null; URL url = new URL(imageUrl.toString()); is = url.openStream(); bi = ImageIO.read(is); imageCache.put(imageUrl.toString(), bi); File outputfile = new File(generateFileName(rt, paint)); ImageIO.write(bi, "png", outputfile); Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.awt.image.DataBufferByte.(DataBufferByte.java:58) at java.awt.image.ComponentSampleModel.createDataBuffer(ComponentSampleModel.java:397) at java.awt.image.Raster.createWritableRaster(Raster.java:938) at javax.imageio.ImageTypeSpecifier.createBufferedImage(ImageTypeSpecifier.java:1056) at javax.imageio.ImageReader.getDestination(ImageReader.java:2879) at com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1263) at com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1560) at javax.imageio.ImageIO.read(ImageIO.java:1422) at javax.imageio.ImageIO.read(ImageIO.java:1326) at net.autodata.customizer.eal.service.ImageUtilityImpl.createImage(ImageUtilityImpl.java:119) at net.autodata.customizer.eal.service.ImageUtilityImpl.generateImages(ImageUtilityImpl.java:65) at net.autodata.customizer.eal.service.EALImageServiceImpl.process(EALImageServiceImpl.java:66) at net.autodata.customizer.eal.xml.EalCatalogXmlReader.main(EalCatalogXmlReader.java:159)
VIEWS ON THIS POST

85

Posted on:

Saturday 22nd September 2012
View Replies!

How to make scrolling area bigger. i.e. increase window size?

I know that you use either the JPanel revalidate() or the JScrollPane revalidate(). Which one I don't know. However, I did both and still it's not resizing. I know that there's some other line of code I needed but can't recall what it was. I thought it might be the JFrame pack() method, but that didn't do it either.
VIEWS ON THIS POST

134

Posted on:

Saturday 22nd September 2012
View Replies!

increase size of scrollpane at run time

hi, How can i increase size of scrollpane at run time i have try scrollpane.setMaximumSize(new Dimension(nw,nh)); but its not working for me....
VIEWS ON THIS POST

123

Posted on:

Saturday 22nd September 2012
View Replies!

how to increase height of jtabbed pane

Hai i need to increase the height of jtabbed pane, I am including three tabbed panes in a single panel and that panel is assigned as a tab to parent tabbed pane but all the three tabbed panes are getting same size due to that some text and text boxes are appearing small in one tabbedpane compare to other tabbedpane how can i change the height of the component in jtabbed pane
VIEWS ON THIS POST

135

Posted on:

Monday 24th September 2012
View Replies!

How to increase/decrease brightness of an image with the use of JSlider slider or JScrollBar

i Had load my image Buffered image now need to brighten it using Slider or scroll-bar so could any one suggest me how to do it If it can done using any ImageJ library then suggest me that also.
VIEWS ON THIS POST

79

Posted on:

Wednesday 26th September 2012
View Replies!

Need help in making my Oval increase in size.

Hi ! I need a little help in creating shapes. Below is my code, but no matter what I do, I cannot make the Oval increase gradually (ie. once I run the program I should be able to see it increase). Any advice
VIEWS ON THIS POST

82

Posted on:

Tuesday 2nd October 2012
View Replies!

how to increase font of JLabel

hey i know how to create JLabel but i dont know how to increase font in JLabel please help me by providing a method
VIEWS ON THIS POST

82

Posted on:

Wednesday 3rd October 2012
View Replies!

How to increase the size of JOptionPane

Can anyone tell me how to increase the size of JOptionPane setSize() and setPrefferedSize() is not working for me...
VIEWS ON THIS POST

84

Posted on:

Wednesday 17th October 2012
View Replies!

I want to increase the Jpanel size so that i can fit a bigger Jlist

I have problem in incresing the size of Jlist so that it can show at least 15 list items. I have a jpanel which has this jlist. I am using null layout for my panel. how to achive this. When trying to increse the size of Jlist i thought jpanel will also increse but it is not doing. Note: when i created the Jpanel i did not mentioned any dimenssions. I am also attaching the screen shot of the panel. Note : Can i use any layout to keep my components as it looks in my attachment
VIEWS ON THIS POST

93

Posted on:

Wednesday 17th October 2012
View Replies!

How to find font size defined in user environment

s. 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 would like to scale GUI components like size of text field, drop down menu etc. Is there any way to find out the user setting (font size) on their environment I checked system property and tookkit, but I could not find anything useful.
VIEWS ON THIS POST

82

Posted on:

Thursday 18th October 2012
View Replies!

How do you increase the size of a JTable header

I would like to make the height of the column headers for a JTable.
VIEWS ON THIS POST

62

Posted on:

Thursday 18th October 2012
View Replies!

Change font style to Bold, Swing, all components

I have to code menu buttons to change the font style between Normal and Bold. The only sample code in my text only references one label whereas I have to code it so all the components, text, dialog, numbers etc change when button selected. The code is: if (mnuBold.isSelected()) { java.awt.Font oldFont = lblOutput.getFont(); java.awt.Font newFont = new java.awt.Font(oldFont.getName(), java.awt.Font.BOLD, oldFont.getSize()): lblOutput.setFont(newFont); } How can I change this code so that it will apply to all the components and not just the lblOutput Is there better code to accomplish this
VIEWS ON THIS POST

75

Posted on:

Sunday 21st October 2012
View Replies!

Changing fonts in JLabel?

So i cant get this to cahnge the font, it always stays the same.. Any ideas top.add(new JLabel("Welcome to the HI Lo Game!") ,new Font("Papyrus", Font.BOLD, 60));
VIEWS ON THIS POST

68

Posted on:

Monday 22nd October 2012
View Replies!

Bold Style is not applicable for font of float size

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 bold style for the same point size text is not changing to bold. Can anyone let us know is there any limitation for bold size for 8.5 size or is there anything else we can do to make the bold work.
VIEWS ON THIS POST

74

Posted on:

Monday 22nd October 2012
View Replies!

change textArea font color

How can I do dynamically change of font color in textArea For example: For the first line I will use blue color: textArea.setForeground(Color.BLUE); textArea.append("first"); for the next line I want to use: textArea.setForeground(Color.BLACK); textArea.append("second"); I try repaint but its not working
VIEWS ON THIS POST

78

Posted on:

Monday 22nd October 2012
View Replies!

headerFormat font size problem

i'm using jTable's print method: public boolean print(JTable.PrintMode printMode, MessageFormat headerFormat, MessageFormat footerFormat) throws PrinterException docs advertise for problems: 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 to occur, and how they may be handled by this particular implementation: In any mode, when the header or footer text is too wide to fit completely in the printable area -- print as much of the text as possible starting from the beginning, as determined by the table's ComponentOrientation. i wonder how i can control header font size TiA
VIEWS ON THIS POST

81

Posted on:

Monday 22nd October 2012
View Replies!

SWT: How to change fonts and colors of components?

how can I change fonts and colors of components in SWT Is there any easy tutorial on this Greetings, Andreas
VIEWS ON THIS POST

54

Posted on:

Monday 22nd October 2012
View Replies!

Change menu and tooltiptext fonts with SWT

, I would like to change fonts of menu and tooltiptext with SWT but I do not know how to do it. I've tried many ways !!! [banghead] Can anyone help me, please
VIEWS ON THIS POST

77

Posted on:

Monday 22nd October 2012
View Replies!

SWT set image on table header, change font

I called TableColumn.setImage() which placed the image to the left of the table column header. But all rows in this column shift to the right leaving en empty space about the size of the icon. Is there a way to keep the content from moving right 2nd question is can I control where to image sit, to the left or right of the table header string 3rd question is if there's a way to set the font of a specific table header Table class has setFont() method, but not in the TableColumn class.
VIEWS ON THIS POST

70

Posted on:

Monday 22nd October 2012
View Replies!

Posting it again (Urgent!) Can't display chinese and japanese font at the same time

The following program tries to display a string that contains mostly japanese characters along with few chinese characters. When I try "java I18NTest zh ZH" it shows all japanese and chinese characters properly except one. When I try "java I18NTest ja JA" its shows the japanese fine but messes up the chinese characters. What do I have to do so that it displays all japanese and chinese characters properly Following is the java code and the .properties files (both the properties files are same though). I'm sure that the problem has nothing to do with system fonts as there is a third party java application that shows those characters properly on my machine. Any help will really be appreciated.
VIEWS ON THIS POST

75

Posted on:

Tuesday 23rd October 2012
View Replies!