Results 1 to 4 of 4
  1. #1
    TampaTechGuy is offline Member
    Join Date
    Jan 2008
    Posts
    8
    Rep Power
    0

    Default Returning a string (Partly Bold)

    Ok here is my deal --

    I am a little new at this and still learning, so keep it as informative as possible please (include imports, etc).

    I have a public class

    public class BoldMyString {
    protected String getLetterBody() {
    return "This string is not bold. This string is bold.\r\rNow this string is not bold.";

    }


    How do I get "This string is bold" to show up in bold lettering??

    Thanks All.

  2. #2
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default Displaying

    Hello TampaTechGuy

    If you want to display text with bold styling, then you must use a graphical user interface or GUI. I don't think that console programs where designed for formatting the style of text. (example: Windows Command Prompt)
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  3. #3
    TampaTechGuy is offline Member
    Join Date
    Jan 2008
    Posts
    8
    Rep Power
    0

    Default

    Its part of a web application I'm working on --

    There are pieces of it that use:

    new Font(Font.TIMES_ROMAN, 8, Font.ITALIC)));

    but I am stuck on how to apply this to my code in a different class.

    *but bold, not italic of course.

  4. #4
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    8

    Default Graphics

    Hello TampaTechGuy

    I would use the Graphics class to draw text. Then you can add any formatting that you can think of! See the last picture in this thread. I formated the text and added some layout so that it is displayed around images. You can do this if you like, but Swing or AWT components will offer a faster solution. :D
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

Similar Threads

  1. Replies: 0
    Last Post: 03-11-2008, 05:55 PM
  2. JNI - passing and returning parameters by value
    By java_to_c in forum New To Java
    Replies: 0
    Last Post: 01-31-2008, 09:49 PM
  3. Replies: 0
    Last Post: 12-01-2007, 12:55 AM
  4. returning to a previously saved view
    By gojava in forum Advanced Java
    Replies: 0
    Last Post: 11-09-2007, 06:11 PM
  5. Replies: 4
    Last Post: 07-31-2007, 06:19 PM

Posting Permissions

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