Shap drawn in applet couldn't see in Browser

shap drawn in applet couldn't see in Browser but could see in applet-viewer
why it happen?
here is the code :
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.awt.geom.*;
* GeneralPath shape rendered .
public class ShowTest
    extends JApplet {
  ArrayList groupList, lineList;
  MapCanvas canvas;
  public void init() {
    Container cp = getContentPane();
    BorderLayout bord = new BorderLayout();
    cp.setLayout(bord);
    cp.add(canvas = new MapCanvas(this), "Center");
    JPanel commandPanel = new JPanel();
    JButton connectServlet = new JButton("connect-Servlet");
    commandPanel.add(connectServlet);
    cp.add(commandPanel, "North");
    File file = new File("c:\\Landlock.txt");
    groupList = new ArrayList();
    double p[] = new double[2];
    StringTokenizer st;
    try {
      int count;
      String s;
      FileInputStream fin = new FileInputStream(file);
      InputStreamReader isr = new InputStreamReader(fin);
      BufferedReader br = new BufferedReader(isr);
      for (; (s = br.readLine()) != null; ) {
        lineList = new ArrayList();
        st = new StringTokenizer(s);
        count = Integer.parseInt(st.nextToken());
        //System.out.println(count);
        for (int i = 0; i < count; i++) {
          s = br.readLine();
          st = new StringTokenizer(s);
          for (int j = 0; j <= st.countTokens() && st.hasMoreTokens(); j++) {
            p[j] = Double.parseDouble(st.nextToken());
          lineList.add(new Point2D.Double(p[0], p[1]));
        groupList.add(lineList);
    catch (Exception e) {
      e.printStackTrace();
class MapCanvas
    extends Canvas {
  ShowTest applet;
  //change condition
  int m_nXLeft, m_nYTop;
  int m_nXRight, m_nYBottom;
  //change condition
  double m_nLXLeft = 0, m_nLYTop = 90;
  double m_nLXRight = 360, m_nLYBottom = -90;
  public MapCanvas(ShowTest app) {
    applet = app;
    setBackground(Color.yellow);
  BufferedImage img;
  public void update(Graphics g) {
    paint(g);
  public void paint(Graphics g) {
    m_nXLeft = getLocation().x;
    m_nYTop = getLocation().y;
    m_nXRight = m_nXLeft + getSize().width;
    m_nYBottom = m_nYTop + getSize().height;
    System.out.println("m_nXLeft " + m_nXLeft);
    System.out.println("m_nYTop " + m_nYTop);
    System.out.println("m_nXRight " + m_nXRight);
    System.out.println("m_nYBottom " + m_nYBottom);
    Graphics2D g2;
    int width = getSize().width;
    int height = getSize().height;
    img = (BufferedImage) createImage(width, height);
    g2 = img.createGraphics();
    g2.clearRect(0, 0, width, height);
    ArrayList lineList, group = applet.groupList;
    Point2D.Double pPoint;
    Point lpFirst = new Point(), lpSecond = new Point();
    GeneralPath p = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
    p.moveTo(33, 18.0f);
    p.lineTo(46.0f, 90.0f);
    p.lineTo(55.0f, 12.0f);
    p.lineTo(200.0f, 100.0f);
    p.lineTo(300.0f, 200.0f);
    p.closePath();
    g2.draw(p);
    g2.drawRect(101, 101, 100, 100);
    int size = group.size();
    GeneralPath coastPath;
    System.out.println("group.size()" + size);
    for (int i = 0; i < 1; i++) {
      coastPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
      lineList = (ArrayList) group.get(i);
      pPoint = (Point2D.Double) lineList.get(0);
      //System.out.println("pPoint.x"+pPoint.x+"pPoint.y"+pPoint.y);
      LoToPh(pPoint, lpFirst);
      coastPath.moveTo(lpFirst.x, lpFirst.y);
      //System.out.println("lpFirst.x " + lpFirst.x + " lpFirst.y" + lpFirst.y);
      //System.out.println("lineList.size() " + lineList.size() );
      for (int j = 0; j < lineList.size(); j++) {
        pPoint = (Point2D.Double) lineList.get(j);
        LoToPh(pPoint, lpSecond);
    coastPath.lineTo(lpSecond.x, lpSecond.y);
        System.out.println("lpSecond.x " + lpSecond.x + " lpSecond.y" + lpSecond.y);
      if (lpFirst.x == lpSecond.x && lpFirst.y == lpSecond.y) {
        coastPath.closePath();
      g2.draw(coastPath);
      g2.dispose();
    g.drawImage(img, 0, 0, null);
  public void LoToPh(Point2D.Double pp, Point lp) {
    //make some change
    double latitude = pp.x;
    int temp = (int) ( ( (latitude - m_nLXLeft) * (m_nXRight - m_nXLeft)) /
                      (m_nLXRight - m_nLXLeft));
    lp.x = temp + m_nXLeft;
    //System.out.println("lp.x"+lp.x);
    //make some change
    double longtitude = pp.y;
    temp = (int) ( ( (m_nLYTop - longtitude) * (m_nYBottom - m_nYTop)) /
                  (m_nLYTop - m_nLYBottom));
    lp.y = temp + m_nYTop;
}

Your IDE has an applet viewer that uses a JRE not available to the browser. If you're using MSIE, there's a built-in java 1.1 (yeah, one point one) runtime. You've just opened a real can of worms. See the article Launching Applets for an introduction.
http://www.MartinRinehart.com

Similar Messages

  • Purchased IOS Developer program but couldn't see any developer options after login using my apple id

    On 15/06/14,I’ve purchased IOS Developer program by paying 99$,on 17/06/14 i got email from Apple reg Invoice No.But when i check the Order Status,it says “No Orders placed”.And AlsoI tried to login using my applied,but i couldn’t see the developer options.
    I would request you all to let me know what happend to my order Status?

    We are users like you. We have nothing to do with your enrollment. You need to go to the Online Store to formally purchase and pay for the membership.

  • I couldn´t see imported videos with Adobe Premiere pro

    Hello:
    My name is Oren. I´m from Spain, and this is my problem.
    One month ago I bought a Toshiba Satellite 850-31M. It has an x64 processor, 16 GB of RAM and I have 2 hard drives, the c: an SSD of 500 GB and other of 1 Tb hardisk, configured as D:. It has a GeForce GT 630M graphics card with 2 GB of RAM. W8 operating system.
    I wanted to try the Adobe Premiere Pro CS6 and I downloaded the trial version. No problem, until I tried to import a video in the source window. Appears a small window that says "importing" and give to play in the source window and start .Audio be heard, but not the image. I've tried different video formats and always the same. The same video are seamlessly Quick Time and other video viewers ..... I do not know what to do, I think I've tried everything, even restart the computer to its factory settings and install Adobe Premiere vacuum and the problem remains. I tested with a trial of Premiere CS5.5 and got it. You hear the audio but no video . Insert the video in the timeline and recognizes it as such, even the first frame, but said, is not seeing in the "source", nor in the preview, only the audio.
    What could it be? Am I you could lend a hand I'm desperate?
    thank you very much

    Hello:
    I have the vídeos in a hard-disk. I'd tried in different video formats and
    always the same. I hear the audio but I couldn't see the video image.
    El jueves, 25 de abril de 2013, Jim Simon escribió:
       Re: I couldn´t see imported videos with Adobe Premiere pro  created by Jim
    Simon <http://forums.adobe.com/people/JSS1138> in Premiere Pro - View
    the full discussion <http://forums.adobe.com/message/5265806#5265806

  • Couldn't see portal content

    hi all:
      I couldn't see Portal Content under the link of Content administration --> portal content
    even with the role of pcd:portal_content/administrator/content_admin/content_admin_role, I
    should have seen some content like  content from sap and so on ,
    can you please tell me what should I configure?
    thank you very much .

    Hi Jingying
    You need to assing content_admin_role to content admin role.
    System Administration >> Permission >> Portal Content >> Content Provided By SAP >> Admin Content >> Content Administrators >> Content Admin >> Right Click on Content Admin Role >> Open Permission >> search and assign content_admin_role role and provides access if you are only assin content admin role to the user.
    Otherwise you can assign super administration role to the user.
    Hope it helps
    Regards
    Arun

  • Lync Web App no sound and couldn't see shared desktop

    Hi,
    Today I tried to join a scheduled meeting which I've done may times before without any problem.
    I was let into the meeting but had no sound and couldn't see the shared presentation. I could see other participants and see typed messages. There was a button in the middle of the screen 'Participate in the sharing session by clicking Rejoin'
    Clicking the button did nothing.
    The options button was telling me I had no Audio device. I did and it works correctly.
    I'm using Win 7 and IE 11 but I also tried on Firefox and had the same issue.
    I noted that despite using the Lync App many times, when I joined the meeting the App was either missing or wanted to update and I let this happen.
    Any ideas what may be the issue here?

    Hi There,
    Thanks a lot for reporting this issue. And I am sorry that you are hitting this issue while attending Lync meetings. Following details will help us diagnose it further -
    1) Do you have Lync 2010 or Lync 2013 client installed on the machine?
    2) Do you get this issue again and again when you join the meeting or it was one-off?
    3) When you killed "Lync Web App" from task manager, was audio flowing through even after that? Were you still attending the meeting from the browser?
    4) How much time did you wait when UI was showing "Loading" until you killed the Lync Web App from task manager?
    Thanks.
    ManuMSFT
    manums

  • I still couldn't see my photos streaming in my pc

    I followed everything, turned the icloud in my iphone and even installed the icloud control panel but still couldn't see anything streaming. I even went to this one and I only saw the mail, documents, my contacts and find my iphone thingy. I went to the picure folders in my pc and saw a folder for photostream but it's empty! I even backed up my phone and it's contents and yes the photostream is on..,, but still I couldn't access my photostream  in my PC help please. Thanks!

    1. First thing to try is a reboot of your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.
    2. Reboot your computer and start iTunes. Make sure iTunes is the latest version. Use the Check for Update menu choice. If an update is available download and install it. Then start iTunes and connect your iPad.
    Hope this helps.

  • Couldn't see workbook

    Hi, Friends,
    We export an application schme from one server to another, we also export/import eul . The workbook owner have the same privileges like in old system. But now, the user couldn't see his workbook. He can see schema owner user's workbook.
    Any help? Thanks in advance!

    Hi,
    Did you select the "Always take ownership of imported workbooks" when you imported the EUL? This is the default, but you need to select "Only take ownership if original owner cannot be found".
    Rod West

  • Couldn't see the WSRP implementation style option

    I have configured the WSRP and it is running in my Portal->System Components. I want to register the new provider but I couldn't see the WSRP option in implementation style. I found in one thread that I need to install wsrp-preview. Please suggest whether this is the correct procedure or not.
    Thanks

    I have the same problem. The behavior of the Register Provider function is seriously different from the documentation, section 6.4.2.4 of http://download.oracle.com/docs/cd/B14099_19/portal.1014/b14135/pdg_java_intro.htm#CHDGAFAB
    I am trying the wrsp-samples.http://download.oracle.com/docs/cd/B14099_19/portal.1014/b14135/pdg_java_intro.htm#BHCCCFIDear deployment documented in http://download.oracle.com/docs/cd/B14099_19/portal.1014/b14135/pdg_java_intro.htm#BHCCCFID
    but it talks about providing a WSDL URL (see figure 6-29). The Register Provider function in the Administration tab of the Portal Builder talks about a URL ("Specify the URL for the Web provider and configure its communication settings"). Nothing about WSRP.
    Please help - I've folled the documentation religiously. Thanks.

  • TS1292 I couldn't see any code, because of hard scratch

    When I get the iTunes card, I scratched too hard maybe, then I couldn't see code any more.
    I've just purchased the card.  I couldn't use it.
    Would you please find me how I can find out the code of the card?
    Thank you.

    Welcome to the Apple Community.
    iTunes Card and Gift Certificate FAQ 

  • Applet can not run in browser, but it wroks in appetviewer. Why?

    I wrote a very simple applet, and it works well when I use appletviewer. But when I use browser to open the html file which contains the applet, it always gives no class found error. My browsers are IE5.0 and Netscape4.77. Hwo can I make the applet run in browser?
    Quick response is greatly appreciated.

    see you have to put the proper code base in your html file.check if your browser is java enabled or not.Java plugin comes with IE 5 and it automatically get installed if you won't disagree with that.Check in optin menu of ur browser that java is enabled or not.
    Applet works fine with all browser.
    2nd thing when you r running applet through appletviewer,it runs as an application from your local JVM while running through browser means you are running applet through browser 's JVM.

  • Applet JNLP not accessible in browser ?

    Hello,
    I am new to java and to programiing in general. Thanks in advance for your help. I can't get an Applet to work in any browser (Google, Mozilla, IE) while it works fine in appletviewer. Why?
    The Source:
    import java.awt.*;
    public class Hwa extends java.applet.Applet {
    public void init (){
         add(new Label("Hello World"));
    compiled in Hwa.class, then in a Hwa.jar file,
    The JNLP file:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
    <information>
    <title>Hw Applet</title>
    <vendor>CCN</vendor>
    </information>
    <resources>
    <j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se" />
    <jar href="http://www.ccca.eu/Hwa.jar" />
    </resources>
    </jnlp>
    The HwaAPJNLP.html file:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html dir="ltr" lang="fr"><head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    <title>CCCAEU</title>
    <meta content="" name="author">
    <style type="text/css"></style>
    <link rel="stylesheet" href="CCCAEU.css" type="text/css">
    </head><body>
    <applet code="Hwa.class" ref_jnlp="Hwa.jnlp" height="50" width="150"></applet>
    </body></html>
    All files are copied on the http://ccca.eu/. of the server
    Executing appletviewer HwaAPJNLP.html (local copy of the html file) works just fine BUT launching http://www.ccca.eu/HwaAPJNLP.html returns a blank rectangle with the JAVA console message "Detected from bootclasspath: C:\\PROGRA~1\\Java\\jre7\\lib\\deploy.jar" and "Incompatible magic value 1008812135 in class file Hwa". WHY ?
    FYI, the ".htaccess" file on my WebServer is
    AddType x-mapp-php5 .php
    AddType application/x-java-jnlp-file JNLP
    Thanks in advance for your support.

    Thank you Baftos. It works but I still do not understand the logic. Before, my Hwa.class was only accessible through my Hwa.jar file on http://www.ccca.eu/Hwa.jar, itself defined as the reference if the jnlp file, see above. My understanding of the jnlp logic is that the html page will load the Hwa.class from the Hwa.jar file. Is that correct ? Thanks to your post, I copied the Hwa.class directly under http://www.ccca.eu/Hwa.class and yes, when accessed through the browser, I can download it. Even better, my previous html page above - unchanged - now WORKS. Thanks for letting me know where I think wrong.

  • Applet not running in local browser

    I can run any applet from web.
    I can run any applet in appletviewer.
    But I can not run applets in browser from local html file.
    I can not run even the demos that came with de SDK 1.4.1_01.
    Can anyone give me some hint?
    Maybe is very obvious but I ca not see it.
    Thank you very much.
    Valeriu Sprintu

    the hello.java file is:
    import java.applet.Applet;
    import java.awt.Graphics;
    public class hello extends Applet {
    StringBuffer buffer;
         public void init() {
         public void start() {
         public void stop() {
         public void destroy() {
         public void paint(Graphics g) {
              //Draw a Rectangle around the applet's display area.
              g.drawRect(0, 0, size().width - 1, size().height - 1);
              //Draw the current string inside the rectangle.
              g.drawString("Hello", 5, 15);
    The hello.html file is:
    <html>
    <body>
    Applet should be there
    <br>
    <applet code="hello.class" width=200 height=200>
    No applet
    </applet>
    </body>
    </html>
    hello.html and hello.class are of course in the same folder.
    If I modify the .html file acording to OBJECT tag specifications for Java Plug-In the same applet runs OK in the browser (IE5.0 ).
    I forgot to tell that I have installed the last version of SDK j2sdk1.4.1_01
    <html>
    <body>
    Applet should be there
    <br>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 200 HEIGHT = 200 >
    <PARAM NAME = CODE VALUE = "hello.class" >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
    No applet
    </OBJECT>
    </body>
    </html>
    I think there is a problem with the JVM from Microsoft
    Thank you,
    Best regards,
    ValeriuS

  • Applet does not run in Browser

    Iam using Windows XP and IE 6.0. Applets do not run in my browser. Hovering the cursor where the applet should be in the browser, I get a Class not found message. Setting the CLASSPATH variable did not help. Any suggestions?

    You might find an answer in this new page
    [url http://java.sun.com/j2se/1.4.2/docs/guide/deployment/deployment-guide/upgrade-guide/index.html]Java Upgrade Guide: Migrating From the Microsoft JVM to the Sun JRE

  • Why can't I see my browsing history?

    I want to see my browsing history but all of them got deleted. I tried to fix it in the options menu, but nothing changed.

    * Make sure that you do not use [[Clear Recent History]] to clear the Browsing History.
    * Make sure that the History is set to at least 1 day: Tools > Options > Privacy > History: "Remember visited pages for at least"
    * Make sure that you do not start Firefox in Private Browsing mode (Tools > Stop Private Browsing is grayed, see [[Private Browsing]])
    * To see History and Cookie settings in Tools > Options > Privacy, choose the setting "Firefox will: Use custom settings for history"
    You can look at these prefs on the about:config page.
    *http://kb.mozillazine.org/browser.history_expire_days (180) (also affects saved form data)
    *http://kb.mozillazine.org/browser.history_expire_days_min (90)
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    * Shockwave Flash 10.1 r53
    *Java Plug-in 1.6.0_07 for Netscape Navigator (DLL Helper)
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    Update the [[Java]] plugin to the latest version.
    *http://java.sun.com/javase/downloads/index.jsp (Java Platform: Download JRE)

  • Same applets running on 2 different browser independent of  each other

    Hi all,
    I am calling the same applet two times in a browser. So i declared all the variables to be shared by the 2 applets as "private static".
    Now i want the applets in 1 browser to be independent of the applets in another browser when multiple browsers are invoked.(remember that each browser has 2 applets each).
    In other words,same applets invoked in MULTIPLE BROWSERS should be independent of each other. How to go about doing that?
    Is it possible to somehow invoke separate jvms for 2 separate browsers on the same machine when clicked on the same link twice?
    Thanks in advance.

    Hi all,
    I am calling the same applet two times in a browser.
    . So i declared all the variables to be shared by the
    2 applets as "private static".
    Now i want the applets in 1 browser to be
    be independent of the applets in another browser when
    multiple browsers are invoked.(remember that each
    browser has 2 applets each).
    In other words,same applets
    r words,same applets invoked in MULTIPLE BROWSERS
    should be independent of each other. How to go about
    doing that?
    Is it possible to somehow invoke separate jvms for 2
    separate browsers on the same machine when clicked on
    the same link twice?To start a new JVM try System.exec("java someclass");
    Thanks in advance.(T)

Maybe you are looking for

  • IPOD CLASSIC PROBLEMS

    hi i have a problem with my ipod classic, it does not play songs at all instead it skips to the next and then next and so on... though i can still click on and search the ipod for the songs. also when i connect it to itunes a box comes up saying that

  • Word document is changing place on desktop after save

    Hi! I have more word documents ( .doc ) on my desktop. If i open it, and do some changes, and after saving and closing it, the file changes place on the desktop. If my file was placed on the the right side at the desktop, after editing it, it will be

  • J2Me game programming plz help

    Helo everyone, I am working in j2me game programming plz if any one know how make image as small as possible in our game program.? I am using *.png format of image which is working well in game but my game size is very big so plz help me to get out o

  • Quiz Question not to be marked???

    Hello.. I have created an elearning module with a few question slides... a couple of true/flash.   So we are not worried about recording the results... just that they finished.  So i do i tell it not to record the answers for the quizzes??? Rich

  • SOLARIS for INTEL: Have future?

    I could find few products without roadmaps for Solaris/Intel. Without apps, I need to change the platform. Who can know more about this situation? Regards Cheet CTICTI