How to add a hyperlink to my Frame?

Hi everyone:
I want to add a hyperlink to my swing application .When user click it whick will open a IE and go to mywebsite.But it is so difficult ,my code don't work property.
    je.setPreferredSize(new Dimension(180, 22));
    je.setEditable(false);
    je.setPage("http://localhost:3030/lyomail/html/link.htm");
    final JTextField jf=new JTextField("http://java.sun.com");
    jf.setEditable(false);
    jp.setBackground(Color.orange);
    jp.setDoubleBuffered(false);
    jp.setEditable(false);
    jp.setPage("http://localhost:3030/lyomail/html/mailpic.htm");
    JLabel MyLink = new JLabel("http://www.hotmail.com");
    MyLink.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent e) {
        //Do whatever you want to do here
        URL u = null;
        try {
          u = new URL("http://www.hotmail.com");
        catch (MalformedURLException ex1) {
        try {
          URLConnection ur = (URLConnection) u.openConnection();
        catch (IOException ex) {
    jp.addHyperlinkListener(new HyperlinkListener(){
      public void  hyperlinkUpdate(final HyperlinkEvent ed){
        if (ed.getEventType()==HyperlinkEvent.EventType.ACTIVATED){
          SwingUtilities.invokeLater(new Runnable(){
            public void run(){
              try{
                Document doc=je.getDocument();
                URL u=ed.getURL();
                je.setPage(u);
                jf.setText(u.toString());
              }catch(Exception e){
                System.out.println(e.toString());
    });The Runtime.getRuntime().exec can do this well.But how to get user's Explore 's path? Where he install IE?
THks!

Hi
I change my code to :
try{
                    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://localhost:3030/lyomail");
                  }catch(IOException ed){
                     System.out.println("E:"+ed.toString());
            }But it can't work now. It report error when I run it
java.net.ConnectException: Connection refused: connect

Similar Messages

  • How to add a hyperlink to javamail attachment?

    Hi friends:
    I am writing a mail systems.I can receive email attachment using javamail API. But I don't know how to add a hyperlink to the attachment so when user click the hyperlink the file will be download to disc.
    I means that I want to add a hyperlink to the attachment,the hyperlink will get the file's path in mail server.Because the mail's attachment are stored in mail server so I don't know how to get it in my servlet.
    what I can do is get a inputstream using messagePart.getInputStream();. I only can get a inputstream in servlet.How to change the inputstream to a File when user click it and download it?
    Help!
    Thks

    I am making a same application now...
    You have 2 possibilities:
    1. Save all the data from the stream to a file That is accessible from the outside through HTTP and then put a link to it
    2. Make a link to a seperate JSP page with the following parameters: Folder name (describing where the desired message is), Message id (the number of the message inside the folder) and Part number (you will have to count it yourself). The JSP page then returns all the data.
    If you do the second thing, you will have to take care that the first line in the jsp starts with <% because if it does not, the JSP will send an \r\n and that will modify the data.
    You will also have to do the following:
    response.setHeader("Content-Disposition", "attachment; filename=myfile.txt");
    response.setContentType("application/octet-stream; name=myfile.txt");If you know the MIME type, replace application/octet-stream with the MIME type.
    Michael

  • How to add HTTP Header Response X-Frame-Options:SAMEORIGIN from OWA published via Forefront TMG 2010 to stop Clickjacking

    How to add HTTP Header Response X-Frame-Options:SAMEORIGIN from OWA published via Forefront TMG 2010 to stop Clickjacking. I have put the IIS setting X-Frame-Options:SAMEORIGIN  on my Internal CAS Server. However as the OWA page is published through
    Forefront TMG 2010, the iFrame tag is not blocked when the page is first opened. Only when you login with your credentials to the OWA page inside the frame and the page reaches IIS on the Internal CAS it gets blocked. I want to block it in the first
    instance when it is opened from TMG.

    Hi,
    Thank you for the post.
    To modify the http header, please refer to this blog:
    http://tmgblog.richardhicks.com/2009/03/27/using-the-isa-http-filter-to-modify-via-headers-and-prevent-information-disclosure/
    Regards,
    Nick Gu - MSFT

  • Urgent.. How to add a menubar to a frame by reading a file

    Hi All,
    I am involved in a project where in i need to add a menubar to the frame by reading a text file. The text file consists of all the Menu Items and subMenu items.This text file will be a editable file where-in the user can add his own menu-items.
    i.e when i run the java program i should read the menu items from a file and then display those menuitems in the Menubar.
    I am not getting the idea how i should proceed. Can any one help.
    Thanks in advance.
    Regards
    Ravi Kumar

    Sorry again - my use of i as an array index wasn't very clever. The post should have been as follows:
    Hi,
    You can read in the menu names from the file and add them fairly simply, with something like this:
    JMenuBar jmb = new JMenuBar();
    JMenu myMenu = new Jmenu("Custom");
    jmb.add(myMenu);
    in = new BufferedReader(new FileReader("file.txt"));
    JMenuItem [] menulist = new JMenuItem[MAXITEMS];
    for (int j=0; j < MAXITEMS; j++) {
    menulist[j] = new JMenuItem(in.readLine());
    myMenu.add(menulist);
    Then add the JMenuBar to the parent frame.
    However, for the menus to be of much use, you'd need to add actionlisteners to them as well.
    If you had a set of possible menu items, and it was just a question of which order the user's file defined them in, and which it used, you could then just test the name of each item in the file and assign an appropriate class of actionlistener to it, something like:
    if(menuitem.getText().equals("Open")) {
    menuitem[j].addActionListener(new OpenActionListener());
    where you'd defined the OpenActionListener class somewhere else.
    Hope this helps,
    Neil
    http://www.theBatCave.org.uk
    (Not having a very good day!)

  • How to add a hyperlink in Keynote 6.2 ???

    Hi all,
    I am trying to do something that should be really simple: add a hyperlink to a text object in Keynote. I have not found any way of doing this. In some articles I read something about a hyperlink inspector, but my Keynote doesn't have such an inspector.
    So: how on earth do I accomplish this ???

    my Keynote doesn't have such an inspector.
    All versions of Keynote have an Inspector.
    You have decided not to say what version of Keynote you are using:
    In the latest version 6.5, the Inspector is not used for hyperlinks, instead select the text box, right click and choose add link    

  • How to add a hyperlink in the text caption?

    Hi,
    I am using Captivate 5. Anybody knows how to insert a hyperlink in a text caption? For example, the texts in the text caption are "See Adobe Captivate Forum for details." How to create a hyperlink for "Adobe Captivate Forum" which leads to the forum website?
    Thanks,
    Helen

    There is no tru hyperlink object in Captivate as such.
    You can use a button or a click box to provide users with an interactive object that when clicked will call a URL or document.
    However, this doesn't really give you a mouse rollover effect the way users are accustomed to seeing in normal web hyperlinks.
    If you really want to add a piece of on screen hyperlinked text (with rollover effect) to a Captivate project, the closest you'll come to it is this widget: http://www.infosemantics.com.au/hyperlink

  • How to add scrollbar to the JInternal Frame

    How to add scrollbar to JInternal Frame?
    I have One JInternal frame i want it should have a scrollbar when we reduces its size.

    [url http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html]How to Use Scroll Panes

  • How to add a hyperlink to a jpg banner image

    Where the here is i need to add a hyperlink, the image is a jpg.
    Regards Peter

    Here is the HTML simply substitute your web page and image path:
    <a href="http://www.ama-assn.org/"><img border="0" img src="
    http://forums.adobe.com/servlet/JiveServlet/downloadImage/2-5087740-299746/257-106/bannerf an.png
    ">

  • How to Add Media to a Custom Frame That Preserves to Interactive PDF

    What I'm doing/trying to do:
    I have a custom object that I want to use as a frame in which the video would be placed. The object is a somewhat rectangular frame that I've custom made to fit over a portion of my background image.
    Adobe InDesign interactive pdf exports don't play any html embed codings I add (even after making sure the http:// is present) nor does the InDesign accept any of the video from URL links I put in from YouTube or Vimeo using the Add Media function. Therefore I tried using the actual media file and uploading it to my Adobe Indesign file. However, the video won't play or appear in my custom frame when I export it, but the video file will play when I plop it in without a frame. Before exporting I get the message: :
    So:
    A) What urls will Adobe Indesign ACTUALLY accept since all the ones I've used so far don't work?
    B) How do I add a video file to a custom frame that fits appropriately into the frame?
    C) How do I get URL based media to work in interactive pdfs?
    D) If I can't do what I'm trying to do as an interactive pdf what file should I be saving it as so that I can make it work?
    I hope that makes sense. Thanks in advance for the help!

    I have never yet heard of anyone who has successfully played a YouTube or Vimeo streaming video from an interactive PDF. You could search for some kind of a third party utility that claims to convert that to a video format. You should aim to create an MP4 file, preferably with H.264 encoding. I've also never read the description of someone who has done such a conversion, though it is theoretically possible.
    You will be unsuccessful in masking a video to play in a non-rectangular frame because in a PDF, the interactivity also is display above anything else on the page.

  • How to add delivery sms report to frame,if i use gnokii

    i uses gnokii to send sms..i made frame from java.. i succesed send sms,,but how i known about sms delivery report to frame

    Hello
    Here is a working code in VB.NET
        Private Sub AddDeliverNoteBasedOnReserveInvoice(ByVal e As Integer)
            Dim oInv As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            Dim oDln As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes)
            If oInv.GetByKey(e) AndAlso oInv.ReserveInvoice = BoYesNoEnum.tNoThen
                Exit Sub
            End If
            oDln.CardCode = oInv.CardCode
            oDln.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
            oDln.DocDate = Today
            oDln.DocDueDate = Today
            For i As Integer = 0 To oInv.Lines.Count - 1
                If i > 0 Then oDln.Lines.Add()
                oDln.Lines.SetCurrentLine(i)
                oDln.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oInvoices
                oDln.Lines.BaseEntry = oInv.DocEntry
                oDln.Lines.BaseLine = i
            Next
            If oDln.Add = 0 Then
                MsgBox("Good")
                Dim newCode As String = oCompany.GetNewObjectKey()
                MsgBox(newCode)
            Else
                MsgBox("Error " + oCompany.GetLastErrorDescription())
            End If
        End Sub
    use the this link to convert to c#
    Regards,
    János
    Edited by: János Nagy on Nov 30, 2009 9:21 AM

  • How to add a Hyperlink to open popup in dynamic data grid?

    Hi,
    I am a new bie in FLEX, the question which I am asking might be very easy but i am not able to find solution to it. Please can some one help me.
    I am creating a data grid dynamically using action script code now I want to add a Hyper link to couple of columns in a row. How can I do it in FLex?
    Thanks.

    HI Prashant,
    Thanks for the reply.
    This is what I am currently doing right now:
    for 
    (var i:int=0; i<colNameList.length;i++) { 
    var headerText:String = colNameList[i] + ""; 
    callSellGridCol = cols[i];
    callSellGridCol.headerText = headerText;
    if(headerText != null && headerText == "RIC"){
    var myRenderer : ClassFactory = new ClassFactory(com.db.carving.synthetic.dma.view.UrlLinkRenderer);
    In My Renderer class :
    public 
    class UrlLinkRenderer extends LinkButton{
     public var clickFunction:Function; 
    public function UrlLinkRenderer() { 
    super();}
    // Override the set method for the data property. 
    override public function set data(value:Object):void{
    super.data = value; 
    if (value != null){
    label = value[DataGridListData(listData).dataField];
    else{
    label =
    super.invalidateDisplayList();}
    Now what i want is to add a new Event Listner to this object so that I can click it?
    In your suggestion you said:
                         var classFacory:ClassFactory = new ClassFactory(LinkRenderer); // here LinkRenderer is any mxml/ as file Having Link Button defined.
    Where should be the Link button defined??
    Thanks.

  • How to add several hyperlinks in a graph on different location

    Hi,
    I have been able to create hyperlink using srw.set_hyperlink() for text report.
    I create a bar graph to show data monthly, (Jan, Feb, ..., Dec), thus showing 12 bars in a bar graph.
    I need to make different hyperlink (to drill down) for each month.
    So when user click one of the bar (i.e January bar), then it will drill down to data for January.
    Is there possible to create several hyperlinks in a graph, to link to different location?
    If possible, where should I put the srw.set_hyperlink()?
    How can we handle, the location to be placed with the srw.set_hyperlink()?
    What if it is a pie graph, can we do the same?
    Many thanks,
    Buntoro

    Hi Fazith,
    thanks for your answer.
    I have tried it:
    a=CROSSTAB_1.getSelectedMember("OD_NW_Regio").text;
    APPLICATION.opennewWindow("http://www.wetter.net/47/"+a);
    For testing, I want that the name of the city which is filtered with Dimension OD_NW_REGIO should be added to the url wetter.net (it should show me the weather for the selected city).
    But this script didn't work. I think i have to define "a" or not?
    And according to the onselect function, will the separate report (in this case the weather-side for the selected city) open automatically, or must I click anything?
    Thank you for your help.
    Kind regards,
    Heike

  • How to add Context Menu to Some frames and not others..

    Hi
    I am trying to add a context menu to my InDesign plug-in based on the link http://support.adobe.com/devsup/devsup.nsf/docs/50383.htm
    I am using the context key "RtMouseLayout" to specify the context for my menuitem. However, I notice that this adds my menu item to all frames (graphic frames as well as text frames).
    Is there a way for me to specify that my menu item can show only when I right click on graphic frame contexts and not on text frames.
    Also I am wondering if you could point me to which file these context keys are defined.. I found AdobeMenuPositions.h file, but I could not find the file where the "RtMouseLayout" key is defined..
    Thanks a lot for your help!
    - Sameer

    Hmm. It also possible but IMO more complex. Take a look on BPISuiteASB.cpp and BPISuiteCSB.cpp in basicpersistinterface sample. I mean just take a look on Selection Suites. From BPISuiteLayoutCSB.cpp you can get UIDList of currently selected objects on page. So ...
    If you call IBPISuite (also in BPI sample it's showed) from ActionComponent then you can kEnabledAction or kDisabled_Unselected your menu item in UpdateActionStates.
    Maybe that will help you
    Regards
    Bartek

  • How to add action listener to internal frame?

    I have frame Main where I am trying to add action listener.
    Action listener should be listening button in frame Menu.
    I think it should be:
    Menu frame = new Menu();
    frame.btn_start.addActionListener(this);but it seems to be doing absolutely nothing.
    If I try to add in menu:
    btn_start.addActionListener(new Main());it generates: java.lang.StackOverflowError
    What should I do? Please help noob :)

    To get better help sooner, post a [_Short, Self Contained, Compilable and Executable, Example Program (SSCCE)_|http://mindprod.com/jgloss/sscce.html] that clearly demonstrates your problem.
    You're quite possible adding the ActionListener to the wrong component. And constructing a new instance of a class within the constructor is likely the cause of your StackOverflowError.
    db

  • Anyone know how to add a hyperlink to the HTML Gallery template?

    In previous versions, I created a modified HTML template which included a link back to a specific page. This placed the link on ALL of the Index pages. Now I must modify HUNDREDS of indices to accomplish the same thing. There has GOT to be a better way!

    With iOS 5 in the Autumn (from http://www.apple.com/ios/ios5/features.html#more) :
    Even add and delete mailbox folders on the fly.

Maybe you are looking for