How to increment Font Size in Fraction say 14.1,14.2

Please reply soon urgent

Below is my code at the end is the label class what you suggested me. This code is working fine for graphics Object but i am not able to increase the label size in fraction.
package mypackage1;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JButton;
import java.awt.Rectangle;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import java.awt.SystemColor;
import javax.swing.BorderFactory;
import java.awt.Color;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.*;
import java.util.Vector;
import java.awt.event.*;
import javax.swing.JLabel;
public class DisplayFractionalFonts extends JFrame implements ActionListener,ItemListener
private JButton jButton1 = new JButton();
static JComboBox fontNameCombo;
static JComboBox fontSizeCombo;
private HorizontalPanel jPanel1 = new HorizontalPanel();
static String fontName;
static float fontSize=10.0f;
private String dummyFontName;
private float dummyFontSize;
TransPanel jPanel2 = new TransPanel();
mylabel lb[] = new mylabel[10];
public DisplayFractionalFonts()
this.getContentPane().setLayout(null);
this.setTitle("Display Fractional Fonts");
Dimension d1=Toolkit.getDefaultToolkit().getScreenSize();
this.setBounds((d1.width/2-this.WIDTH)/2,(d1.height/2-this.HEIGHT)/2,this.WIDTH,this.HEIGHT);
// this.setSize(449, 396);
this.setSize(449,600);
jButton1.setText("Preview");
jButton1.setBounds(new Rectangle(345, 15, 80, 25));
jButton1.setFont(new Font("Dialog", 1, 11));
jButton1.addActionListener(this);
fontNameCombo = new JComboBox(initializeNameCombo());
fontNameCombo.setBounds(new Rectangle(15, 15, 175, 25));
fontNameCombo.addItemListener(this);
fontSizeCombo = new JComboBox(initializeSizeCombo());
fontSizeCombo.setBounds(new Rectangle(195, 15, 145, 25));
fontSizeCombo.addItemListener(this);
fontSizeCombo.setEditable(true);
jPanel1.setBounds(new Rectangle(195, 45, 230, 45));
jPanel1.setBackground(SystemColor.activeCaptionText);
jPanel1.setBorder(BorderFactory.createLineBorder(Color.black, 1));
jPanel2.setBounds(new Rectangle(10, 95, 415, 260));
jPanel2.setBackground(Color.white);
jPanel2.setBorder(BorderFactory.createLineBorder(Color.black, 1));
lb[0]=new mylabel("Hello world :->");
lb[1]=new mylabel("Hello world :->");
lb[2]=new mylabel("Hello world :->");
lb[3]=new mylabel("Hello world :->");
lb[4]=new mylabel("Hello world :->");
lb[5]=new mylabel("Hello world :->");
lb[6]=new mylabel("Hello world :->");
lb[7]=new mylabel("Hello world :->");
lb[8]=new mylabel("Hello world :->");
lb[9]=new mylabel("Hello world :->");
Font jj[]= new Font[10];
Font ft = new Font("Lucida Bright", Font.PLAIN, 1);
for(int i=0; i<jj.length; ++i)
jj[i] = ft.deriveFont(20 + .1f*i);
for(int i=0; i<jj.length; ++i)
lb[0].setFont(jj);
lb[0].setBounds(new Rectangle(10, 365, 415, 20));
lb[1].setBounds(new Rectangle(10, 390, 415, 20));
lb[2].setBounds(new Rectangle(10, 415, 415, 20));
lb[3].setBounds(new Rectangle(10, 440, 415, 20));
lb[4].setBounds(new Rectangle(10, 465, 415, 20));
lb[5].setBounds(new Rectangle(10, 490, 415, 20));
lb[6].setBounds(new Rectangle(10, 515, 415, 20));
lb[7].setBounds(new Rectangle(10, 540, 415, 20));
lb[8].setBounds(new Rectangle(10, 365, 415, 20));
lb[9].setBounds(new Rectangle(10, 590, 415, 20));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.getContentPane().add(jPanel2, null);
this.getContentPane().add(jPanel1, null);
this.getContentPane().add(fontSizeCombo, null);
this.getContentPane().add(fontNameCombo, null);
this.getContentPane().add(jButton1, null);
for(int i=0; i<jj.length; ++i)
this.getContentPane().add(lb[i], null);
this.setVisible(true);
public Vector initializeNameCombo()
GraphicsEnvironment g_Env = GraphicsEnvironment.getLocalGraphicsEnvironment();
String envFonts[] = g_Env.getAvailableFontFamilyNames();
Vector fontVector = new Vector();
for(int i=0;i<envFonts.length;i++)
fontVector.addElement(envFonts[i]);
return fontVector;
public Vector initializeSizeCombo()
Vector sizeVector = new Vector();
for(int i=10;i<25;i=i+2)
sizeVector.addElement(new Integer(""+i));
return sizeVector;
public static void main(String args[])
DisplayFractionalFonts df=new DisplayFractionalFonts();
public void actionPerformed(ActionEvent ae)
DisplayFractionalFonts.fontName = dummyFontName;
DisplayFractionalFonts.fontSize = dummyFontSize;
jPanel2.setNewFont();
jPanel2.renderShape();
jPanel1.setNewFont();
jPanel1.renderShape();
public void itemStateChanged(ItemEvent e)
Object obj= e.getSource();
if(obj.equals(fontNameCombo))
dummyFontName=(fontNameCombo.getSelectedItem()).toString();
}else if (obj.equals(fontSizeCombo)){
dummyFontSize = (new Float((fontSizeCombo.getSelectedItem()).toString()).floatValue());
class TransPanel extends JPanel
private Font[] fonts = new Font[10];
int w,h;
FontMetrics fm;
TransPanel()
Font font = new Font("Arial", Font.PLAIN, 1);
for(int i=0; i<fonts.length; ++i)
fonts[i] = font.deriveFont(DisplayFractionalFonts.fontSize + .1f*i);
public void setNewFont()
Font font = new Font(DisplayFractionalFonts.fontName, Font.PLAIN, 1);
for(int i=0; i<fonts.length; ++i)
fonts[i] = font.deriveFont(DisplayFractionalFonts.fontSize + .1f*i);
public void renderShape() {
repaint();
public void paintComponent(Graphics g)
super.paintComponent(g);
System.out.println("g OK");
String s = "Hello WORLD";
Dimension d = getSize();
     w = d.width;
     h = d.height;
float width = (float)this.getBounds().getWidth();
float height = (float)this.getBounds().getHeight();
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
for(int i=0; i<fonts.length; ++i)
g.setFont(fonts[i]);
g.drawString(s+" Font Size : "+fonts[i].getSize2D()+" -> ",(int)(w/2-width/2)+10, 20 + 25*i);
class HorizontalPanel extends JPanel
private Font[] fonts = new Font[11];
int w,h;
FontMetrics fm;
HorizontalPanel()
Font font = new Font("Arial", Font.PLAIN, 1);
for(int i=0; i<fonts.length; ++i)
fonts[i] = font.deriveFont(DisplayFractionalFonts.fontSize + .1f*i);
public void setNewFont()
Font font = new Font(DisplayFractionalFonts.fontName, Font.PLAIN, 1);
for(int i=0; i<fonts.length; ++i)
fonts[i] = font.deriveFont(DisplayFractionalFonts.fontSize + .1f*i);
public void renderShape() {
repaint();
public void paintComponent(Graphics g)
super.paintComponent(g);
System.out.println("g OK");
Dimension d = getSize();
     w = d.width;
     h = d.height;
float width = (float)this.getBounds().getWidth();
float height = (float)this.getBounds().getHeight();
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
for(int i=0; i<fonts.length; ++i)
g.setFont(fonts[i]);
fm=g.getFontMetrics();
//System.out.println("ascent:-"+fm.getAscent()+"advance "+fm.getMaxCharBounds(g));
//g.drawString("A",(int)(w/2-width/2)+10+10*i,(int)h/2+4);
g2.drawString("A",(w/2-width/2)+10+(DisplayFractionalFonts.fontSize*i),h/2+4);
class mylabel extends JLabel
mylabel()
super();
mylabel(String str)
super(str);
protected void paintComponent(Graphics g)
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING , RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
super.paintComponent(g);

Similar Messages

  • How to change font size

    Just purchased Deskjet 1010 & don't know how to change font size.

    hellinger
    Welcome to the HP Community Forum.
    In most cases you can adjust the scale of your documents before you print.
    Please take a look at the following:
    Manage Print Output with Print Preview
    Click the Kudos Thumbs-Up to say Thank You!
    And...Click Accept as Solution when my Answer provides a Fix or Workaround!
    I am pleased to provide assistance on behalf of HP. I do not work for HP. 
    Kind Regards,
    Dragon-Fur

  • How to change font size on panels?

    How to change font size on panels?

    Peetwo wrote:
    Thanks for your response.
    The Martin Evening book on Lightroom 5 says that you can.  I can’t discern exactly how.
    Maybe, but you are asking in the Camera Raw forum, so I might be excused for not being telepathic.

  • How to change font size on screen

    how to change font size on screen

    I'm not certain what font sizes you wish to change, when on a page you can use command and the += button to zoom in and make the fonts larger. On the finder desktop you can make what ever is on the desktop larger or smaller from the finder menu click view, custom view options, and adjust the icon size with the slider on the top, and the text using the text size box to select the size that your comfortable with.
    Forgot to add these.
    http://support.apple.com/kb/PH10876
    http://support.apple.com/kb/PH10877
    Hope this helps.

  • How to change Font Size of Object Explorer in "SQL Server Management Studio"

    Dear Team,
    "SQL Server Management Studio" is a fantastic IDE for the database.
    There are so many customization options available but one thing many users missing is that " How to change Font Size of Object Explorer?"
    Can you please accumulate this feature in IDE ASAP?
    Many Thanks,
    Bhavesh

    Its there
    Go to Tools -> Options
    Then under Environment you've fonts and colors tab where you can specify a higher font size.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to change font size, maximum column size in the result screen ?

    hi All
    That's great when using SQL Dev.
    But I also have a trouble that how to change font size, maximum column size in the result screen ?
    My users think that font in result screen is shown very small, and whenever the data in each colum is long then it's not shown full data in column, they must double click for extend the size. Have the option to default the max size for showing full data in each column ? I try but still not to do that .
    Appreciate for anyone to help us.
    Thanks all.
    Sigmasvn

    You can't change the font for the results screen yet, however you will be able to select an auto-fit option for selected columns, so if some columns have slitghtly wider text you'll be able to set the column widths to handle these wider columns.
    Also, there s the option of switching the layout of a record in the grid.
    Sue

  • How to change font size and style in keynote for ios

    How to change font size and style in keynote for ios

    Same situation for report parameter input value font. What ever we do , it is still Arial and size 10.

  • How to change font size in a call-out tool box?

    Hi, the other day i inserted a call-out tool box in a PDF document, however i cannot find anything that can change the font size of the letters i input in that box. could anyone help? Thanks.
    Sherman

    This is a question for the Acrobat support forums – please post there.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Wed, 23 Nov 2011 10:55:07 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: how to change font size in a call-out tool box?
    Re: how to change font size in a call-out tool box?
    created by danmarch<http://forums.adobe.com/people/danmarch> in PDF Language and Specifications - View the full discussion<http://forums.adobe.com/message/4043425#4043425

  • How to change font size in check printing program in AP Invoice

    I would like to know how to change font size in check printing program in Oracle Payables Module for Invoice printing. We are using Oracle standard
    report to print check.
    Concurrent program short name : APXPBFEL
    Prt file : APLASP.prt
    I modified prt file for code 199 like below
    code "199" esc "(8U" esc "(s0p12.00h10.00v0s0b3T" esc "&k11.75H"
    Font size changed for last page only which prints checks, for Void pages its printed with default font. For Page 1 printed with default font and page 2 has reduced font. This change is not intiallized for all pages.
    Please let me know if you any of you know how to change fonts.
    Thanks,
    Anand

    *Default FullZoom Level: https://addons.mozilla.org/firefox/addon/default-fullzoom-level/

  • How to change font size in textarea?

    how to change font size in textarea?

    to embed a font using actionscript requires adding the font to your library.  to do that, click the upper right of your library panel, click "new font..", select the font you want and click ok.  find the added font in your library, right click, click properties and tick "export for actionscript" (click the actionscript tab if you don't see that option, at first).  assign a class name (eg, WhateverFont).  you can then use:
    var tfor:TextFormat = new TextFormat();
    tfor.size=22;
    var yourfont:Font=new WhateverFont();
    tfor.font = yourfont.fontName;
    ta.setStyle("embedFonts",true);
    ta.setStyle("textFormat",tfor);

  • How to change font size in a table?

    How to change font size in a table without using the font style of another document?  Please show a sample script.  Thanks!

    Hi Dave,
    Thank you so much for the email.  I tried every object and method I can
    posibly think about such as
    myTable.Rows.Item(1).PointSize = 24
    myCell.Characters.Item(1).PointSize = 24
    I got error message all the time.  These objects don’t support PointSize.
    All I need is to change point size of the text in InDesign tables created
    using VBScript. Could you help me with this?  Thanks,
    Regards,
    Li

  • How to increase font size in Java script alert message

    Is anybody know how to increase font size in Java script alert message
    THanks in Advance ....

    Hi,
    You can NOT do it with Javascript.
    You need an alternative solution: http://www.apex-plugin.com/oracle-apex-plugins/dynamic-action-plugin/popup-box_84.html
    Tobias

  • In SAP 4.6c In classical reports output how to change Font size and Font type

    Dear Experts,
    In SAP 4.6c, in classical and interactive reports  output how to change font size and font type.
    Regards,
    Zaker.

    These are HTML formatting questions. Nothing to do with the Oracle SQL and PL/SQL languages.
    With old-style HTML, the font size and family are set using the font tag.
    With modern style HTML, that is done using cascading style sheets (CSS).
    Your favourite search engine will turn up tons of information on both.

  • How to reset font size tool to work?

    I copied and paste text onto a pic on photoshop and it has completely resized the whole workshop.  Everything, now is so small  you can see it.  I can select 72 pts but then it's just barely large enough to read.  What has happened and how do I restore things there way they were? 
    I have Photoshop 6.

    thank you Barbara...I missed that.  thanks sooo much!
    Robin  & The Beasts
    of
    Misty Mountain
    _www.mistymountainestrelas.com 
    In a message dated 11/16/2012 5:23:52 P.M. Eastern Standard Time, 
    [email protected] writes:
    Re:  how to reset font size tool to work?
    created by Barbara B._ (http://forums.adobe.com/people/Barbara+B.)  in 
    Photoshop Elements - View the full  discussion
    (http://forums.adobe.com/message/4853918#4853918)

  • How to increase font size on the finder and menu bar

    how to increase font size on the finder and menu bar

    according to this thread, in Leopard you can't but they offer some suggestions: https://discussions.apple.com/thread/2075719?start=0&tstart=0

Maybe you are looking for

  • How can I acquire a copy of Mac OS X 10.5 Leopard?

    I need to upgrade my iMac from Tiger v10.4.11 to Leopard v10.5. I have all the upgrades from 10.5.1 on but I'm unable to find the original Leopard software. My computer still works flawlessly but I need to upgrade to take advantage of software update

  • Why is there a data type NUMC?

    Hi ABAP masters, working in database support for several years I've very often seen the problems that arise from the awkward data type NUMC. A numeric type stored as characters. What I always wondered is: what is this data type really good for? The l

  • How to trace a location of an email

    I am receiving emails from this [email protected] and flapperflipper@[email protected] could someone please tell me the location of these?  I can't find any infomation on this.  Want to see who is sending me these texts and emails.  T

  • Compatability with auto

    I own a Lexus 2007 ES350. Is the phone compatable with the Bluetooth installed on the auto?

  • Error while passing file from webdynpro screen to DMS server to gene DMS no

    hello gurus,                 i have one requirement in webdynpro abap.i need somme stuff to achive this.let me explain my requirement first. i have one view as main having file upload UI element and one action button as CREATE. now i perform browse a