Results 1 to 6 of 6
  1. #1
    pfeldman is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default how to increase font size of text that user types in dialog box?

    I'm using the following code to open a dialog box and prompt the user to enter a numerical value:

    import javax.swing.*;
    import javax.swing.plaf.FontUIResource;
    UIManager.put("OptionPane.messageFont", new FontUIResource(
    new Font("Verdana", Font.BOLD, 20) ) );

    String response = JOptionPane.showInputDialog(null,
    "Please enter a container type name or number: ", "Container Type", JOptionPane.QUESTION_MESSAGE);

    This works, but the text that the user enters is displayed in an incredibly small font. Is there a way to increase this?

    Dr. Phillip M. Feldman

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,422
    Rep Power
    20

    Default

    Have you tried changing the default font for JTextField?

    db

  3. #3
    pfeldman is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    I had, but apparently the leading "J" should not be there. Here's the line of code that worked:

    UIManager.put("TextField.font", new FontUIResource(
    new Font("Verdana", Font.BOLD, 20) ) );

    Thanks!

    Phillip

  4. #4
    sedj601 is offline Member
    Join Date
    Dec 2011
    Posts
    4
    Rep Power
    0

    Default Re: how to increase font size of text that user types in dialog box?

    the code above helped me. I was trying to take the code from a textArea and get the JOptionPane to display it in a bigger font.

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here
    UIManager.put("OptionPane.messageFont", new FontUIResource(
    new Font("Verdana", Font.BOLD, 32) ) );

    JOptionPane.showMessageDialog(null, jTextArea1.getText(),"Enlarged Text",JOptionPane.PLAIN_MESSAGE);

    }

  5. #5
    rhXApmucEo is offline Member
    Join Date
    Jan 2014
    Posts
    1
    Rep Power
    0

    Default zeIpcf RR yA vGx wQDl ct

    <a href=http://renom.com/http/#51>download</a> valium 5mg diazepam

  6. #6
    pj6444 is offline Senior Member
    Join Date
    Jan 2013
    Posts
    165
    Rep Power
    2

    Default Re: how to increase font size of text that user types in dialog box?

    Just set the font of the text field with setFont(new Font("Font Name", Font Type, Font Size));

Similar Threads

  1. increase pixel size
    By rosh72851 in forum New To Java
    Replies: 9
    Last Post: 07-31-2012, 07:30 PM
  2. Change the Font Size and Text Position
    By stayfierce in forum New To Java
    Replies: 1
    Last Post: 12-03-2009, 05:17 AM
  3. Replies: 3
    Last Post: 09-27-2008, 04:46 AM
  4. how to set font size for a xml value
    By bala_kj in forum Advanced Java
    Replies: 3
    Last Post: 04-01-2008, 11:00 AM
  5. gridbaglayout: increase/decrease size of components.
    By newtojava7 in forum New To Java
    Replies: 2
    Last Post: 01-28-2008, 07:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •