Show HTML bold-faced fonts?

What is the way to get some of the texts, but not all the texts, to appear bold-faced? The line below does not work. Any ideas? Maybe some HTML needed? I don't need a gigantic set of codes for all HTML. I just need to display some texts in bold.
stingToBeBoldFaced.setFont(new Font(FontFaceBeautiful, Font.PLAIN, FontSizeBig));

You are right. JEditorPane is the one needed. When I try searching this keyword, I found codes for displaying a web page. I did not find a single bold-faced example. Keith's example is nice.

Similar Messages

  • Printing html text and font styles

    Hello,
    when I try to print html text in serif with italic or bold text style the output on a printer incorrectly shows the bold and italic parts in arial or something. Underlined text is printed correctly.
    The font is rendered correctly on a JEditorPane.
    There were some issues with html rendering in java (e.g. Bug IDs 4331766, 4160605, 1235430, 4141537) but as these bugs are closed/fixed in earlier jdk versions, and i found no hint that anyone else has experienced such problems, i may be doing something wrong?
    Regards,
    Dirk
    My Configuration: Windows 2000 (German), JDK 1.5.0_12
    For testing purposes i use the following:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import javax.swing.JEditorPane;
    import javax.swing.JFrame;
    import javax.swing.RepaintManager;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.Document;
    import javax.swing.text.html.HTMLEditorKit;
    * QDH (Quick and Dirty Hack) Test
    public class PrintTestPane extends JEditorPane implements Printable {
       * shows printDialog and starts printing
      private void print() {
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable( this );
        if ( job.printDialog() ) {
          try {
            job.print();
          catch ( Exception ex ) {
            ex.printStackTrace();
        else {
          System.out.println( "Aborted" );
       * from Printable Interface: renders a page
      public int print( Graphics graphics, PageFormat pageFormat, int pageIndex )
          throws PrinterException {
        Graphics2D g2 = (Graphics2D) graphics;
        RepaintManager.currentManager( this ).setDoubleBufferingEnabled( false );
        Dimension d = getSize();
        double panelWidth = d.width;
        double panelHeight = d.height;
        double pageWidth = pageFormat.getImageableWidth();
        double pageHeight = pageFormat.getImageableHeight();
        double scale = pageWidth / panelWidth;
        int totalNumPages = (int) Math.ceil( scale * panelHeight / pageHeight );
        // Check for empty pages
        if ( pageIndex >= totalNumPages )
          return Printable.NO_SUCH_PAGE;
        g2.translate( pageFormat.getImageableX(), pageFormat.getImageableY() );
        g2.translate( 0f, -pageIndex * pageHeight );
        g2.scale( scale, scale );
        print( g2 );
        return Printable.PAGE_EXISTS;
       * @param args
      public static void main( String[] args ) {
        PrintTestPane testPane = new PrintTestPane();
        HTMLEditorKit kit = new HTMLEditorKit();
        Document doc = kit.createDefaultDocument();
        try {
          kit.read( new ByteArrayInputStream( htmltext.getBytes() ), doc, 0 );
        catch ( IOException e ) {
          throw new RuntimeException( e );
        catch ( BadLocationException e ) {
          throw new RuntimeException( e );
        testPane.setContentType( "text/html" );
        testPane.setDocument( doc );
        JFrame frame = new JFrame();
        frame.getContentPane().add( testPane, BorderLayout.CENTER );
        frame.addWindowListener( new WindowAdapter() {
          public void windowClosing( WindowEvent event ) {
            System.exit( 0 );
        frame.pack();
        frame.setVisible( true );
        testPane.print();
      private static String htmltext = " <html> <head>  </head>  <body> <font face=\"serif\"> plain <b>bold</b> plain <i>italic</i> plain <u>underlined</u> plain</font> </body> </html>";
      private static final long serialVersionUID = 1L;
    }

    Hello again,
    Update:
    With JRE 6 it seems to work (at least with update 2). Because Java 6 is currently not an option for me: should i file a Bug?
    Dirk

  • How can I combine one font with many styles to show up as one font

    How can I combine one font with many styles to show up as one font? I have quite a few fonts, that instead of showing up as a single font with different font styles (bold, bolditalic, semibold, light....) each style shows up in the fonts dropdown menu as a separate font. Any way I can fix this?
    Another font question, is there any way to group my fonts in the dropdown menu according to different categories such as 'favorite san serif fonts', or 'script fonts'?

    So your saying if it wasn't set up that way be the font creator there is nothing I can do. That's a shame.
    Most of the fonts that do this were free fonts, such as Walkway.
    But I do have some fonts (hebrew fonts) that I purchased that do the same thing.

  • FrutigerLTStd-Bold Cn font has wrong name in file and not installing

    Just purchased FrutigerLTStd-Bold CN font.  The font file name is correct, but In the font window it says the name is "Frutiger LT Std 47 Light Cn" but the font shows up as the bold one.  Installed the font but it is not showing up in my font list.  Think there must be an error since the wrong name is thereI already have the light one, I need the bold font.  Was on hold with Chat for 30 minutes, they told me to call support.  Phone and said there was a 2 hour wait - my phone battery died before I was connected.  Help!

  • In Firefox (latest version) on Craigslist the text font is a very funky super bold angular font I can barely read. When using safari it's ok using times. is this a firefox problem?

    In Firefox (latest version) on Craigslist the text font is a very funky super bold angular font I can barely read. When using safari it's ok using times. is this a firefox problem?

    You can do a check for corrupted and duplicate fonts and other font issues:
    *http://www.thexlab.com/faqs/multipleappsquit.html - Font Book 2.0 Help: Checking for damaged fonts
    *http://www.creativetechs.com/iq/garbled_fonts_troubleshooting_guide.html

  • I have songs that have been purchased and they show up in my I tunes but the are not showing up bold like all other songs in my library, they will not let me download from the cloud and will not load onto my ipod.

    I have a handfull of songs in my library that are not showing up bold like the other songs. When I click the icon to download from the cloud nothing happens and they will not load onto my ipod. When I look for them in the purchased area they show up as purchased and downloaded.

    Welcome to the Apple Community.
    So far as I am aware, books haven't been available for 6 years, so I'm wondering if you mean audiobooks.
    Audiobooks are not currently part of the content that can be re-downloaded.

  • Mail 5.2 doesn't show html/attachments in Lion 10.7.3

    I recently upgraded to Lion from Snow Leopard.
    The problem is that Mail version 5.2 (1257) doesn't show html content or attachments. Even Apple's own templates from the application itself doesn't show correctly.
    I've made sure that the "show remote html content in the Preferences is checked.
    I've also tried to rebuild the mailboxes without any changes. Html-content and pictures stil doesn't show. 
    How can I fix this?
    Is there a command for the Terminal that can fix this?
    MBP 15" 2.2 GHz (10.7.2) 4GB RAM

    Step 1
    Mail ▹ Preferences ▹ Viewing ▹ Display remote images in HTML messages: check
    Step 2
    If you still have the issue, back up all data before proceeding further. Whatever happens, you must be able to restore your system to the state it's in now.
    Quit Mail if it’s running.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ If you’re running Mac OS X 10.7 or later, open LaunchPad. Click Utilities, then Terminal in the page that opens.
    Drag or copy – do not type – the following line into the Terminal window, then press return:
    defaults delete com.apple.mail PreferPlainText
    Quit Terminal. Launch Mail and test.

  • CQ page is not rendering properly. It is not rendering HTML. It is showing HTML source code as is.

    On some of the pages, I am getting this weird behavior wherein page is not rendering properly. It is showing HTML source code as is. Could you please help me out? What could be the issue? And how can we get rid of the same?

    Check your component jsp page. it is possible that it is just plan file without directives <@ or you might have miss to close tag which is creating source as text to render
    Paste your jsp code in case you need further help
    Thanks,
    Ajit

  • Show HTML

    are there any components to show HTML in a java awt application? can I load that HTML from a local file or from a URL?

    The JEditorPane can show HTML or Rich Text :
    public JEditorPane()
    public JEditorPane(String type,String text)
    public JEditorPane(String url)
    public JEditorPane(URL initialPage)
    Hope that was of help.

  • Show html in Grid, Forms

    I want to show parts of web pages inside a table.
    How does one show html inside the cells of grids or forms?

    hi Patricio,
    In Content Management,I have created a folder "abc" under the repository "document".This folder will hold the xml files created for the news items.
    The document repository is predefined and has been assigned the Repository Service "tbp".
    i have enabled the time-bound publishing for the folder "abc" in its Detail section.
    For the news reader , I have made the folder "abc" as "read only".
    But the news reader is not able to see the news.
    My xml form for the news Author has fields for entering date and time for both "Valid from" and "Valid To".
    On saving the news item ,i can actually see these values in the property "LifeTime" of the news document that has been created.
    I even set these ValidTo and ValidFrom at the "LifeTime" property also.
    But nothing is working.
    Also could u pls elaborate on ur statement :
    "time-dependent publishing service requires the application property service."
    Nothing is working for  me.
    Pls help.
    Regards
    Saurabh

  • Show HTML in Personal Profile?

    i'd like to show HTML (from a file or from a string) in any kind of component in an app running on a PDA. Probably i will use Personal Profile (and WSDD).
    Are there any components I could use to show HTML. Maybe in AWT?
    I know there are components like that in swing, but I don't know if I can use swing on a PDA??

    hi slomoman,
    i am also interested in the answer. Here is my research:
    You can show HTML in swing components like JEditorPane, But not in AWT.
    Also I could not find a way, how to run swing app with WSDD on PDA.
    good luck
    -fatbrain73

  • Safari not showing some of the fonts

    Safari is not showing the fonts on a lot of websites, and it is safari because i opened the same page on chrome and they are showing up on chrome.

    That's the LastResort font showing where the intended fonts should be. Usually, this is caused by bad font cache data.
    Close all running applications. From an administrator account, open the Terminal app and enter the following command (or copy/paste it from here):
    sudo atsutil databases -remove
    This removes all font cache files maintained by OS X. Both for the system and the active user account. After running the command, close Terminal and immediately restart your Mac.

  • Text Catalog showing HTML tags

    We are having an issue after applying Bundle #22 for HCM 8.9 where the calls to the Text Catalog are now showing HTML tags. Has anyone else seen this? Im trying to figure out if its the bundle or something maybe with our customizations that have affected this change. Basically the page where the text from the text catalog displays now shows not only the text, but raw HTML tags as well on the page. Example: BR, B
    Thanks!
    Edited by: CoryU on May 11, 2010 2:00 PM

    We are having an issue after applying Bundle #22 for HCM 8.9 where the calls to the Text Catalog are now showing HTML tags. Has anyone else seen this? Im trying to figure out if its the bundle or something maybe with our customizations that have affected this change. Basically the page where the text from the text catalog displays now shows not only the text, but raw HTML tags as well on the page. Example: BR, B
    Thanks!
    Edited by: CoryU on May 11, 2010 2:00 PM

  • Servlet showing HTML page

    I ma using Tomcat as standalone server.
    have servlet showing HTML page which has frames in it . All frames are linked to some html pages. These pages are stored in
    webapps/project directory and servlet is in
    \Tomcat 4.1\webapps\Project\WEB-INF\classes
    Tomcat can show the servlet with al frames witherror402 means it is unable to take html pages from webapps/project
    what's wrong
    my codes are
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Htmlservlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<HTML>\n"+
    "<HEAD> <TITLE>A frameset document</TITLE></HEAD>\n"+
    "<FRAMESET rows= \"20%,40%,40%\" >" +
    "<FRAME src=\"contents_of_frame3.html\" frameborder=\"0\" scrolling =\"no\">"+
      "<FRAMESET cols=\"*,200\">"+
          "<FRAME src=\"contents_of_frame1.html\" scrolling=\"no\">"+
          "<FRAME src=\"contents_of_frame2.gif\" >"+
    "</FRAMESET>"+
      "<FRAME src=\"contents_of_frame4.html\" frameborder=\"0\"> </FRAMESET>"+
    "</HTML>");
    }

    Hi,
    Please please try this
    <FRAME src=\"/contents_of_frame1.html\"
    thanks,
    nvseenu

  • em /em tag shows as bold not as italics in Firefox. But it shows as italics in Internet Explorer. It also shows as Italics in Dreamweaver. Why is that? How can I make Firefox show em /em as italics? Thank you. Jeffrey Feng yfeng@whittier.edu

    <em></em> tag shows as bold in Firefox, but it shows as italics in Internet Explorer. It also shows as italics in Dreamweaver and Contribute. Since our web designers use Dreaweaver and Contribute to create web pages, texts are formatted as italics when they use <em></em> tag, but when the end user browses the web using Firefox, they see bold text instead of italics. How can we remedy this problem with Firefox without changing hundreds of pages which contain <em></em>?
    Thank you.
    Jeffrey Feng
    Whittier College
    [email protected]

    Works for me on Linux with Firefox 3.6.x and 5.0 versions.

Maybe you are looking for

  • AP report purchase in 3 years

    Hi Experts, I got a requirement to create AP report purchase in last 3 years. I need these fields in the BI report. VENDOR NAME1 PO Number PO Date Invoice Date Invoice Due Date Payment Date Days w/o payment Amount Invoice Number Can any one please gu

  • How to apply single sine or square wave

    Now I used NI-FGEN and NI-Scope for bender element test, I want to now how to generate single sine or square wave (normally in NI-FGEN, I saw only continuous wave generation type).thanks you so much

  • Web.accButton("Xpath") does NOT work with error "failed to respond"

    web.accButton("web:dialog_unknown[@text='Do you want to open or save this file?']/web:accPushButton[@index='1' or @name='Save']").click(); Got exception: Object "/web:dialog_unknown[@text='Do you want to open or save this file?']/web:accPushButton[@i

  • Re: Very slow downstream speeds at 3 different loc...

    We're having the same problem.  Ours really slowed down about 4 days ago.  It takes ages for pages or games to load up, I can't use Youtube which I love, and I can't Skype which I rely on to talk to my family back home in New Zealand.  I am really fr

  • Error - BP to no tax - tax exempt

    error when putting BP to tax exempt (no tax) tax status of summary BP not permitted (business partner - BP summary) "C03641" message 3502-8 I checked message # in notes and meant nothing