Links in a TextPane

Hi guys. How do i add an underlined text to a text pane that can change the cursor when hovered over. I want to trigger events when this is clicked.

Read the JEditorPane API. It gives an example.

Similar Messages

  • Detecting links in a JEditorPane

    Hello!
    I'm using a small JEditorPane (220px by 100px) to display simple HTML pages. The contents of the pane can be scrolled using the standard scroll bar. What I'd like to be able to do is to detect if any links are currently visible in the pane. So, if I'm scrolling through a page and a link comes in to view in the JEditorPane, I'd like my app to detect that a link is visible.
    Any ideas would be greatly appreciated!
    Matt

    Hi Matt
    You can find all the links available on any html page. below is the code.
    Document baseDocument = textPane.getDocument();
    if (baseDocument instanceof DefaultStyledDocument) {
    DefaultStyledDocument hdoc = (DefaultStyledDocument) baseDocument;
    HTMLDocument.Iterator htmlDocumentIterator= null;
    AttributeSet tagAttributeSet=null;
    Enumeration enum= null;
    htmlDocumentIterator = ((HTMLDocument)hdoc).getIterator(HTML.Tag.A);
    while(htmlDocumentIterator.isValid()){
    tagAttributeSet = htmlDocumentIterator.getAttributes();
    enum = tagAttributeSet.getAttributeNames();
         while(enum.hasMoreElements()){
         Object obj = enum.nextElement();
    htmlDocumentIterator.next();
    Even i was struglling with the same problem. But now my problem is how to identify a link when ever amouse is positioned over a link. I was able to achieve with j2sdk1.4 but since i want it to be done by using j2sdk1.3 . Since in 1.3 HyperlinkEvent doesn't return element object. Now what i need to do is i need to generate the offset position using mouse movement . Please let me know if you or anyone knows about it. its urgent

  • How to display only a text in a string as a link??

    Hi All,
    In my application I have a datagrid. In 1 column of the datagrid I am populating messages which are posted from user. My problem is i have to search for a particualr text in all the messages and if it is there then i have to display as a link/linkbutton/button.
    Could you please let me know how can i do this
    Thanks

    Here is the solution that should work for any size text and any maximum width. This solution will lock the JTextPane to the maximum width while allowing the dialog height to grow to fit the text.
    import javax.swing.*;*
    import java.awt.*;
    public class FooDialog extends JDialog{
       public static void main(String args[]) {
          final int MAX_WIDTH = 256;
          //build the dialog
          FooDialog dialog = new FooDialog();
          JTextPane textPane = new JTextPane();
          textPane.setEditable(false);
          textPane.setText(
          "FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR");
          JScrollPane scrollPane =
             new JScrollPane(textPane,
                                      JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                                      JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
          scrollPane.setBorder(null);
          scrollPane.setPreferredSize(new Dimension(MAX_WIDTH, 0));
          dialog.add(scrollPane, BorderLayout.CENTER);
          //show the dialog
          dialog.pack();
          JViewport viewport = scrollPane.getViewport();
          viewport.doLayout();
          scrollPane.setPreferredSize(viewport.getViewSize());
          dialog.pack();
          dialog.setVisible(true);
    }The first pack() will lay out the dialog, but the viewport.doLayout() will insure that the JTextPane is laid out. (Which rarely happens with the first pack() alone.) The last pack() re-lays out the dialog with the JScrollPane 's new preferred size--the view size that the JTextPane became during the viewport.doLayout() .

  • Download error in (osx) adobe desktop app (corrupted download link).

    Here is a discription of the problem. Please consider that some of the wording might not be correct, as I do have to translate the error message from German into English.
    Using OSX 10.9.2, when clicking inside the adobe desktop app (top of the screen bar) on the tap "apps", the following screen (screenshot) appears, which states, translated from top to bottom:
    download error
    download error. Please contact support.
    (link) contact support
    (link/button) download creative cloud -> This button unfortunatly leads to the following error page "http://www.adobe.com/special/errorpages/404.html"
    All apps, like Bridge, Photoshop, Lightroom, etc. are installed and work just fine. So no problem here. I seem however unable to redownload the desktop app (in order to reinstall). As stated above the provided link inside the desktop app itself is coruppted and within the (online) web-based download centre (user logged in) I am only adviced to use the desktop app. This is a dead end and I do not know what to make of this error, let alone solving it. Please help!

    I am sorry Romsinha but this doesn't really help.
    I already restarted the desktop app and while I am obviously online and connected the problem (error message) remains the same. Information within the "home" tap is recieved/loaded  (little blue spinning wheel) stating that various apps recently have been updated. Yet the same loading wheel within the "apps" tap results in an error. My best guess is that some internal link within the app is corrupted, leading to a source on a server that can not be reached.
    UPDATE
    I clean uninstalled adobe creative cloud as discribed in the article you provided (using the cleaner tool) and even uninstalled the browser plugin. After downloading and reinstalling creative cloud the problem however remains the same. "Apps" tap still shows the same problem. "Home" tap now displays the following:

  • Barra de Navegação cinza e preta encobrindo o link, como resolver?

    Instalei o Kubuntu 14.04 e, após a atualização do sistema, na barra de navegação do Firefox os links ficam encobertos pelas cores cina e preto, impedindo a leitura e atrapalhando a navegação.
    Mudei o esquema de cores padrão do sistema, e alterei o tema Gtk mas não resolveu.
    Desinstalei e reinstalei o Firefox mas o problema persiste.
    O que pode ser feito?

    Hmmm,
    # Na [[Location bar autocomplete|barra de endereços]], escreva '''about:config''' e pressione '''Enter'''. É possível que o aviso ''''Isso pode anular a garantia!'''' apareça.
    # Clique no botão '''Serei cuidadoso, prometo!''', para acessar a página about:config.
    # Procure por '''gfx.xrender.enabled''' e mude seu valor para '''false'''.
    # Reinicie o Firefox.
    Ou tente user o Tema [https://addons.mozilla.org/pt-br/firefox/addon/fxchrome/ FXChrome]

  • Links not getting displayed in the contextual panel

    Hi,
    I have created a contextual panel inside a transparent container. And created a method in the same view supply_values of type supply function to supply the values to the panel.Inside the method I have coded like:
    DATA TAB  TYPE WD_THIS->ELEMENTS_N_VIEW_SWITCH.
      DATA LINE TYPE WD_THIS->ELEMENT_N_VIEW_SWITCH.
      LINE-TEXT    = 'User Manual'. "#EC NOTEXT
      LINE-ENABLED = ABAP_TRUE.
      APPEND LINE TO TAB.
      LINE-TEXT    = 'Logout'. "#EC NOTEXT
      LINE-ENABLED = ABAP_TRUE.
      APPEND LINE TO TAB.
      NODE->BIND_TABLE( TAB ).
    Also in the context of the view I have created a node and supplied the method  'supply_values' in the supply function.Under the node I have 2 attributes named text and enabled. Text is of string type and enabled is of boolean type. In the properties of the contextual panel I have bound the visible property with the enabled attribute.
    Now when I am running this application , links are not getting displayed in the contextual panel. Though when I debug TAB contains the values.  Please suggest if I have missed out something or I need to look into the properties of the contextual panel. Any pointers will be really helpful.
    Regards,
    Ashutosh

    Hi,
    Can you elaborate ' ItemEnable property of ViewSwitch'.
    I have already bound the enable property of the panel with a context attribute of type wdy_boolean  but it is still not working. 
    Regards,
    Ashutosh

  • Links default to wrong folder

    Why is it when I go to relink a placed image in the Links pallette it always directs me to the wrong folder (not the one the image lives in but elsewhere). I believe that it is taken me to the last folder I navigated to. thoughts?

    You now have a prefernce for where relink goes, the last folder you used to link, or the folder where the original link resides. It's in the prefs.

  • How do I add URI web link with custom tooltip like "CLICK HERE TO UPDATE" instead of URI web link in tooltip.

    How do I add URI web link with custom tooltip like "CLICK HERE TO UPDATE" instead of URI web link in tooltip.

    You've probably found an answer to this by now, but I think this has been addressed in another forum -- The link below suggested using a button and adding the tooltip to the button. 
    https://forums.adobe.com/thread/304974?start=0&tstart=0
    Sounds like it would work but I haven't actually tried it. 
    Good luck~!

  • Auto-generated links exported from InDesign do not work in tablet apps

    Hyperlinks automatically detected and exported from InDesign CS6 8.0.1 as a PDF work fine on the desktop version of Acrobat Reader. However, on the iPad version of Adobe Reader as well as iBooks and GoodReader, these links are completely ignored, meaning they are just text.
    On the other hand, if I was to manually set the hyperlink in InDesign or Acrobat, the link works fine.
    It would be extremely tedious and time consuming to manually reset hundreds of hyperlinks in my documents since InDesign use to handle this correctly.
    Is this a bug? If so, it's pretty serious and should be Adobe's priority to fix since millions of people read documents on tablet devices.

    No, it's a Feature of Acrobat and reader that they attempt to create links from anything that "looks like" a URL. Other readers lack the feature.
    It's not good practice to depend on this in any case as it's hardly foolproof even in Acrobat. Links that break across lines, for example, will not be properly recognized.

  • How to link excel workbooks in Sharepoint?

    I have a master Excel spreadsheet and other sub excel spreadsheets (all on Sharepoint) that are linked to each other (copied data from one and pasted link to other) so that the Master spreadsheet auto-updates every time a sub document is modified. This
    format works if the documents are hosted on my computer, however, the links become broken if they are hosted on Sharepoint and I get a #REF! message. My goal is to have a master document that is linked to data of other sub spreadsheets and auto-updates when
    they are modified without having to open the sub spreadsheets. I would like to be able to open the master document, refresh it, and have the current data pulled from the linked sub spreadsheets. Any suggestions on how I can do this?

    I have seen this working for some folks in my company. They moved their spreadsheets into SharePoint, and changed the references to other spreadsheets from file paths to be the urls of the items in SharePoint.
    w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | YouTube: http://www.youtube.com/user/JamieMcAllisterMVP

  • Creating a Link to a Folder on a Server with Sharepoint Foundation 2013

    Hi All,
    I am looking to create a link from a page on my Sharepoint site to a folder on one of the companies servers. I have had a lot of trouble with this.
    Is there a piece of code I can use to do this?
    Thanks in advance.

    Ahh. You are using SharePoint Foundation. Yes in that case you would not have that feature.
    That makes your requirements bit tricky given I verified creating this link without Publishing feature activated and it did not work and hence I tend to believe that it would not work in your case without that feature.
    What you can try is drop the page viewer web part and try configuring it to open your file share and see if that helps. I do not have Foundation otherwise I would have verified this before posting but give it a try and see if it helps.
    http://neelb.wordpress.com/2011/09/16/displaying-a-web-site-or-file-or-a-folder-in-the-page-viewer-web-part/
    Amit

  • After delete file from documents the direct link still alive.

    Hello.
    I upload a image to the style libary folder, then i publish the file and delete him BUT the direct link to the image still work.
    I try to upload anther image with the some name but when i try to browse the direct link i get to deleted file.
    If i upload a image and delete it before i publish the file I don't have this problem.
    I try to flush the blob cache with this commends:
    $webApp = Get-SPWebApplication "<WebApplicationURL>"
    [Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)
    Write-Host "Flushed the BLOB cache for:" $webAppbut this doesn't work.I clear the cache on the local pc and doesn't work to..Any idea someone?Thanks!

    Hi,
    To check if there is cache issue, please access the url in another PC to see if the issue persists. You could also open style library in SharePoint designer to double confirm it.
    In addition, if you click the ellipsis of the image item, there will be a preview panel to show the picture, is it the newly upload one?
    Regards,
    Rebecca Tu
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Problem with links in deployed ADF application to Weblogic Server 11g

    Hi everyone !
    I have a query here, firstly, I have created an ADF application using Jdeveloper 11g and have successfully deployed (EAR file) onto the weblogic server.
    However, after testing out the application, the linking within the application does not seem to work. Whenever I click on a link or button, the page refreshes but the result is not displayed.
    What could have cause the problem?
    Thanks
    Gavin

    Are the ADF runtime libraries installed into the WebLogic server?

  • HAVE NEW 13.3 MAC AIR AND when using it to open sites in safari I have no issue until I go to a link page that is a pdf file or I am trying to save the screen info as a pdf. I only get a black screen with no data, cannot find solution in help menu

    HAVE NEW 13.3 MAC AIR (previously, still have 13.3 MCbook pro which works captures what I am looking for an answer to)
    when i open sites in safari the page opens fine if it is not a pdf based page.
    Once i open a site that has a link to another page that is a pdf based page the page comes up as a black screen with no info showing
    If I open a site that gices me an open to save a file to a word, excel type document or a pdf , everything works fine until I try to save the information to a PDF and again the screen goes black
    I have tried the safari help site but to no avail, does anyone have a solution to thid problem. (I do have the abode ofr mac program loaded)

    If you delete all the Adobe Reader stuff it will probably fix this. For almost everything, the Apple pdf handling works better.

  • I used to be able to open links in a new tab by clicking my middle mouse button, but now that I've updated it to the most recent update it doesn't work anymore. How do I fix this? I really love that feature. It works in IE and Chrome but not Mozilla.

    Ok, I used to be able to open links up in a new Tab using my middle mouse button. However, I updated firefox with the automatic Updates on the 26th of October and now I no longer can open links with my middle mouse button. Why? I use this feature just about every time I go searching on the internet so I really would like it back. I couldn't find anything that it was related to in the options so I turn this over to you guys.

    Do you have that problem when running in the Firefox SafeMode? <br />
    [http://support.mozilla.com/en-US/kb/Safe+Mode] <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    If not, see this: <br />
    [http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes]

Maybe you are looking for

  • SQL Server 2012 PowerView & PoverPivot in combination with SharePoint 2013

    Hi, I have been reading articles on the internet about this, and I am little bit confused. I understand this is also changed since in SP2013. Could someone with experience clarify. 1. It looks like Power View has become a part of Reporting Services a

  • XSLT upper-case function()

    Does anybody know how to use a upper-case() function in XSLT? I have it in a XSL mapping of a routing service. I want it as below: <xsl:when test='(upper-case(/imp1:GENERIC4) = "YES") or (/imp1:AWARDTYPE = "227")'> <top:ccFlag> <xsl:text disable-outp

  • Help!!!  I cannot install itunes

    I am a newbie at this. A couple of months ago, I downloaded and installed itunes, without any problem. However, I recently received an error message from Microsoft ("itunes has encountered a problem an needs to close") when I tried to open the progra

  • Web Services with a Site minder protected Environment

    Hi All, I am not sure this is the right group to post this, if not let me know what is the best group or forum to post this. I am having a problem with invocation of web services which are protected by a site minder SSO. I am trying to access them fr

  • How do I disable the wireless on my Photosmart C410?

    Windows 7. Pushing wireless button does not work. No menu option for turning off or disabling. This question was solved. View Solution.