Opening HTML file using a Jbutton

can anybody tell me how can I open an HTML file using a Jbutton.
I have a help button on my menu of my GUI. I wanna open a html document using the help (jbutton)
thank you

call this class in your button action
import javax.swing.JInternalFrame;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.*;
import javax.swing.text.*;
import javax.swing.JOptionPane;
import javax.swing.BorderFactory;
import javax.swing.border.*;
import javax.swing.JDesktopPane;
public class Taa extends JFrame implements HyperlinkListener{
     public JEditorPane hh;
     public JScrollPane ss;
*Taa default constructor
*@param Nothing
*@return Nothing
*@thorws nothing
*@see descon
public Taa(){
//set top left image in the gui
setIconImage(Toolkit.getDefaultToolkit().getImage("buttons/help.jpg"));
try{
     File f=new File("Here you can put your html"such as"Help.htm");
     String s = f.getAbsolutePath();
     s = "file:"+s;
     URL url = new URL(s);
hh=new JEditorPane(s);
hh.setEditable(false);
hh.addHyperlinkListener(this);
catch (MalformedURLException e) {
     System.out.println("Malformed URL: " + e);
catch (IOException e) {
     System.out.println("IOException: " + e);
     ss=new JScrollPane(hh);
     getContentPane().add(ss);
     setBounds(232,0,490,500);
     setResizable(false);
     show();
*Implementation of HyperlinkEvent
public void hyperlinkUpdate(HyperlinkEvent e) {
     if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
     linkActivated(e.getURL());
*this method activate link
*@param URL the URL
*@return Nothing
protected void linkActivated(URL u) {
     Cursor c = hh.getCursor();
     Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
     hh.setCursor(waitCursor);
     SwingUtilities.invokeLater(new PageLoader(u, c));
*this class load help files
class PageLoader implements Runnable {
*Taa default constructor
*@param Url the url,Cursor c
*@return Nothing
*@thorws nothing
*@see descon
     PageLoader(URL u, Cursor c) {
     url = u;
     cursor = c;
public void run() {
     if (url == null) {
          // restore the original cursor
          hh.setCursor(cursor);
          Container parent = hh.getParent();
          parent.repaint();
     } else {
          Document doc = hh.getDocument();
          try {
          hh.setPage(url);
          } catch (IOException ioe) {
          hh.setDocument(doc);
          getToolkit().beep();
          } finally {
          // schedule the cursor to revert after
          // the paint has happended.
          url = null;
          SwingUtilities.invokeLater(this);
     URL url;
     Cursor cursor;

Similar Messages

  • Can not open html files using a term

    When I use the command firefox %s some.html Firefox opens but to the home page not the local html document.

    The 600D should be supported in ACR 6.4 which is currently in beta so you'll have to wait until it's released, probably within days or weeks, for native support within Elements.
    While you're waiting, you can download the beta version of the DNG Converter 6.4 from Adobe Labs and use that to convert your CR2 files to DNGs which will open in older versions of Camera RAW.
    http://labs.adobe.com/
    Follow the Camera RAW 6.4 RC link and eventually you'll get a link to download the DNG Converter 6.4 RC.
    The Camera RAW 6.4 RC installer will only run if you have Photoshop, not Elements, so you can't use that, yet, but you can use the DNG Converter.
    Because the DNG Converter and Camera RAW 6.4 are in beta status there could be differences in how the RAW photos look compared to when you get the released version of ACR 6.4 but probably not too much difference.

  • How Can i open Html file in a Browser from Jar file

    Hi
    i am having Html help files inside my Jar file ... if i use
    getclass().getRource("\lib\start.html");
    it is not opening ... so i have to ship seperate folders for html files along with jar files.... can anyone give the solution to have(open) html files inside the jar file and to open then in a default browser of any OS
    Regards
    Ganesan S

    the follwing method i have used to open html file ...
    so to access html file i am shipping resources folder with jar file ..
    private void openHtmlPages(String pageName) {
         String cmd[] = new String[2];
         String browser = null;
         File file = null;
         if(System.getProperty("os.name").indexOf("Linux")>-1) {
              file = new File("/usr/bin/mozilla");
              if(!file.exists() ) {
              }else     {
                   browser = "mozilla";
         }else {
              browser = "<path of iexplore>";
         cmd[0] = browser;
         File files = new File("");
         String metaData = "/resources/Help/Files/"+pageName+".html"; // folder inside jar file
         java.net.URL url = this.getClass().getResource(metaData);
         String fileName = url.getFile();
         fileName = fileName.replaceAll("file:/","");
         fileName = fileName.replaceAll("%2520"," ");
         fileName = fileName.replaceAll("%20"," ");
         fileName = fileName.replaceAll("jarfilename.jar!"," ").trim();
         cmd[1] = fileName;     
         try{
              Process p = Runtime.getRuntime().exec(cmd);
         }catch(java.io.IOException io){
                   //Ignore
    can anyone give me the solution..???
    Regards
    Ganesan S

  • Can't import/open HTML files in Fireworks CS4

    I'm trying to import/open HTML files into Fireworks CS4 to do some redesigning. I inherited the job of redoing my companies website and we believe the person who created our website created the site using Dreamweaver 8. Unfortunatley that person moved on to a new job across the country and we can't ask him exactly how he created our website.
    When I try to open some of the HTML files in FW I get the message: "Could not open the file....Fireworks could not find an HTML table in this file". Next I tried creating a new, very simple HTML page in Dreamweaver CS4 that contains just a few lines of text and 1graphic (we just bought the CS4 web suite). Again, I get the same error.
    Other files give me a slightly different error message when trying to open them in FW, "The HTML document contains one or more images with absolute web addresses for the source. Fireworks cannot handle these images. --click OK-- (next error message) Could not open the file. Fireworks has encountered a problem with the HTML in this table. Verify that the HTML is valid"... and then it closes and nothing loads into FW. Bummer.
    I've searched on these forums and can't find any solutions to this problem although I found a few people experiencing the same problem.
    Do I need to do something to the Dreamweaver created HTML's to get them to open in FW? Any help would be appreciated.

    Fireworks is a graphics editor that can export code; it is not an HTML/code editor.
    If you have exported HTML from Fireworks, you ought to be able to re-import that, but I would think most people who use Fireworks exported code would just modify their Fireworks document and re-export. (Fireworks' code is not robust and it is only intended for mockups and prototypes. Fireworks is not intended for developing and maintaining live Web sites; Dreamweaver is.)
    If your developer used Dreamweaver, then I really don't expect that Fireworks would be able to import that, nor any code that isn't in exactly the format that it can export. If you know your developer used Fireworks, then you need to look for .png files. Fireworks uses an enhanced version of the PNG format for its native document format.
    If you are making small adjustments to your site, then you might be better off working in Dreamweaver. If you're doing a site re-design, then Fireworks is an excellent tool for laying out your design and producing your graphics, but you will, at some point, need to move over to Dreamweaver for coding.

  • Can No Longer Open html files

    I Fireworks 8, I was able to save a web page as a complete
    document to the local drive and then open it with Fireworks to work
    with it. With CS3 all I get is a totally white canvas. I have
    checked that my preferences are all set the same, and they are. I
    use this feature all the time for a variety of functions, i.e.,
    combining slices to make one gif, etc. Am I missing something - or
    is that function no longer there?
    It shows it can open Html files, but it will not even open
    it's own exported html files. Get "internal error." The file is
    fine ( and it just created it.)

    No, it is not a bug at all. It is all about how you do this
    and understand the primary functionality of Fw itself, and how it
    do for you. If you don't fully understand how it works, then you
    have problem trying to understand how it works and what's not.
    Then, perhaps that you clearly do not understand the
    functionality of Fw CS3, and how it relates to exported HTML files
    created by Fw CS3.
    It is very common, wide misunderstanding among other,
    especially with newbies using Fw app, and they thought that if Fw
    could create HTML code. Actually, it was created by side of
    pre-scripted coding inside the app itself, and that it does the
    rest for you.
    As for working with sliced images around Fw CS3, as any
    legacy versions of Fw, the concept of sliced images is often up for
    the air and debates. Everyone have different opinion about sliced
    images, and what not and what's cool.
    I personally dislike sliced images. If having lots of sliced
    images, means slower downloading time and more codes involved.
    I get the feeling that you really not understand how Fw
    works, and how it relates to your question about HTML code in Fw.
    Please try to understand that FW itself CANNOT edit HTML. It only
    just exports html code for you. However, it is important to note,
    it is NOT perfect html code.
    It is best IF you work with pre-scripted HTML code in
    Dreamweaver, or any web authoring app to work with HTML directly.
    If you are not taking my advice, so be it. I am out of this
    discussion. End of discussion!
    And good luck!
    quote:
    Originally posted by:
    lloydtennison
    No. I mean for editing the images. The open command even
    shows html as an option to open, it just does not open the file at
    all. I just creates a new one.
    The reasons for opening an html file in Fireworks have
    nothing to do with Dreamweaver or coding, just images and image
    manipulation. If open html is an option, as it is, it should open
    the file. It used to open with all slices intact, and all html code
    behind it. Now it just opens a white page.
    It is a bug and problem since it does not do as it should.

  • Opening HTML files

    Hi there,
    I'd love someone giving me a bit of help about this...
    AFAIK, Nokia S40 phones can't open an html file stored locally (in the phone's memory or memory card), although they can if that file is accessed through an internet connection.
    So... is there a method or piece of software that I could use to open HTML files stored locally? (I've tried some Java browsers, including Opera Mini, but they all seem only fit for online browsing).
    Thanks a lot,
    Marcos

    ok so i just realized that it doesn't make sense for a program outside the jar, like IE or Firefox, to be able to access and open a file inside of the jar. I am now looking for suggestions on how to work around this problem for my program to be able to have a simple help system located inside the jar that can be loaded during runtime.
    Thanks for your suggestions.

  • Opening External Files using SWF

    Hi all,
    Is there a way to open external files using swf? I have gone
    through a number of forums and all seem to tell me to open with a
    window projector. my problem is, I need to embed the swf into a
    html to be viewed online... So I need to do it in swf format.
    Any ideas?

    When you say 'external files' I presume you mean local files
    on the users hard drive.
    If that's true:
    When you say 'open' what do you mean? It could mean to open
    and load a text file/xml file or another swf in flash or it could
    mean to launch a document in its native application e.g. .doc
    launches word etc. Flash projectors can do the first thing, but not
    the second thing. And you need to know the path of the file because
    I don't believe you can retreive it from the filereference browsing
    support. 3rd party tools are necessary to really add a lot of file
    system support to projector applications, and then you can do both
    things mentioned here, without the limitations of flash player
    security which is only slightly reduced with regular projector
    files.
    The filereference class in flash is primarily for
    upload/download support. You can't 'open' local files with it.
    There is, to my current knowledge, no way you can do that with
    flash in a html page directly.
    The only way I can think that it might be possible (untested)
    would be to have a separate local MS Office (or any other host for
    a flash activex that gives filesystem access) with some embedded
    flash in a document that (perhaps) could talk via local connection
    with your html page content and which would in turn talk to its VBA
    host to request local file system activity. I don't know if this
    would work because I've not used localconnection, but perhaps it
    might.

  • Safari 7.0.5 unable to open html file

    I used to be able to open HTML files in Safari so I can read the content but now it won't let me. Safari 7.0.5. Is there an issue with this version? I am also unable to see some content in our SalesForce app for work. Would a different version of Safari fix this?

    You may have installed "SearchMe" or some other malicious Safari extension.
    From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Remove all extensions with the word "Spigot" in the description. If in doubt, remove all extensions. Do the equivalent in the Chrome and Firefox browsers, if you use either of those.

  • Cannot open html file in Firefox. Need help

    I can open any html file in my G5 without any trouble. Now that I am setting up my new i7, while I can open the html files using Safari, the html files will not open using Firefox. I have tried "Open With....", but it will not open. My default browser presently is Firefox which is what I want for now. I was given a script that can be inserted through the terminal, but I don't know if it would work. I would rather see is anyone has had this experience and how they solved it.
    I have reinstalled Firefox with no success with the html files.
    Thanks
    Message was edited by: Herschel Hochman

    Out of curiosity, I used the latest Firefox 3.6 to open a webarchive file. The Firefox "Open File" requestor allows you to tell it to use Firefox to open the file, but it doesn't open it. Doesn't give any error. When I go through Finder, and double-click the file, it opens in Safari. When I use "Open with" in Finder itself to tell it to use Firefox, Firefox is greyed out as an application.
    Interesting. Sorry couldn't solve for you. But it may point to a shortcoming in Firefox.

  • Problem with Photoshop CS6. If I open a file using Camera RAW

    I have a new problem with Photoshop CS6.  If I open a file using Camera RAW, and process it as usual, CS6 doesn't want to save it the way it used to.  I don't know if I changed something by accident or not. 
    Here's what happens now: After opening from ACR to CS6 and completinhg all of my work, I choose "Save as..."  The save as window opens showing the file name and format.  The default format seems to be .PSD.  I use the drop down to select .jpg.  The file saves normally as a .jpg.  When I go to close the image from, I get a new prompt asking, "Save changes to Adobe Photoshop document DSC_xxxx.NEF before closing?
    I looked up at the file name in the bar above the work space and noticed that it does NOT change from "DSC_xxxx.NEF" to "DSC_xxxx.jpg" after I have saved the file as a .jpg,in my webesite  but it always used to do that.  This adds a few extra steps when closing a document and it really slows me down.
    In fact, I wouldn't swear to this, but I think it used to save to .jpg by default, without me specifying this.
    I don't see a setting in the preferences for what to use as the default file format for saving, so I don't know where to change it back.
    Any ideas?
    Thanks in advance

    You are in the wrong forum;  You actually need Photoshop forum at this link:
    <http://forums.adobe.com/community/photoshop?view=discussions>
    Hope you can repost your question at the correct link.

  • Sorry, we couldn't open your file using this feature. Visio Web Access is not available on this site.

    Recently installed Service Pack 1 in SharePoint Server 2013 Farm, post upgrade we are experiencing issue when opening visio documents:
    I am trying to open .vsdx (visio 2013) file but encounter following issue:
    Sorry, we couldn't open your file using this feature. Visio Web Access is not available on this site.
    Under Document library-->Library settings-->Advanced Settings
    Still I cant open file in browser as we always used to. Unfortunately we don't have Visio services in Farm.
    can you share your experiences regarding this issue post Sp1 SharePoint Server 2013.
    Thank You

    Hi Octopus,
    Based on the error message, it seems that the Visio Graphics Service is not started or the Enterprise feature is not enabled.
    I recommend to check the things below:
    Go to Central Administration > System Settings > Manage service on server > check if the Visio Graphics Service is started > then click Application Management > Manage service applications > check if the Visio Graphics Service application
    is created.
    Go to the root site settings page of the site where you got this error, click Site collection features to check if the SharePoint Server Enterprise Site Collection Features is enabled.
    Go to the site settings page of the site where you got this error, click Manage site feature to check if the SharePoint Server Enterprise Site Features is enabled.
    More information about the Visio Graphics Service:
    http://tutorial.programming4.us/windows_server/microsoft-sharepoint-2013---looking-at-visio-services-(part-3)---visio-graphics-service-service-application.aspx
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • How to parse a HTML file using HTML parser in J2SE?

    I want to parse an HTML file using HTML parser. Can any body help me by providing a sample code to parse the HTML file?
    Thanks nad Cheers,
    Amaresh

    What HTML parser and what does "parsing" mean to you?

  • I am trying to delete pages from a PDF file. I opened the bookmarks, selected the pages to delete and choose Edit Delete. The selected pages are not deleted. Note: I have to open the file using a passport provided by an external party.

    I am trying to delete pages from a PDF file. I opened the bookmarks in the PDF file, selected the pages to delete and choose Edit > Delete. The selected pages are not deleted. Note: I have to open the file using a passport provided by an external party.

    Resolved

  • How to display HTML files using ABAP Webdynpro?

    Hi,
    I have a html index file and a bunch of other files accessed by the index file  in a specific directory on the SAP server. I'd like to display the index file via ABAP webdynpro and allow the users to click on what they need to see. How can I achieve this using utilizing the ABAP webdynpro technology ?
    Thanks!

    Hi Thomas,
    Thanks for taking the time to answer my question.
    I have the main html file and all other files needed by the main file in one directory on the application layer of SAP. I'd like to provide the user with a link, by clicking on which they should be able to get to the main html file using the browser. This is just a standalone application.
    I can try the approach using BSPs, however, I'm new to that area. Could you point me in the right direction to get started?

  • Can I open raw files using photoshop elements

    Can I open raw files using photoshop elements

    Yes, depending on the Camera Model and version of PSE.
    All camera makers like to make slight changes to the RAW format for their new models. Adobe then take a few months to produce a camera RAW plug-in to process the new format.
    Give you PSE version and camera model and we could be more help.
    Brian

Maybe you are looking for