Wanting to open a HTML document in users default browser using Menu Items

I have a couple of Menu items that I want to open up various HTML documents.
menuHelpItem.addActionListener(new ActionListener()
     public void actionPerformed(ActionEvent evt)
});I've seen a couple of 'solutions' to people asking about opening files, but none even compiled never mind ran. It's in my parent program, and any solution needing to throw IOException (lots of things annoyingly seem to) that'll mean the listeners need to which never seems to work. Even if it did though, the class would have to and so would all the others. Messy.
Best I've done is open up a new JEditorPane based on the url of the HTML files, but this is definately not good enough as the font, layout, links are all screwed and if I could fix it, it would no doubt take longer than I have.
So basically, say you have a button, how do you make it open "resources/SearchHelp.html"?

"http://www.google.com"; //
Interesting. I changed my code to this:
private void showHelp(String url)
     try
          String[] cmd = new String[5];
          cmd[0] = "cmd.exe";
          cmd[1] = "/C";
          cmd[2] = "rundll32";
          cmd[3] = "url.dll,FileProtocolHandler";
          cmd[4] = PronunciationDictionary.class.getResource(url).toString();
          Process process = Runtime.getRuntime().exec( cmd );
     catch (IOException e)
          JOptionPane.showMessageDialog(this, "Unable to load help file. Please try again.", "Help - Dictionary A'la Lewis", JOptionPane.INFORMATION_MESSAGE);
}and I printed out PronunciationDictionary.class.getResource(url).toString(); before trying it and that worked fine. I click on the buttons but nothing happens, no error which is good, but nothing else either, which is bad. I thought maybe I was just doing it wrong, so I tried replacing it with just http://www.google.com but same thing, nothing happened at all.

Similar Messages

  • I want to put several images on one sheet.  In other words, I want to open a blank document and move photos on to it.  Is this possible with Elements, and if so, how do I do it?

    I want to put several photos on one sheet.  In other words, I want to open a blank document and move several photos on to it.  Is it possible to do this?  If so, how?
    Thanks, Leslie

    lesliew13734700 wrote:
    OK, another question.  I opened a new blank file and the picture I want to move is in the Photo Bin.  That image is 2 in. X 3 in.  But, when I move it onto the blank image, which is 8X10, it fills up the entire space.  I can't figure out how to put it in the new image in the correct size relationship. 
    Open the picture file, go to Image>resize>image size. Read what the resolution is in px/in, write it down, do nothing else here at this time
    Go to File>new>blank file, Enter the dimensions , resolution the same value that you wrote down in step #1, background color to suit, ok it.
    Go back to the picture file, go to Select>all, go to Edit>copy to put it on the clipboard
    Go back to the blank file, go to Edit>paste
    Get the move tool out of the toolbox, position the picture, and resize with the corner handles of the bounding box, if necessary..
    Note: For printing, the rule of thumb is that the resolution be in the 240-300px/in range, although I have had good results below this value. For web work, 72 px/in is ok.

  • I want to open all pdf documents in full screen initially.

    I want to open all pdf documents in full screen initially.

    With Adobe Acrobat (not Adobe Reader) you can set the initial view of PDF documents.

  • When I open a HTML document in Safari all the images change to a ?  How do i stop this and get the images back?

    When I open a HTML document in Safari rather then getting an image, I get a ? in a box.  Why is this and how can I change it to get the images back?

    monkeyde,
    You are getting entagled in the two confusing meanings of the term pixels, namely as a unit identical to points and equalling 1/72 inch, and the basic component of raster images (and effects).
    You can read on in this very recent thread:
    Is there a way to get Illustrator to know how many pixels are in an inch?

  • Opening help html documents from 10g form

    We are converting our 6i forms to 10g. I am trying to open my help html documents from the 10g forms. We have modified the httpd.conf file setting the DocumentRoot "/oracle/apps/aces/help". This is the path where my html documents reside. From the 10g forms I am using web.show_document to open the html documents. I am getting a Page not Found error. Is there somewhere else the help path needs to be set?
    Thanks!!
    Shellie Bricker

    The way i know is, putting some AliasMatch in the conf-file of Apache like
    AliasMatch ^/help/(..*) "C:\help/$1"And then use WEB.SHOW_DOCUMENT with this virtual path
    WEB.SHOW_DOCUMENT('//help/helpfile.html', '_blank');

  • Safari opens an HTML document on startup

    To recover from a hard disc problem and minor crashes I created a clone (with SuperDuper) erased and reinstalled. Everything seems OK except for the minor issue that Safari launches on startup and opens an HTML document. Currently it is (file:///usr/X11R6/lib/X11/doc/html/XtCancelSelectionRequest.3.html) -previously it was a Spanish language file from the Pages application and it changed when I removed the language file. Safari is not set as a startup item in Accounts/Login. This happened on my cloned drive which I then copied back to my main drive. I have cleared Safari histories, caches removed plist and repaired permissions without success
    Any ideas?

    Safari's default open page is set in Safari preferences. Open Safari preferences, click on the General icon in the toolbar. You will see the fields for setting the default page.
    To stop Safari launching on startup verify that it isn't or some other item is included in the Login Items of Accounts preferences. Then also check /Library/StartupItems/ folder to see if a startup item is there that may be launching Safari.

  • Cant't open a PDF document from a web browser

    When I am trying to open a PDF documents from a web browser a message pop out:
    Windows is checking for a solution to the problem
    And then :
    Internet explorer has stopped working.
    A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available
    close program
    Can somebody help me with this .. I have Windows 7 and Adobe Reader V9 ..
    Thank you

    Dude...use Foxit Reader instead of Adobe Reader All problems solved

  • I was using open office spreadsheet today and inadvertantly clicked on a menu item that caused the Apple toolbar to disappear when I am in open office.  How do I get it back at the top of my screen?  I am currently using OS 10 Lion.

    I was using open office spreadsheet today and inadvertantly clicked on a menu item that caused the Apple toolbar to disappear when I am in open office.  How do I get it back at the top of my screen?  I am currently using OS 10 Lion.

    Click on the Menu bar  and go to View .  Or, hover over where the Menu bar shiuld be and click on it when it appears.  Try quitting and relaunching Finder.

  • How to get Safari to open an HTML document created in AIR on iOS

    We have an iOS app that creates a 3-page HTML document on the user's device and then prints it. We were using Darkredz ANE to do this, but the ANE is broken in iOS 8 and the Darkredz website is abandoned.
    As a workaround, we want to use Safari to launch the HTML document, then print from Safari. But Safari won't open a local document that belongs to another app, probably because of the security sandbox. We don't have a network connection, so we can't save the file remotely. Is there a way to get Safari to open a local document?
    If not, does anyone know of a FileManager app that can open files that are located in the "documents" folder of other apps on the device? I've tried several of them, but so far, they only load files from iCloud, Box, etc.
    Thanks for any tips.

    Sorry I didnt think about it needing to print as 3 separate pages at specific points. If you can't get the HTML printing to work then you could keep could this thought in mind. If the height of the, I presume, HTMLLoader object is the right value, you can draw the white-space of the page into the BitmapData and then it might still print at the right location. If it doesn't work immediately and you felt like putting in a little more effort, you might be able to tweak the height of the HTMLLoader objects so that each one represents a single page. Granted this approach would likely only work for one paper size format, such as 8.5x11. Sorry I don't have any easier ideas that work with what you already have done so far

  • When I want to open a PDF document The box that pops up asking if I want to open or save does not come up and it always saves. I need this changed.

    When the window opens to ask if I want to save or not comes up it does so for WORD documents just fine, however, for PDF documents it never asks (it used to). Now it just automatically saves them without asking. I need this changed. I went into applications and changed the setting to always ask but it still is just saving, them no window pops up asking what I want firefox to do with the file like it does with a WORD document. IF I cannot get this resolved I will not be able to continue using firefox. I teach and I have students submitting articles etc in pdf format, I cannot constantly save all pdf files. I just want to open them, review them and then move on. There must be a way to change this so that the window asking what I want firfox to do with the pdf files opens.
    thank you,
    kkwright

    Deleted it, restarted it. tried it again. no change. repeated the whole cycle. no change. thinking about uninstalling and reinstalling, but that won't reallyk change the settings.

  • Opening a html document in order to load a certain website (and login), results in opening the startpage(s) from FireFrox.

    we use a html document to automatically login out application. but when this document opens FireFox always opens the startpage. When FireFox is already running the html document works as intended.
    no problems with IE.

    Unfortunately, Java standard API can't handle PDF file as a distinct document.
    However, you could use a physical URLConnection to get any file content as
    a simple byte mass.

  • Open local html document in flash

    I've been using the getURL command to open documents on a
    remote server. I need to be able to open a local document on a
    local intranet. Is the a command to open a local html file on a
    local or networked drive?

    Yes, you can open an HTML file in an in-app browser by adding the HTML file to the HTMLResources.zip. Create a button with a Go To URL action that looks something like this:
    HTMLResources/HTML_Local/index.html
    Make sure that you create your HTMLResources.zip file properly and upload it to the folder. You can test this in the Adobe Content Viewer on either the iPad or the Desktop as long as you preview the folio (not the article or layout).
    Basically, you use the same technique to link to the HTML file that you use to link to PDF files. For details, see the DPS Tips app > Advanced Overlays > Linking to PDF Files.

  • I want to open a html file in word and save it as docx programmatically using activex

    can i open a .html file in microsoft word and save it as a .docx file programmatically ?

    What does your question have to do with instrument control? Does it have anything to do with any NI software?

  • I want to read a HTML document from internet

    Is it i should use javax.swing.text.html.HTMLDocument?

    Is it i should use javax.swing.text.html.HTMLDocument?What do the docs for that class say? Does it have methods for reading an HTML document from the internet?

  • Open XML file with user default browser and not the default editor.

    Hi,
    I'm writing a java program that appends numerous XML files together. The result is a NEW well formed XML document. Since i have an XSLT that performs several UI modifications on this xml file, the file extension must remain '.xml'. I need to open this xml file with the users default web browser. The problem is that:
    Runtime.getRuntime().exec(cmd);
    ....opens the xml file with the users default program for opening xml files which in my case is Oxygen. I want to force java to open this xml file with the users default web browser and nothing else.
    I guess i need the Windows command to perform the 'open with' feature but i have no idea what that command is or how to find it.
    Any ideas?
    Thanks,
    Varun Singh
    Edited by: Jagara00 on Jul 2, 2009 3:49 PM

    sabre150 wrote:
    Jagara00 wrote:
    Your right, but my question relates to the java issue and not the XSLT aspect of the problem. I am looking for a java solution for reasons i will no go into here. You have lost me.Me too.
    People do not often ask questions (or make challenges or observations) idly for the sake of 'theory'. It is most useful to explain to the best of your ability.
    As to
    "Since the Desktop class was only released with SE 6 I am forced to find another alternative. "
    There is an 'alternative'. You can import it into a 1.5 project. It was available as a free standing API before 1.6 - through JDIC. See [https://jdic.dev.java.net/documentation/Examples.html|https://jdic.dev.java.net/documentation/Examples.html] for more info.
    Edit 1:
    To a later reply
    "Do u .."
    ..want to spell incorrectly when you get frustrated?
    "..do not wish to.."
    ..get any help? That is the way you are heading.
    Edited by: AndrewThompson64 on Jul 3, 2009 9:27 AM

Maybe you are looking for