Adding a html link to JLabel

Hi...
So, what I want is a JLabel or maybe a JOptionPane to have a HTML link on it to a website and if the user clicks on said link I would like their default browser to fire up and hit that page. Thus in the below code I have a JLabel with "Java" showing and underlined like it is a link...now, how do I get this event processed?
JLabel linkLabel =
new JLabel("<html><a href="+"http://www.java.sun.com"+">Java</html>");
TIA
tfm

search is your friend:
http://search.java.sun.com/search/java/index.jsp?col=javaforums&qp=%2Bforum%3A31&qt=hyperlink+label

Similar Messages

  • Adding a html link to a carousel

    i have followed a tutorial to build a flash craousel and have had no problems in building that.  i wanted to add a html link to a section of the carousel but everything i have tried up to now has failed.  All the information is passed through to the carousel from an xml file and everything works fine except for the link.
    i have slightly modified the tutorial so i have an extra box on the information page which holds the web address for the site they are looking at in the portfolio.  i have the address showing up but i cannot use the text as a link.
    the box that i am putting it in is a dynamic text box which has been set up with the following settings
    theLink.html = true;
    theLink.htmlText = t.Link;
    so as far as i know these are set to be able to handle html tags/code but they are not playing games.
    i have tried to pass the link through to the swf file from the xml file with the following code but this just seem to break the whole application.
    Link="<![CDATA[<a href='http://www.acmeart.co.uk/pip_new']]"
    to view how i have the file working upto now please view the link below.
    http://acmeart.co.uk/carousel
    i feel the problem is not with the flash application but more with how i am trying to pass the html link over to the application from the xml file.  i will attach the xml file to the post.

    What I had in mind was to place the link inline in your text. Something like this:
    <item name="valley" full="assets/valley.png"
            title='Book - CD ROM'
            body='This product was a Shockwave holiday card. It began as a jigsaw puzzle. As the puzzle was solved, it opened and displayed the holiday greeting. &lt;a href=&quot;http://www.amazon.com" &gt;Purchase a copy.&lt;a\&gt;'>
        </item>
    The url is right in the text. The html markup is escaped as html entities.

  • Html link inside JLabel

    I write this code:
    String text ="<html><font size=2>Java-Editor</font>"
    +  "<P>"
    + "Homepage: <a href=\"www.b2m.it/ma\"> http://www.b2m.it</a></html>";
    JLabel textLabel = new JLabel(text);I show the jlabel inside a jdialog.
    When i press on hyperlink, the link don't work
    where is the error?

    You could use a java.awt.event.MouseListener on the label, it would be something like
    public class MyClass extends javax.swing.JFrame implements ajva.awt.event.MouseListener
         // public variables
         public MyClass()
              JLabel label = new JLabel("label text");
              label.addMouseListener(this);
              //other initializations          
         public void mouseClicked(java.awt.event.MouseEvent e)
              //handle click
         //other methods

  • Adding HTML link to buy subscription from article

    Hi,
    Is it possible to create a HTML link from a button or some text in an article which invokes the buy subscription popup box?
    On the main page for the viewer that shows the individual issues you can click to buy one issue or click a banner across the top to buy a subscription.
    Once this is clicked a popup box is displayed which shows the different pricing levels.
    Is there anyway to start this subscription purchasing from within an article?
    Thanks

    Hi Bob,
    I would like to link the subscription options out of an article. I don't think it will work with the goto links or am I wrong? I've seen this in the digital Esquire (see image attached).
    Best,
    Jens

  • Html:link not working in struts project driving me mad, please help...

    Afternoon all,
    Can anyone help me with an issue I'm having with my first struts project, I'm learning as I go.
    Anyway, I'm trying to create a bog standard hypertext link which passes a value back to a specified struts action. The flow of the application
    is as follows:
    1) search.jsp
    User enters a name and postcode to search on, then click submit
    2) searchAction
    Struts action 'search' is called and does the search in a back-end db.
    Each result found from search is created as a javabean (named resultsBean), and added to a list object. The list object is set as a request
    attribute named 'SearchResults'.
    The action is then forwarded on to another jsp page named results.jsp
    3) results.jsp
    The results.jsp page retrieves the list object from the 'SearchResults' attribute and loops through each entry
    in the list and converts each entry to the 'resultsBean' javabean object.
    Each resultsBean object has a getVirtualID method which stores a string value. This value is retrieved and a hypertext link is created which
    passes this value on to another struts action named 'select'.
    When this link is clicked on, the select struts action is called and the value passed as a parameter is retrieved.
    This is the part I can't get to work, I can't get the link to render properly. When I click the link the select action retrieves
    & lt;%= resultsBean.getVirtualID() & gt; as the value of the parameter 'vid' instead of the value stored in the getVirtualID method of the resultsBean.
    Listed below is the code from my results.jsp page. If anyone can help me get this to work I would be very grateful.
    Thanks in advance,
    Alex
    results.jsp code
    <%
       List searchResults = (List)portletRequest.getPortletSession().getAttribute("SearchResults");
    %>
    <div id="table_layout" style="width: 713px; margin: 0px 0px 0px 3px;">
      <div id="row">
        <div id="column"><img src='<%= response.encodeURL("/images/results.gif") %>' alt="" width="223" height="159" border="0" /></div>
         <div id="column" style="width: 30px;"></div>
         <div id="column">
          <div id="table_layout" style="width: 460px;">
            <div id="row" style="width: 430px; border-bottom: 1px solid #4e137d;">
              <div id="column" style="width: 155px;">Name</div>
              <div id="column" style="width: 10px;"> </div>
              <div id="column" style="width: 130px;">Address</div>
              <div id="column" style="width: 10px;"> </div>
              <div id="column" align="right" style="width: 120px;">References</div>
            </div>
    <% if (searchResults.size() > 0) {
           Iterator it = searchResults.subList(0, searchResults.size()).iterator();
           ResultsBean resultsBean = new ResultsBean();
           while (it.hasNext()) {
                resultsBean = (ResultsBean)it.next(); %>
            <div id="row" style="padding: 5px 0px 10px 0px;">
              <div id="column" style="width: 155px;"><html:link styleClass="results"  page="/select.do?vid='<%= resultsBean.getVirtualId() %>'" title="<%= resultsBean.getFullName() %>"><%= resultsBean.getFullName() %></html:link></div>
              <div id="column" style="width: 10px;"></div>
              <div id="column" style="width: 130px;"><%= resultsBean.getFullAddress() %></div>
              <div id="column" style="width: 10px;"></div>
              <div id="column" align="right" style="width: 120px;"><%= resultsBean.getReferenceIcons(portletResponse) %></div>
              <div id="column" style="width: 13px;"></div>
              <div id="column" style="width: 22px;"><input id="<%= resultsBean.getVirtualId() %>" name="ckbox" type="checkbox" value="" title="tick to select for merging" style="border: 0px solid #ffffff;"></div>
            </div>
    <%     }
       } %>
           </div>
         </div>
      </div>
    </div>
    <br />
    <br />
    <html:link forward="/searchpage">Return to search page</html:link>

    If you have part of an attribute dynamic, you need to make the entire attribute an expression.
    ie instead of
    page="/select.do?vid='<%= resultsBean.getVirtualId() %>'"
    it has to be
    page="<%= "/select.do?vid=" + resultsBean.getVirtualID() %>"
    However for my approach, I would aim for zero scriptlets, and use the struts tags even more. For instance instead of an iterator, use the struts logic:iterate tag (or the JSTL c:forEach>
    Also instead of div tags, I would use html table tags - <table> <tr><td> etc etc. Thats what its for right?
    Here is at least some of it rewritten with struts tags.
    I left out the div tags so I could focus on the "important" stuff.
    <logic:iterate id="resultsBean" name="SearchResults">
      <html:link styleClass="results"  page="/select.do" paramId="vid" paramName = "resultsBean" paramProperty="virtualId">
        <bean:write name="resultsBean" property="fullName"/>
      </html:link>
      <bean:write name="resultsBean" property="fullAddress"/>
    <%= resultsBean.getReferenceIcons(portletResponse) %>
    <input id="<%= resultsBean.getVirtualId() %>" name="ckbox" type="checkbox" value="" title="tick to select for merging" style="border: 0px solid #ffffff;">
    </logic:iterate>I'm not entirely certain what you are doing with that checkbox at the end. They all have the same name, but no value. You couldn't identify at the server end which one was clicked.
    Hope this helps some,
    evnafets

  • Html link to pdf works ok on mac but not on ipad. adobe reader for ipad downloaded.

    HTML link to pdf works ok on Mac but not on ipad. Adobe Reader for ipad downloaded. What's wrong?

    Hi pwillener,
    Thank for reply. The pdf’s are in a subfolder “PDF” of the folder holding the web page. The web page itself uses
    . This works in full size computer browsers but not in an iPad.
    My excursion through the search engine has produced the idea of adding #page = requesting page to the URL but I have not had time to try it perhaps without the = sign.
    Bryan

  • Html link to verify google

    Hi! i cannot figure out why this is so hard.....i am trying to paste an html link to google on my website so i can ratify it google.
    only google doesn't recognise it or apple won't allow it.
    Please does anyone have any ideas on what i may be doing wrong?
    thanks

    You can have a personal domain name even though you publish to MobileMe. Find out about it here....
    http://iwebfaq.org/site/iWeb_Domains.html
    You can't give the URL to Google to find the HTML verification file is all. You have to give them the MobileMe URL.
    When you publish to a server other than MobileMe using FTP, the root folder is the first level folder that contains all the files and folders for your website. Also, if you publish to a commercial hosting service, domain names become a lot easier as does the whole of search engine optimization.
    MobileMe was designed for small personal websites and the facility to use a domain name was added in iWeb '08. Its not very satisfactory and creates a few problems. You can only have one domain name using Cname and the rest have to use masking which is a disaster as far as SEO goes.
    Don't give up on iWeb - consider publishing to somewhere other than MobileMe! Find out why here...
    http://iwebfaq.org/site/iWebFolderFTP.html
    "I may receive some form of compensation, financial or otherwise, from my recommendation or link."

  • html:link .... Struts

    I want a Link as action
    MyJsp.jsp
    <html:link action="/MyAction?myParam=true">MyText</html:link>
    MyAction.java
    in der Methode execute (...........)
    String Str = request.getParameter("MyParam");
    the pProblem I becom the Str null whay ????
    thanks

    You can't map the action directly to an Action class.
    You have to map it via the struts-config.xml with an action like:
    <action path="/myAction" type="MyAction"/>
    And call this action from the jsp by f.ex.
    <% pageContext.setAttribute("MyParam", "Hello"); %>  <!--just adding a parameter -->
    <html:link action="/myAction" name="MyParam"/>The name attribute specifies the query string parameter(s).
    You should be able to access the parameter now in MyAction with your original execute method.

  • HTML link in a Java?

    Hya,
    How can create a HTML link in Java GUI, for example in a JLabel?
    thanks inadvance

    I'm not quite sure but i think if you add addHyperlinkListener to the jlable it will be seen as a link.
    Have a look at this code example:
    try {
            String url = "http://www.google.com";
            JEditorPane editorPane = new JEditorPane(url);
            editorPane.setEditable(false);
            editorPane.addHyperlinkListener(new MyHyperlinkListener());
        } catch (IOException e) {
        class MyHyperlinkListener implements HyperlinkListener {
            public void hyperlinkUpdate(HyperlinkEvent evt) {
                if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                    JEditorPane pane = (JEditorPane)evt.getSource();
                    try {
                        // Show the new page in the editor pane.
                        pane.setPage(evt.getURL());
                    } catch (IOException e) {
        }

  • HTML links in Vibe Feed and digest e-mails do not work on GW 8.0.3client

    I have GroupWise 8.0.3hp1 on NetWare 6.5.8 and a Vibe 3.3 install on
    SUSE 11 (the downloadable Vibe demo virtual machine from Novell's site).
    I have recently started upgrading GroupWise clients on Windows 7 PCs
    (64bit), and have been testing Vibe. I have run into a problem with
    HTML links in GW clients not working on PCs where the GW client has been
    upgraded.
    This problem occurs using the GroupWise 8.0.3hp2 and 8.0.3hp3 clients,
    but does not occur on a 8.0.2hp2 client, so it appears to be GroupWise
    client related. I haven't tested any other client versions.
    1. When using the GW 8.0.3 client, if I select any of the "Novell Vibe
    OnPrem", "Favorites", or "My Teams" folders, I can see the Vibe Feed
    display showing entries for sites I'm following. But clicking on the
    links in these entries does nothing, so I cannot use the Vibe Feed to go
    directly to files, profiles, etc. The same Vibe Feed links from the
    Vibe web browser interface or from a GW8.0.2hp2 client works fine.
    2. If I have e-mail digest notifications setup to let me know when
    changes are made to a folder or file in Vibe, the e-mails are delivered
    to me just fine. But once again, none of the links in the e-mails work
    when using the GW8.0.3 client. Clicking on them does nothing. If I
    look at the e-mail message source, I can copy-and-paste the URLs
    directly into a browser and they work fine, so the URLs themselves are
    correct. Again, these links work fine if I use the GroupWise WebAccess
    or a GW8.0.2hp2 client.
    Is the GW 8.0.3 client is blocking these HTML links? I receive no
    notification from the client asking whether to "unblock" any
    links/scripts/images when viewing messages with these Vibe links.
    Any suggestions for getting these to work on GW 8.0.3 client?
    Thanks,
    -Greg
    former e-mail for posting:
    [email protected]

    Greg,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

  • Problem with HTML in a JLabel

    Is it possible to use styles when using HTML in a JLabel?
    Example:
    <html><hr style="height: 1px; color: black;"></html>Doesn't work correctly as this should give a solid 1px high hr, but doesn't. Instead it gives a black hr with a white shade...
    The JLabel it is used in is not customized in any way.

    I too am interested in getting color on an HR to work. Can you summarize what you have done to date? Sample code?
    Note: An easy way to correct it in a Nonframe instance of html is to subclass HTMLEditor to implement your own ViewFactory and own HRuleView which checks the attribute tag color for the color. I've got this to work, but frames don't work since you can call FrameView (not public) and thus have to use the super class - which then by-passes the ViewFactory from then on.
    So a NON-FRAME Solution to give HR color is... Anybody have a better global solution?
    Here is the one line fix to HRuleView .setProperties. So if you subclass HRuleView specifically to do
    public class MyHTMLEditorKit extends HTMLEditorKit { // StyledEditorKit
        private static final ViewFactory defaultFactory = new MyHTMLFactory();
        public static class MyHTMLFactory extends HTMLFactory {//implements ViewFactory {
             public View create(Element elem) {
             Object o = elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
             if (o instanceof HTML.Tag) {
              HTML.Tag kind = (HTML.Tag) o;
              if (kind == HTML.Tag.HR) {
                  return new MyHRuleView(elem);
           return super.create(elem);
    class MyHRuleView extends View  {
         private Color color = null;
         public void setPropertiesFromAttributes() {
              super.setPropertiesFromAttributes();
              try {color = new Color(Integer.decode((String)attr.getAttribute("color")).intValue());} catch (Exception e) {}
         public void paint(Graphics g, Shape a) {
              if (color != null) g.setColor(color);
              super.paint(g, a);
    }

  • Preserving HTML links when converting Word docs

    I created a document in MS Word for Mac 2011 (ver 14.5.2)
    When I used Adobe Pro 11 to convert the document into pdf format, all the HTML links are lost. 
    I have tried converting from MS Word, opening the word version with Adobe Pro, printing from MS Word to pdf.  Nothing works. Even opened the MS Word document using Apple's Pages software, re-formatted and then converted to pdf.  Still no live links.
    Best work around so far is to convert and then use the edit feature in Adobe Pro to re-insert the HTML links as invisible rectangles on top of the still-blue-and- underlined text.  So to the user it looks like the html links are still live, but what a pain for editor.
    I have seen this issue raised in other posts, but none of the answers seem to work. And the work around described above is clearly less than ideal.
    Very curious, as reading other posts, the issue apparently does not arise when the word doc converted from a Wintel computer.  But I can't imagine Adobe writes software one way for Intel and another for Mac.

    Imagine it. this has been 15 year fued between Microsoft and Adobe.  Adobe Claims that Mac office doesn't hav ethe proper hooks for URLs. Microsoft says the fault is with adobe.
    Since a Word Created file will work when opened in the windows version  and saved as a PDF, the links work just fine. Just opening and not saving, but converted to Pdf does nothing to the actual Word File.
    They had it fixed last year  in Acrobat X if your dropped the file on to Acroabt directly. But broke it again with the upgrade to XI.
    IF you have iWork and Open the word file in Pages then exported as a Word.docx file then create The PDF the links will become active.  Also if you Open in OpenOffice and export as docx file the resulting PDF when open in Word and PDF is Created the links will become active.
    If you have neither you will have to open the PDF and add the links. Note the Links will be hot (active) but the links will not turn Blue and  be Underlined
    Mac Office2011 is a Conversion of Office2010/2007 code.  So there should be no pproblem.
    Also Don't use the Save As . . .  PDF Method. Instead go to Print Menu  click on PDF wait for context menu > the choos Adobe Quality PDF or Adobe PDF (uses Adobe's PDF engine).
    wait for next screen that shows qualtity leave as sent unles you need specific job options. click okay then next screen File name. Rename as necessary the browser to desired to location then click save.  Or you can drop the saved Word document (with Word quit.) on to Acrobat and after a minute or so the PDF will be created. (Using this method in AcrobatX would actully show URL s or Mailtos as active - They broke this in Acrobat XI PDF still can be created but hot links no longer work).
    Well it seems it does work on occasion  see: http://www.screencast.com/t/cib2kcYG

  • HTML Link to Product Revenue Detail Page

    I have a simple table report developed for the Product Revenue.
    Help me with either "Custom Text" using ActionLink or a HTML Link for navigating to Product Revenue Page.
    I tried following link
    http://"@[html]"<a target=_blank href=https://secure-ausomxafa.crmondemand.com/OnDemand/user/RevenueDetail?OMTHD=RevenueDetailNav&OMTGT=RevenueDetailForm&RevenueDetailForm.Id="@">"Click"
    Thanks
    Edited by: user648222 on Jan 22, 2009 7:54 PM

    Try this:
    'Product Detail'
    the product revenue needs the Opty ID to be passed into it. If this doesn't paste properly email me at alex.neill@{see profile} and I'll email it to you.
    cheers
    Alex

  • How Do I Make HTML Links Open in Same Window?

    Hi
    How on earth do I get the HTML links inside a flash movie open up in the same browser window where said movie is embedded in (As opposed to opening up as a new pop-up windows)? Here is the code I have inside each of the buttons I have inside my flash movie:
    var link7:URLRequest=new URLRequest("videos/december.html");
    videos_btn.addEventListener(MouseEvent.CLICK, buttonClicked7);
    function buttonClicked7(event:MouseEvent):void
    navigateToURL(link7);

    Thank you thank you thank you!!!

  • How do I add an html link/banner to a page in my flash website?

    I purchased a flash website template and am in the process of editing my main.fla file.  In order to get listed on an advertising website with a higher rating, I have to place a reciprocal link to them on my site.  However, I cannot figure out how to place an html link/banner on my site for other businesses.  If I paste the html code in a text box, all that shows up is the html code rather than the image and link it is meant to generate.  Please help!

    Flash only supports a small amount of html in text areas.  If what you re trying to include is within what it supports, then you assign the text to the textfield using the htmlText property of the TextField...
    tfield.htmlText = "<a href="...">link</a>"; // will display "link" as a link

Maybe you are looking for

  • No component usage created in enhanced web dynpro component

    Hi experts, I am facing the following problem: I'd like to enhance a web dynpro component in order to add a popup window. The popup is triggered by the process_event method. So far everything works just fine. But the popup needs to know some context

  • Computer demands hard Restart - applies to all 3 Macs at work

    To preface my question: I work for a publishing company as a graphic designer. Our department has 3 Power PC G5s w/ dual 2 GHz processors, 3.5 GB DDR SDRAM running OS X version 10.4.11. Main applications used are QuarkXPress 6.5, Photoshop CS, Ilustr

  • Editing narration for a presentation

    Preparing 30 min presnttn. Pre-recorded 5 min naratn, placed in audio wndw. Now, I'm editing transitions/builds to fit naratn and have to start over every time I want to review results. (very tedious) Sound track starts _from the beginning_ even if I

  • How do i set up myhp4500 to run wirelessly

    how do i set up my officejet 4500 to run wirelessly

  • Moving R/3 & XI from a Workgroup to a Domain

    Hi   The previous BASIS person installed an R/3 4.7 system and a XI 3.0 (NW04) system on to servers belonging to a WORKGROUP with the same name as the actual Domain here. As he is no longer on the project I can not ask him about the "logic" of this.