Html in labels

How can I display an html image in a label or icon? Thanks

import java.net.*;
import java.io.*;
public class URLRead
   public static void main(String[] args) throws Exception
      URL myUrl = new URL("http://www.drudgereport.com/");
      BufferedReader in = new BufferedReader(new InputStreamReader(myUrl.openStream()));
      String line = in.readLine();
      while(line!=null)
         System.out.println(line);
         line = in.readLine();
}

Similar Messages

  • Html in labels / hot links

    hi! i want to know the restrictions if using html in labels? is the standard stricly defined or is it platform dependend like the differences when displaying webpages in different browsers?
    1.
    - does it have to include the html, head, and body tags?
    - does it have to be in xhtml standard?
    - is javascript allowed (or other scripts)?
    - can i use stylesheets?
    - can i embed applets? (an applet in an applet - how funny)
    - frames?
    2.
    is there another way to display hot links in an aboutbox?

    i cannot answer all questions. but i would like to share my experience to use html in JLabels. my Java enviornment is SDK1.4.0.01. I tried some tags in my labels. I used some tags that work as below:
    <html>
    <B>bold</B>
    <P>line return
    </html>
    I also tested some CSS properties like font-size, font-color which do not work. So it seems not to support all HTML functions.
    In all, I suggest you to test the tags when you want to use them.

  • Html on labels

    Hello,
    I use html in several places in my frame-based app, e.g. on various labels, as a tree cell renderer, etc.
    Is there anyway to globally set html font sizes? For example, if my html string specifies SIZE=2, is there some way to force the JVM to render it with a specified point size?
    The reason I'm asking is that there seems to be a change from 1.3 to 1.4 in the way that html SIZE is rendered (fonts are smaller in 1.4). So rather that go through each and every html string and update all the sizes, I'd like to be able to take care of this in one place.
    Thanks,
    Ted Hill

    The hyperlinks for the help text pop up windows are defined in your label template. If you don’t want to use help and don’t want to have the hyperlinks, you could either pick a label template that does not have the help link. Or you could change the label template you’re currently using and remove the HTML code that creates the link.
    Regards,
    Marc

  • HTML DB Label template

    Hi everybody,
    On a Label template, where we can find possibilities like ....div class =''t1InlineError" in On Error Before Label or On Errror After Label ?
    Thank you. Bye.

    Try
    <label for="#CURRENT_ITEM_NAME#" tabindex="999"><span style="color:black;font-weight:bold"> After label</span> </label>
    Vivek
    Message was edited by:
    Vivek

  • HTML DB - Label model

    Hi everybody,
    Someone answer me but I delete the wrong Thank you for the answer.
    But my link is still brown. I want black also.
    My Label model is:
    <label for="#CURRENT_ITEM_NAME#" tabindex="999"><a class="t2OptionalwithHelp" href="javascript:popupFieldHelp('#CURRENT_ITEM_ID#','&SESSION.')" tabindex="999">
    <span style="color:black;font-weight:bold">
    Can you help me ? Thank you. Bye.

    Try
    <label for="#CURRENT_ITEM_NAME#" tabindex="999"><span style="color:black;font-weight:bold"> After label</span> </label>
    Vivek
    Message was edited by:
    Vivek

  • Hyperlink below a label in Form in APEX 4.2

    I have the following two Rows in a form in APEX. I want to add a hyperlink link just below the warranty expiry date label.
    Warranty Expiry Date
    Issued To
    Can anyone help me?

    Hi,
    You can write HTML to Label text field e.g.
    Warranty Expiry Date<p><a href="#">This is my hyperlink</a></p>
    Or you can create custom label template
    Regards,
    Jari

  • Syncing styles between Word and RH HTML 7

    Question about syncing styles between Word and RH HTML 7.The
    printed Word format has Hdr/Ftr, TOC, Title Page stuff.
    I understood that, when importing a Word .docx, RH creates
    books for Heading 1s and Topic headings are Heading 2. That is why
    both Word and RH templates use the same paragraph style names
    (though the format in Word/print differs from that in RH/online).
    I imported my Word file into a new RH HTML 7 project. The TOC
    has the expected books/topics/subtopics. I imported the .css and
    the .htt from the RH 5 template project. I selected all 160 topics
    in the Topic List pod and applied the corporate .htt template
    (Topic Properties > General) AND (to be certain), the corporate
    .css stylesheet (Topic Properties . Appearance).
    This project doesn't have the same characteristics as the
    base/master from RH 5 that uses those same format files. I even
    imported the same skin. I get the banner, but not the styles.
    All the topic headings in the RH 7 project (were transformed
    to) are Heading 1 styles, even though they were Heading 2s in Word.
    (this breaks with my tribal knowledge of how RH imports
    Books/Topics from a Word doc). The heading colors (navy blue, royal
    blue, etc.) have taken on their own definitions--dunno where from,
    tho.
    Since I'm OCD about creating and using one style for each
    type of paragraph (procedurehead, syntax, procnum, procnonum, note,
    bullist) in Word or in RH, Peter Grainger's suggestion to "clean
    up" styles before importing shouldn't apply.
    RH instructions omit any detail about what to specifiy in the
    Conversion Options and Split On Style. I took a couple of swipes at
    the SOS--OK, split on Heading 1, Heading 2, Heading 3. So I get
    Books for Heading 1, separate topics for Heading 2 and Heading 3,
    but the "topic titles" have become Heading 1 in name but not in
    format. In fact, the format doesn't match anything I've specified
    in Word or RH. I thought by "attaching" the .htt and the .css to
    each topic (select all topics, , I'd have the look and feel I
    specified in my corporate RH(5) template. The banner imported, the
    navigation pane and icons imported. What happened to the styles?
    Here's the missing link that someone may need to explain
    (explicitly in Help somewhere). When I open the .htt template
    (sample topic) that I imported from RH 5, the topic title shows as
    Document > Heading 2 > in the Design view. The HTML view
    labels this paragraph as h2:
    <!doctype HTML public "-//W3C//DTD HTML 4.0
    Frameset//EN">
    <html><head>
    <meta http-equiv=content-type content="text/html;
    charset=utf-8">
    <meta name=generator content="Adobe RoboHelp -
    www.adobe.com">
    <meta name=generator-major-version content=0.1>
    <meta name=generator-minor-version content=1>
    <meta name=filetype content=RoboHelp>
    <meta name=filetype-version content=1>
    <meta name=page-count content=1>
    <meta name=layout-height content=1927>
    <meta name=layout-width content=732>
    <title>JavaCode</title>
    <link rel=StyleSheet href=mytemplate.css>
    </head>
    <body>
    <h2>NameOfPackage: NameOfMethod</h2>

    Hi Jim,
    Don't know how useful my question is now, given that you posted over a year ago.
    Do your RH X5 Word source docs use styles?  If so, take a look here, and I detail how I have been able to import from RH X5 for Word to RH 7 HTML.  (I'm currently still working on a leftover issue with Keywords and Subkeywords.)
    One thing I have done which probably helped:  while applying new standards to our documentation, we have removed almost all images (screen shots, etc.), and have only retained those images which don't have a text equivalent.  The drastically reduced the import file size of my Word source docs.  All my images were referenced via TrueCode, but upon importing to RH 7 HTML, there was so much less to be processed by RH 7 HTML, that the import went much more easily and quickly.
    I hope this helps,
    Marjorie

  • Displaying custom property as label

    Hello Community...
    I need to design a custom tag, to render a collection of objects and determine what property of object display as label by tag's attribute.
    Just like in struts <html:optionsCollection label="label" value="value"> ... and could it be done in JSP based tag ?
    sorry for my bad english :)

    I believe you already have solution with you.No need to re-invent the wheel if you are already using struts.
    Please go through the below article.
    http://masterdev.dyndns.dk/dev/6.htm
    Note: It is not always nessary to use LabelValueBean exclusively for this one can easily configure use their respective collection accordingly.
    <html:select name="myFormBean" property="selectedUserId">
        <html:options name="myFormBean" collection="usersList" value="userId" labelProperty="username"/>
    </html:select> I'm assuming that usersList property in MyFormBean holds a Collection of UserBean objects which has properties like userId and username.
    Hope that might help :)
    REGARDS,
    RaHuL

  • Stretching of HTML table in JLabel

    Hi all,
    I am trying to display an HTML table in a JLabel. The table uses width="100%", but the html table doesn't resize according to the size of the JLabel. Is this a know issue or am I doing something wrong?
      String html = "<html> <head> </head> <body> <table border=\"2\" width=100%> <tr> <td>  test  </td> <td> test </td> <td> test </td> </tr> </table> </body> </html>";
            JLabel label = new JLabel(html);
            getContentPane().add(label, BorderLayout.CENTER);kind regards,
    Christiaan

    The JTable uses a cell renderer to draw the JLabel.
    The cell renderer figures out the size of the table cell without reading the html. Which means it ignores the width=100% when it calculates the size of the table cell. If you want the cell to resize properly, you have to implement a table cell renderer, and make that renderer set the column size or row height accordingly. That means you have to calculate the cell size yourself.
    In my opnion, i would say this is a bug, as I've had numerous problems with it too.

  • Chart axis labels unreadable

    How do I control the chart label font size to keep it from
    becoming unreasonable? I have a ColumnChart with 2 or 3 dozen
    columns and when I let flex autosize them, the labels become
    unreadable. I don't want to force the font to a certain size if
    possible, but just keep it from going microscopic. The labels are
    also very long so they had to be rotated vertically. Here is the
    relevant code:

    "Cr99" <[email protected]> wrote in message
    news:g8kbff$mjj$[email protected]..
    > How do I control the chart label font size to keep it
    from becoming
    > unreasonable? I have a ColumnChart with 2 or 3 dozen
    columns and when I
    > let
    > flex autosize them, the labels become unreadable. I
    don't want to force
    > the
    > font to a certain size if possible, but just keep it
    from going
    > microscopic.
    > The labels are also very long so they had to be rotated
    vertically. Here
    > is
    > the relevant code:
    Have you looked at this example:
    http://livedocs.adobe.com/flex/3/html/help.html?content=charts_formatting_02.html
    The labels are not rotated, but it looks like they're picking
    up the styles
    just fine. You may find that you can avoid the need to embed
    the font by
    setting the blendMode on the labels, but that will probably
    require
    extending ChartLabel. However, it might help if the rotation
    is interfering
    with the styling.
    HTH;
    Amy

  • Newbie: Trying to get data  from Code Behind file to HTML file.

    Greetings,
    I am trying to use the opener link adaptive tag to open a specific page. I have the Object ID, and classID as variables in my class in my class file, but I do not know how to get that data into the opener link which is on the html page.
    Should I be using session variables? If so how, I am a newbie.
    Does anyone know how?
    Thanks.

    Kinda depends on your flavor/need/preference. I've done it...
    * Using session variables and just writing to the page in script blocks. Not preferred in .NET-land, but definitely more of the fast/traditional ASP style. Use sparingly and with caution. Be really careful about VS.NET totally destroying your tags. It seems to love doing that (as an aside - HUGE thank-yous to the BEA engineers who altered the tags to consistenly use lower case. Really. I can't thank you enough. :) )
    * Using label controls and then just populating the label with the formatted adaptive tag (this can work well)
    * One of our guys did a really simple/elegant server control that takes arguments for the objectid, classid, etc. Nice for creating things repeatedly server-side and gets you by the HTML, quotes, etc. all over the place. Nice as it also consolidates the tag in a single place you can alter once.
    For session variables, you'd just do something like...
    <%
    '//in your code-behind
    Session("myClassID") = 18
    Session("myObjectID") = 12345
    %>
    <!-- in your aspx file -->
    <pt:standard.openerlink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectid='<%=Session("myObjectID")%>' pt:classid='<%=Session("myClassID")%>' pt:mode='2' target='myWindow' onclick=window.top.open('','myWindow','height=800,width=700,status=no,toolbar=no,menubar=no, location=no');>Adaptive Tags Made This Easy - Click to Open My Awesome Document</pt:standard.openerlink>
    That help?
    Personal style, I would try to avoid using session, etc. directly on your ASPX file. I'd go with writing out the HTML through labels, data lists, etc. in your code-behind.
    Thanks,
    Eric

  • Creating a FileContents breaks setTooltipText if a html string is passed

    static void ThisAlsoWorks(){
    try {
    String message = "<html><body>This is my serialized object</body></html>";
    MyToolTipTest2 toolTipTest = new MyToolTipTest2(message);
    Thread.sleep(5000L);
    FileOpenService fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
    FileContents fileContents = fos.openFileDialog(null, null);
    MyToolTipTest2 toolTipTest2 = new MyToolTipTest2(message);
    } catch (Exception ex) {
    ex.printStackTrace();
    If you mousehover the first frame before the thread.sleep ends, the tooltip shows up, the filechooser pops up, you choose a random file since it won't do anything with it, the new frame pops up, and both have their html tooltips working. However, if you relaunch it and you do not mousehover the first frame to see the tooltip before the sleep ends and the filechooser pops up, the tooltips won't ever show up anymore on either frame.
    Here is a video of the issue: http://www.youtube.com/watch?v=bpuFB_RmuMQ

    user9177879 wrote:
    Thank you,.. You're welcome.
    ..following that link's workaround of adding ParserDelegator workaround = new ParserDelegator(); before using the FileContents did solve the issue somehow.Glad it worked for you. I have projects that use HTML in labels and need to revisit them to implement that workaround, though I'm busy on other matters at the moment.
    BTW - when posting code or code snippets, HTML/XML or input/output, please use the code tags as described on the 'sticky post' at the top of the forum thread listing.

  • How to make custom html form buttons - here's a way to do it.

    I have been trying to create custom HTML form rollover submit/Reset buttons but could not get it going.
    There is a Javascript way but I do not know how.
    Anyway, I manage to get it working in all browsers except for IE 6. It does not hover in IE 6.
    Here is the HTML code:
    <label class="contact_form_btn">
    <input type="submit" name="submit_btn" class="contact_form_submit_btn" value="Submit form" />
    </label>
    And here is the CSS:
    .contact_form_btn, .contact_form_submit_btn {
        margin: 0;
        padding: 0;
        display: block;
        line-height: 40px;
        height: 40px;
        width: 200px;
        font-family: "Century Gothic", "Trebuchet MS", Verdana, Tahoma;
        font-size: 20px;
        color: #FFFFFF;
        font-weight: bold;
        float: left;
        background-image: url(../my_website_images/form_btn_set.jpg);
        background-repeat: repeat-x;
        background-position: bottom;
    .contact_form_btn {
        background-image: url(../my_website_images/form_btn_set.jpg);
        background-repeat: repeat-x;
        background-position: bottom;
    .contact_form_submit_btn {
        background: transparent;
        border: none;
        cursor: pointer;
        float: left;
        clear: left;
    .contact_form_btn:hover {
        background-image: url(../my_website_images/form_btn_set.jpg);
        background-repeat: repeat-x;
        background-position: top;
    It works perfectly but not in IE 6.
    In IE 6 the image does work but there is no hover effect.
    I'm using it anyway - screw it.
    But for the sake of learning and advancement  - does anybody have an idea why it will not rollover in IE 6?

    JoeyD1978 wrote:
    You can use an HTC to fix the hover on IE6:
    http://www.danvega.org/blog/index.cfm/2008/1/1/CSS-hover-selector
    Hello,
    I read the information on the link you posted but I'm a litle confused as to how this is implemented.
    There is nothing mentioned about attaching a script to the document.
    All I read is that you add this to the body:  body {    behavior: url("csshover3.htc"); }
    And so my question is. The files that you download, where do you put them? Do you attached them to the header of the html page?
    Or do you pull them through the url that's attached in the CSS page body?
    I have contacted the author but if you know the answer, please explain further.
    Thanks again, Patrick

  • Problem in tree while using the HTML format in the lable

    Hi all,
    DefaultTreeCellRenderer is not working properly if we pass the string as a html format inside the DefaultMutableTreeNode. Using the below code snipet you can cleraly identify the problem.
    Kindly compile &execute the below code.All the lable's will be painted properly according to the color code that i've mentioned.
    After that please uncomment al the DefaultMutableTreeNode variables corresponding to html tag representation and comment the already existing DefaultMutableTreeNode variables .
    someone please clarify me the things what is happening here?
    import java.awt.BorderLayout;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    public class MultiLineTreeDemo extends JFrame {
         private JTree tree;
          final int[] colorcode={0xFF0000,0x00FFFF,0x0000A0,0x800080};
         public static void main( String[] args ) throws Exception {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new MultiLineTreeDemo(); }
         public MultiLineTreeDemo() {
              super( "MultiLineTreeDemo" );
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( "<html>This is<p>the root node.</html>" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( "<html>This is<p>a child node.<html>" );
              DefaultMutableTreeNode leaf = new DefaultMutableTreeNode( "<html>This is<p>a leaf node.<html>" );
              DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode( "<html>This is<p>a leaf1 node.<html>" );
              /*DefaultMutableTreeNode root = new DefaultMutableTreeNode( " root node" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( " child node" );
              DefaultMutableTreeNode leaf = new DefaultMutableTreeNode( " leaf node" );
              DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode( " leaf1 node" );*/
              node.add(leaf);
              root.add( node );
              root.add( leaf1 );
              tree = new JTree( root );
              tree.setCellRenderer(new DefaultTreeCellRenderer()
                           public Component getTreeCellRendererComponent(JTree pTree,
                               Object pValue, boolean pIsSelected, boolean pIsExpanded,
                               boolean pIsLeaf, int pRow, boolean pHasFocus)
                                JLabel lbl = (JLabel)super.getTreeCellRendererComponent(pTree, pValue, pIsSelected,pIsExpanded, pIsLeaf, pRow, pHasFocus);
                                DefaultMutableTreeNode newNode=(DefaultMutableTreeNode)pValue;
                                if(newNode.isRoot())
                                lbl.setForeground(Color.red);
                                else if(newNode.isLeaf())
                                 lbl.setForeground(Color.green);
                               else
                                lbl.setForeground(Color.blue);
                               JPanel p = new JPanel();
                               p.setBackground(tree.getBackground());
                               Dimension d = lbl.getPreferredSize();
                               p.setPreferredSize(new Dimension(d.width, d.height));
                               p.add(lbl);
                             tree.setRowHeight(80);
                            return (p);
              setLayout( new BorderLayout() );
              JScrollPane scrollPane = new JScrollPane( tree );
              add( scrollPane, BorderLayout.CENTER );
              setSize( 200, 200 );
              setVisible( true );
    }Thanks in Advance.
    Sivabalan

    Then I guess the problems come with setting explicit foreground colours on the one hand and using html on the other, even when not specifying them in the html. Stick to one or the other, I suppose. I'm not a fan of using html in labels so I don't know what problems you might run into.
    I've got rid of setForeground in the renderer and set the font colour in html. Then it is stable:
    import java.awt.BorderLayout;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.*;
    public class MultiLineTreeDemo extends JFrame {
         private JTree tree;
          final int[] colorcode={0xFF0000,0x00FFFF,0x0000A0,0x800080};
         public static void main( String[] args ) throws Exception {
              SwingUtilities.invokeLater( new Runnable() {
                   public void run() { new MultiLineTreeDemo(); }
         public MultiLineTreeDemo() {
              super( "MultiLineTreeDemo" );
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( "<html><font color=\"#FF0000\">This is<p>the root node.</font></html>" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( "<html><font color=\"#0000FF\">This is<p>a child node.</font><html>" );
              DefaultMutableTreeNode leaf = new DefaultMutableTreeNode( "<html><font color=\"#00FF00\">This is<p>a leaf node.</font><html>" );
              DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode( "<html><font color=\"#00FF00\">This is<p>a leaf1 node.</font><html>" );
              DefaultMutableTreeNode root = new DefaultMutableTreeNode( " root node" );
              DefaultMutableTreeNode node = new DefaultMutableTreeNode( " child node" );
              DefaultMutableTreeNode leaf = new DefaultMutableTreeNode( " leaf node" );
              DefaultMutableTreeNode leaf1 = new DefaultMutableTreeNode( " leaf1 node" );
              node.add(leaf);
              root.add( node );
              root.add( leaf1 );
              tree = new JTree( root );
              tree.setCellRenderer(new DefaultTreeCellRenderer()
                           public Component getTreeCellRendererComponent(JTree pTree,
                               Object pValue, boolean pIsSelected, boolean pIsExpanded,
                               boolean pIsLeaf, int pRow, boolean pHasFocus)
                                JLabel lbl = (JLabel)super.getTreeCellRendererComponent(pTree, pValue, pIsSelected,pIsExpanded, pIsLeaf, pRow, pHasFocus);
                                DefaultMutableTreeNode newNode=(DefaultMutableTreeNode)pValue;
    //                            if(newNode.isRoot())
    //                            lbl.setForeground(Color.red);
    //                            else if(newNode.isLeaf())
    //                             lbl.setForeground(Color.green);
    //                           else
    //                            lbl.setForeground(Color.blue);
                               //JPanel p = new JPanel();
                               //p.setBackground(tree.getBackground());
                               //Dimension d = lbl.getPreferredSize();
                               //p.setPreferredSize(new Dimension(d.width, d.height));
                               //p.add(lbl);
                             //tree.setRowHeight(80);
                            //return (p);
                            return (lbl);
              setLayout( new BorderLayout() );
              JScrollPane scrollPane = new JScrollPane( tree );
              add( scrollPane, BorderLayout.CENTER );
              setSize( 200, 200 );
              setVisible( true );
    }

  • Contact form labels do not show in Chrome until refreshed

    On my contact page, http://truehdfitness.com/contact.html, the labels do not show up unless the user refreshes the page.  It's happened to everyone who has tested the page for me and used Chrome as well as on my own computer.  For now, I've added a note about the issue, but that's obviously not the optimum solution.  Any suggestions?
    Thanks!
    Dedi

    What you are probably experiencing is a known bug with Chrome 33. Refer to this thread - http://forums.adobe.com/message/6157419.
    We also have a workaround for that - http://muse.adobe.com/exchange-library/chrome-33-webfont-workaround-1.
    Thanks,
    Vinayak

Maybe you are looking for

  • Need Recommendation On First Drawing Tablet (PC)

    Hi, I am a web developer (I mostly do the 'plumbing' -- PHP, SQL, CSS) and work with art already received. I do various tasks in Illustrator and PS, such as color correction or converting a photo to a line art logo, but up until now never done much '

  • IPad Facebook issues with Safari

    Upgraded our iPad2 to 5.0.1 and when we now access Facebook via Safari, the video in Facebook now loads over the text. According to a Genius Bar guy at our local Apple store, this is a Facebook issue. I don't want to use the new Facebook app as it's

  • How to verify the caching

    My Queries are not caching even i enabled chaching in NQScinfig.ini file. How to verify and resolve the problem. Please suggest the answer.

  • SMI: Error with PO confirmation

    Hi all, I'm implementin SMI scenario with SNC 5.1, I've created a RO from SMI Details (SNC web UI), I've published it and VendorGeneratedOrderConfirmation.XML was sent from SNC to ECC for PO creation. In ECC the PO is created but there is the followi

  • SAP MAPI Provider

    Hi all, We have SAP MAPI Provider for integration between Outlook and Workflow. We have refresh problems. The note number 627397 give two alternatives, but our problems is that in both alternatives the user have to re-loging each time in SAP R/3. Tha