Open web pages from an applet

I'm developing an applet that has to open some web pages.
The only way I know is to use the method showDocument that
needs and URL. So, how to pass parameters to the web page?
I don't want to put them in the URL: everyone can see
"secret data"!
Help me, please.

Take a look at this example that uses a JEditor pane to hold the HTML page.
//Create a new JEditor Pane
jep = new JEditorPane( );
//Ensure the pane is not editable
jep.setEditable(false);  
//Use this to get local HTML file
URL fileURL = this.getClass().getResource("Manual/Manual.htm");
//add the html page to the JEditorPane
jep.setPage(fileURL);Ok the core line of code here is this.
URL fileURL = this.getClass().getResource("Manual/Manual.htm");The standard method for accessing a html file via a URL is thus. As you can see its very similar.
URL fileURL = new URL("http://www.comp.glam.ac.uk/pages/staff/asscott/progranimate/docs/Manual/Manual.htm");this.getClass().getResourse() will return the file location of the class you are working with.
By doing the following you can access manual.html in a folder called Manual that sits in the same file location as the class file you are using.
URL fileURL = this.getClass().getResource("Manual/Manual.htm");I hope this helps.
Andrew.

Similar Messages

  • How to open web pages from japplet??

    Hi
    Does anybody know how to open web pages from java japplet??
    Any help is apreciated!
    zick

    the getAppletContext() method of the Applet class will get you an AppletContext, with which you can call the ShowDocument(URL url) or ShowDocument(URL url, String target) method...
    check it out at http://java.sun.com/j2se/1.4/docs/api/java/applet/AppletContext.html
    have a good one :)
    Jay

  • TS3276 i am unable to open web pages from email links on my ipad

    I am unable to open web pages from email links on my ipad

    A few more details might help, if nobody else recognizes this.   
    What happens when you try to open the links?
    Can you post an example of a link that doesn't work?
    Is there any particular source for the mail with the (bad) links, or is mail from all sources failing?
    If you happen to know it, what's the format of the mail message?  (Maybe the message is an image?)
    Do the embedded links work as expected from an OS X system running Mail.app, or some system and some other other mail client?
    To view the link in iOS: if you press on and hold your finger on an embedded link in most contexts, iOS will show a pop-up with the link contents, and will offer to copy it.  You can use that to acquire and post the link.  If pressing and holding on the link doesn't offer the pop-up, the format of the link itself may not be valid, or it might not really be a link.

  • Open web page from applet

    Hi guys,
    I am new to Java applet and I need your help. I want to open a web page (or a servlet) with known URL from an applet when I press a button. I know how to set up HttpURLConnection for the applet. But I don't how to open this web page. Could you please help me? What method I should use?
    Many thanks in advance.
    jh

    getAppletContext().showDocument(URL url)
    You should search the forum and then post over here. Also go through the api.

  • Restoring open web pages from previous hard drive back up

    I've had to replace a hard drive on a Mac computer running OSX. I had a large number of web pages open in Firefox on the previous drive, which I backed up completely before the new one was put in. I would like to restore these pages (similarly to the "restore previous session" function) perhaps using the Profile data from the application backed up on the previous drive.
    Is there a data file or files that I can simply copy and paste over from the Firefox application contents on the previous hard drive which will allow me to to restore the session I had up before the hard drive was replaced when I start Firefox on the new computer? A solution to this would be much appreciated.

    The ''sessionstore.js'' file in your profile folder stores your open tabs.
    * [[Profiles - Where Firefox stores your bookmarks, passwords and other user data|What information is stored in my profile?]]

  • Won't open homepage on open, won't open web pages from the menu 'open new window', Can't open menu button

    Ok, since update to version 31.0, I have been having some problems.
    I have tried doing everything stated in the support page about resetting, reinstalling, safe mode, restarting pc etc.
    First problem, when I open Firefox no web page loads. It just says New Tab and a blank white page. If I press the home button I am taken to my homepage which is google.
    Second problem, when I right click on a link and the menu pops up, if I click open in new window, a new window opens but it just says New Tab with a blank page and no URL information, just blank.
    Third problem, the Open Menu button just doesn't work at all. You can click all you like, that thing is not opening.
    I am really stuck as to what to do. I have only been using Firefox for about a month and t was good until these problems. If I can't resolve it, I will have to use another browser as it is really annoying.
    I am using Windows 8.1 by the way and have scanned my computer thouroughly for both virus's and malware.

    Hi zenithtwc, to test whether this is a settings issue, could you do a three-minute experiment?
    '''Create a new Firefox profile'''
    A new profile will have your system-installed plugins (e.g., Flash) and extensions (e.g., security suite toolbars), but no themes, other extensions, or other customizations. It also should have completely fresh settings databases and a fresh cache folder.
    Exit Firefox and start up in the Profile Manager using Start > search box (or Run):
    firefox.exe -P
    ''Don't delete anything here.'' Any time you want to switch profiles, exit Firefox and return to this dialog.
    Click the Create Profile button, assign a name like Test731, and skip the option to change the folder location. Then start Firefox in the new profile you created.
    Can it reach the internet?
    When returning to the Profile Manager, you might be tempted to use the Delete Profile button. But... it's a bit too easy to accidentally delete your "real" profile, so I recommend resisting the temptation. If you do want to clean up later, I suggest making a backup of all your profiles first in case something were to go wrong.

  • Setting of "opening web pages from last session"not works when open next time

    In Options, setting to "open windows & tab pages from last time" does not work. I have tries several time but nothing happens. have written to you earlier also , please help

    ''setting to "open windows & tab pages from last time" does not work.''
    That would be very surprising but a change was made to Firefox 4 to always have the choice of going to History ("Alt+S") and choose "Restore previous session".
    With Firefox 5 coming out in a few days (June 21-22) you might try again then, if the solution the developers built in does not work for you. Do you know about pinning tabs ('''app-tabs''') they persist across sessions as a convenience -- if I really want to keep something permanently then I would bookmark such things as a group. Because they can be closed easily.

  • Open web page from URL iview in maximized window

    Hi,
    I would like to open a web page in a <b>maximized</b> browser window, using an URL iView.
    I know how to open a window in a separate window, I just can't get it maximized.
    N.B. I do <b>NOT</b> want to open in <b>fullscreen</b> mode, i.e. I want a title bar and menus.
    Does anyone know how to do it?
    I tried to play around with the "window function" property of the iView, but no luck so far. I can't specify a fixed width and height of the target window at design time, as these values may vary at runtime.
    regards
    Lothar

    Hi Lothar,
    Yes, That will require Java Coding, Its true. Basically what the problem here is that to maximize we are trying to fetch the Screen resolution dynamically through Portal that Portal is not allowing us. Thats why I feel that we should go for Java Programing, Create a Par, Deploy it in the server and then create iView for that.
    For Creating the Abstract Portal Component for Opening a Maximized Window You should do following steps.
    1. Open Your NWDS
    2. Create a project ie Portal Application
    3. Create Portal Object ie Abstract Portal Component.
    Now here is the piece of code that may help you
              response.write("<SCRIPT language=javascript>");
              response.write("function onOpenWindow()");
              response.write("{");
              response.write("window.open('http://abc.com','windowName','width=screen.availWidth,height=screen.availHeight,resizable=yes')");
              response.write("}");
              response.write("</SCRIPT>");
              response.write("<a href = \"javascript:onOpenWindow()\">abc.com</a>");
    Paste this code in doContent...
    I think it may help you
    Thanx & Regards
    Anish

  • Opening web pages from address/url bar in new tabs

    The primary reason I use Firefox instead of Safari is that I can enter a url in the address bar and the corresponding page will open in a new, foregrounded tab. I seem not to be able to do this in Safari, and neither the Saft nor the Safari Extender plug-ins appear to address this problem.
    I know that I can press apple + T to create a new blank tab and then type in the address I want to go to. But is there anyway to have the website whose address I type into the address bar automatically appear in a new tab that is foregrounded and to the right of the tabbed window I was looking at?
    I'm perplexed that this very basic feature is so difficult to locate and use in Safari.

    You're welcome. Glad I could help.
    There are a lot of hidden tricks in OS X. It certainly is an OS of discovery. Books like Dave Pogues OS X Tiger - The Hidden Manual help us all to think out of the box when using the OS.
    I do remember something Scott Kelby said in one of his books: "the Apple (command) key unlocks many secrets".
    Please consider marking this post "solved" to the far right of my name. Helpful for others looking for a solved solution to a similar question, also helpful for me.
    Aloha from Big Island.

  • How do i prevent my open web pages from being deleted when the system is being restarted

    windows 7
    how

    Do you mean pages that are reopened in tabs via session restore?
    * http://kb.mozillazine.org/Session_Restore
    Make sure that you do not use [[Clear Recent History]] to clear the 'Browsing History' when you close Firefox.<br />
    If you use [[Clear Recent History]] to clear the 'Browsing History' when you close Firefox then restoring tabs from the last session ("Save & Quit" or "Show my windows and tabs from last time") doesn't work.

  • Opening a web page in an applet

    Some may recognize this as I have posted it before and got nowhere. So I decided to post it again to see if anybody could help me. I have made a few changes to my code, but no guarantees it's better.
    public class FinalWindow extends Applet
         private AppletContext appContext;
         public void init()
              java.net.URL url;
              appContext = this.getAppletContext();
              try
                   url = new java.net.URL("http://www.google.com");
              } catch (Exception e)
                 System.out.println("Didn't work.");
                 url = null;
            System.out.println("this");
            try
            if(url != null)
                 getAppletContext().showDocument(url, "_self");
                   //appContext.showDocument(url, "_self");
            } catch (Exception e)
                 System.out.println("Error loading page.");
         public static void main(String[] args)
              FinalWindow fw = new FinalWindow();
              fw.init();
    }I have to things that i tried to use to show the web page in the applet, but they both produce NPE saying:
    Exception in thread "main" java.lang.NullPointerException
        at java.applet.Applet.getAppletContext(Applet.java:187)
        at FinalWindow.init(FinalWindow.java:84)
        at FinalWindow.main(FinalWindow.java:107)Let me know what ya'll think.

    wythe25 wrote:
    No, I don't want the page to load in the browser window, I want it to load in the applet, as I said before.Your showDocument commands above would result in the target page replacing the page the applet is in, rather than opening the target page inside the applet.
    To load a document inside the applet, might be achieved by using a JEditorPane to contain the HTML, then simply calling JEP.setPage(URL). Two things about that though:
    1) An applet will need to be trusted in order to load documetns from foreign hosts.
    2) Google frowns upon people reading their pages into any bot or software other than a standard browser.
    I defined the main() method because that is the way I know how to do it. I'm not worried about having a main() in it right now. You should be. Combined applet/applications do make some sense during development - I do them quite often. But you need to realise that an applet launched that way will not be able to use the kind of things an embedded applet can normally expect to be able to access, such as the AppletContext. (1)
    ..I just can't figure out how to load a web page in an applet.
    Basically making a web browser out of an applet that loads the page I tell it to in the code.JEditorPane (with a HyperlinkListener), trusted applet, not Google. And in fact, though the JEP is getting better over time, it is not generally considered to be good enough to use as the basis for a 'real world (wild web)' browsing component.
    Edit 1:
    (1) Having implemented a basic AppletContext for Appleteer , I can tell you it is not trivial!
    Also, that code above was just one line short (the import for the applet package) of being an SSCCE *(<- link).* Please consider posting SSCCEs in future - you get better chance of help, faster.
    Edited by: AndrewThompson64 on Nov 13, 2009 1:42 PM

  • Can display Web pages from servlet but not applet?

    I have been able to display real-world Web pages from a simple servlet using JDeveloper 3.0, but can't figure out how to do the same from an applet. Any hints?

    My previous post had the detail...Probably a simple question from a relative novice. I'm having a problem just viewing web pages by calling them from a "list" of URLs in an applet. I built an applet with a split pane that has a JTree on one side and an "HTML viewing pane" on the other. I can click JTree nodes to display local html files, but I don't understand how to display web pages from the Internet. Do I need something like HyperlinkListener to make the jump to "hyper-world"???

  • Opening a WEB page from FORMS CS & WebForms

    Hi,
    We would like to open a Web Page from a forms running in
    client/server as well as from a form runningover the web.
    Over the web, we plan to use SHOW_DOWUMENT (Even tough it seems
    broken, on forms 6.0, the only way we have got it working was by
    using the parameter that overwrites the current page (the form),
    we cannot have it open an URL in another window)
    In C/S mode, the SHOW DOCUMENT does not work. What is the proper
    way to lauch an URL in a browser in C/S mode ?
    Is there a way to determine if we're running in CS mode or Web
    Mode ? We would like to use the same code both on the web and in
    C/S
    Example pseudo code:
    if (Running in CS Mode) then
    open the URL using C/S method
    else
    open the URL with show dowument
    fi
    Thanks
    null

    use '_blank' as parameter, not '_self'.
    Guy Dallaire (guest) wrote:
    : Hi,
    : We would like to open a Web Page from a forms running in
    : client/server as well as from a form runningover the web.
    : Over the web, we plan to use SHOW_DOWUMENT (Even tough it
    seems
    : broken, on forms 6.0, the only way we have got it working was
    by
    : using the parameter that overwrites the current page (the
    form),
    : we cannot have it open an URL in another window)
    : In C/S mode, the SHOW DOCUMENT does not work. What is the
    proper
    : way to lauch an URL in a browser in C/S mode ?
    : Is there a way to determine if we're running in CS mode or Web
    : Mode ? We would like to use the same code both on the web and
    in
    : C/S
    : Example pseudo code:
    : if (Running in CS Mode) then
    : open the URL using C/S method
    : else
    : open the URL with show dowument
    : fi
    : Thanks
    null

  • Open a web page from Oracle

    plz, i use oracle 10g but how can i open/ping a web URL from pl/sql code?

    Thank you venky but you should post the link as link and not between tags !
    [Re: Opening a web page from oracle
    SS                                                                                                                                                                                                                                                                                                                                               

  • The list of open web pages just flipped from right to left. How do I get it back on the right? Thankyou.

    The list of open web pages, which normally sits bottom right on my screen, flipped to the left. How can I move it back to the right?
    I clicked Alt + tab and saw 'Deplacer' (Reposition - I'm in France). Then the cursor became a thing like a crossroads and I clicked where I wanted to put the list of open pages but nothing happened.

    You may have placed the bookmarks icon on the Navigation Toolbar to open the bookmarks in the sidebar instead of the bookmarks menu button that opens a drop down list.<br />
    There are two icons available for opening or accessing the bookmarks that both have a star.<br />
    The icon with the drop marker opens the drop down list with the bookmarks (Bookmarks Menu button).<br />
    The other, without the star, opens the bookmarks in the sidebar, just like the Ctrl+B shortcut or View > Sidebar > Bookmarks
    See:
    *https://support.mozilla.org/kb/Back+and+forward+or+other+toolbar+items+are+missing
    *http://kb.mozillazine.org/Toolbar_customization

Maybe you are looking for

  • Internet explorer freezes computers

    I have 8 iMacs that are freezing when Internet Explorer is started. All are running 9.2.2. and All started this problem arund the same time. The computers are in a school and are in different rooms. 3 are eMacs. All have differing ammounts of Ram bui

  • O.S 4.6!

    Has anyone tried 4.6 on the pearl 8130 for verizon wireless?

  • Select * from tbl where product like ('abc','def','rgh');

    Hi Guys, My requirement is I need to filter by providing date value with some of the porduct details and prod_id may differ with product like prod_id product date 01 abc 01/2012 02 abc 02/2012 03 def 03/2012 How can we put multiple text conditions us

  • Scaling object by %

    I have pairs of objects of different sizes that have to be scaled in proportion to each other and, as one can't move the rules in Pages 5 [cf PageMaker] this has to be done visually for one and then to the same % for the other. Even if both objects a

  • Retrieve node name from XML

    Hi, I have an XML file that I loaded into Flex converting it into an arrayCollection. If I want to retrieve the node name rather then the node content, how do i do? For istance: <root> <node1>content1</node1> <node2>content2</content2> </root> What I