using html in Java - very simple question!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: using html in Java - very simple question!

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Posts
    32

    using html in Java - very simple question!

    Hi

    I don't really know html but just need to use it in my java so I can control the font when my program is run in a browser.

    So far I have only managed to change the font colour
    I would also like to be able to change the font style to bold and also change the size, so that whoever runs my program sees the same font.

    I have the code as:

    Code:
    questionLabel.setText("<html><FONT COLOR=BLACK>Is node " + btd.question + " in the tree?</FONT><html>");
    but I just don't get whereabouts and 'how' I add the other two settings to the font. I have an old html books but its not helping, as it ignores when I add font-style:bold

    can anyone help me with this please???

    hope so as I want to control the colour and style so that my program is accessible to the visually impaired as well, however their browser is setup.

    Thanks very much for your time

  2. #2
    Join Date
    Aug 2005
    Posts
    23
    you can bold by wrapping <font/> with <b>
    and should be able to change size with <font size="1"/> where you use 1,2,3,4,5 etc
    yet, a more up-to-date method would be

    Code:
    <span style="color:black;font-size:8pt;font-weight:bold;">your text</span>

  3. #3
    Join Date
    Jan 2005
    Posts
    413
    The font tag has long since been deprecated. Browsers may support it now, but the next versions may not. Best to use <span style="color:black"> text </span> or some other html tag

Similar Threads

  1. Replies: 2
    Last Post: 04-17-2009, 11:14 AM
  2. Has Sun Given Up on the Desktop?
    By Lori Piquet in forum Talk to the Editors
    Replies: 114
    Last Post: 10-10-2002, 06:01 AM
  3. Simple Java DOM question
    By Lenin in forum XML
    Replies: 0
    Last Post: 03-21-2001, 04:01 PM
  4. A Java Swing Question
    By Dixon in forum Java
    Replies: 1
    Last Post: 01-26-2001, 11:26 AM
  5. Replies: 2
    Last Post: 10-12-2000, 06:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center