Image applet

Hello!
I'm a student and my teacher, for a DSP course, asked us to write an applet to do morphological manipulation on images. I'm a totally newbie of Java but to gain a good mark I'm going to learn it :-)
So my first problem is to create an applet with two images (the original and the modified one) and some controls to change filter parameters. Original images (b/w or grayscale) should be selected by the user on his harddisk and maybe he could save the modified image (and filter parameters...).
My first goal is to create an applet which opens and show images of different sizes. These are the steps I did:
- Open NetBeans IDE 3.6
- Project Manager - New project (called "morph")
- File - New - Local directory
- File - New - Java GUI Forms - AWT Forms - Applet form with "morphapplet" name
Now I've a form editor like Delphi (the IDE I know best)...
After playing with the form properties (background color...) and changing the layout to absolute layout I added some objects (an "Hello World!" label and a button)
- Build - Compile
- Build - Execute
The applet shows... wow! :-)
Now in the applet folder I see an HTML page... wow I can run the applet... double click and the applet in my new FireFox 1.0 doesn't show... a red cross...
On java console I can read:
java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout
     at morphapplet.initComponents(morphapplet.java:27)
     at morphapplet.init(morphapplet.java:15)
     at sun.applet.AppletPanel.run(Unknown Source)
     at java.lang.Thread.run(Unknown Source)
java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout
     at morphapplet.initComponents(morphapplet.java:27)
     at morphapplet.init(morphapplet.java:15)
     at sun.applet.AppletPanel.run(Unknown Source)
     at java.lang.Thread.run(Unknown Source)
Where am I wrong?
Second question: where can I find "image" objects? In Delphi (for sure here it's different! note that I'm a newbie... :-)) I've an image object I can add to a form... in java how can I manage images?
Thanks!

I have posted a solution to this issue at:
http://teaching-2.cs.uml.edu/~heines/91.461/91.461-2004-05f/461-lecs/lecture29.jsp
Jesse
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jesse M. Heines, Ed.D.
Associate Professor
Dept. of Computer Science
University of Massachusetts Lowell
One University Avenue
Lowell, MA 01854-2881
E-Mail: mailto:[email protected]
Web: http://www.cs.uml.edu/~heines

Similar Messages

  • Cached Image Applet problem

    I've created a SSCE below but I can't seem to find the information I need to
    format the code correctly, and I've already wasted a half hour trying to find the link to the info.
    I found some mentions of links to the info, but when I followed them they were no longer there.
    I would think the FAQ would have something about this but it doesn't appear to....
    Can someone please point me to how to get the code formatted correctly?
    This problem is only with Java 1.6, it works fine with 1.4, 1.5
    In any case my problem is with cached images. It would appear that no matter what I do, I can not
    get ImageIO.read() to give me an updated image. I use the same file name and change the file in the
    use of my GUI.
    To use this code you will have to have an image called gdata.jpg in your "codebase" directory. What
    I do is bring up the applet, then change the image file in my "codebase" directory and then click on the button.
    You'll see commented code in the actionPerformed which loads a image called gdata1.jpg, if this code is there, the new image
    is displayed. The ImageIO.setUseCache(false) appears to do nothing but maybe I'm using it incorrectly.
    Help please....
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    import javax.swing.JApplet.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.io.Serializable;
    import javax.swing.border.*;
    public class testApplet extends JApplet implements SwingConstants,
    ActionListener
    JPanel testPanel = new JPanel();
    JButton but = new JButton("test");
    URL codeBase,graphURL;
    Image gImage = null;
    Icon iconImage=null;
    // init -- Applet Init
    public void init()
    Container contentpane = getContentPane();
    //Get Server IP information.
    codeBase = getCodeBase();
    try {
    graphURL = new URL(codeBase+"gdata.jpg");
    } catch(MalformedURLException e) { }
    try {
    ImageIO.setUseCache(false);
    gImage = ImageIO.read(graphURL);
    catch(IOException exc) { }
    iconImage = new ImageIcon(gImage);
    but.setIcon(iconImage);
    testPanel.add(but);
    but.addActionListener(this);
    contentpane.add(testPanel);
    // actionPerformed
    public void actionPerformed(ActionEvent e)
    if ( e.getSource() == but ) {
    //If you uncomment out the 3 lines below, changing the name of the image,
    // then it works, otherwise I always get the same image.
    // try {
    // graphURL = new URL(codeBase+"gdata1.jpg");
    // } catch(MalformedURLException ex) { }
    try {
    ImageIO.setUseCache(false);
    gImage = ImageIO.read(graphURL);
    catch(IOException exc) { }
    iconImage = new ImageIcon(gImage);
    but.setIcon(iconImage);
    but.revalidate();
    testPanel.revalidate();
    testPanel.repaint();
    return;
    Edited by: chippr on Sep 13, 2007 10:32 AM

    chippr wrote:
    That's odd. It looks like I'm using the same version jre plugin under windows...jre-6u2-windows-i586-p.exe.
    Which gives me java 1.6_02
    So you changed the image and then hit the button and it worked?Yep.
    >
    hmmmmm, I wonder what the difference is....I'm using firefox under windows, accessing a linux box
    running apache....Same here, except I used appletviewer to test the code on the local machine. Let me upload it to my Linux box (running Apache) and I'll let you know what happens.

  • Applets and memory not being released by Java Plug-in

    Hi.
    I am experiencing a strange memory-management behavior of the Java Plug-in with Java Applets. The Java Plug-in seems not to release memory allocated for non-static member variables of the applet-derived class upon destroy() of the applet itself.
    I have built a simple "TestMemory" applet, which allocates a 55-megabytes byte array upon init(). The byte array is a non-static member of the applet-derived class. With the standard Java Plug In configuration (64 MB of max JVM heap space), this applet executes correctly the first time, but it throws an OutOfMemoryException when pressing the "Reload / Refresh" browser button or if pressing the "Back" and then the "Forward" browser buttons. In my opionion, this is not an expected behavior. When the applet is destroyed, the non-static byte array member should be automatically invalidated and recollected. Isn't it?
    Here is the complete applet code:
    // ===================================================
    import java.awt.*;
    import javax.swing.*;
    public class TestMemory extends JApplet
      private JLabel label = null;
      private byte[] testArray = null;
      // Construct the applet
      public TestMemory()
      // Initialize the applet
      public void init()
        try
          // Initialize the applet's GUI
          guiInit();
          // Instantiate a 55 MB array
          // WARNING: with the standard Java Plug-in configuration (i.e., 64 MB of
          // max JVM heap space) the following line of code runs fine the FIRST time the
          // applet is executed. Then, if I press the "Back" button on the web browser,
          // then press "Forward", an OutOfMemoryException is thrown. The same result
          // is obtained by pressing the "Reload / Refresh" browser button.
          // NOTE: the OutOfMemoryException is not thrown if I add "testArray = null;"
          // to the destroy() applet method.
          testArray = new byte[55 * 1024 * 1024];
          // Do something on the array...
          for (int i = 0; i < testArray.length; i++)
            testArray[i] = 1;
          System.out.println("Test Array Initialized!");
        catch (Exception e)
          e.printStackTrace();
      // Component initialization
      private void guiInit() throws Exception
        setSize(new Dimension(400, 300));
        getContentPane().setLayout(new BorderLayout());
        label = new JLabel("Test Memory Applet");
        getContentPane().add(label, BorderLayout.CENTER);
      // Start the applet
      public void start()
        // Do nothing
      // Stop the applet
      public void stop()
        // Do nothing
      // Destroy the applet
      public void destroy()
        // If the line below is uncommented, the OutOfMemoryException is NOT thrown
        // testArray = null;
      //Get Applet information
      public String getAppletInfo()
        return "Test Memory Applet";
    // ===================================================Everything works fine if I set the byte array to "null" upon destroy(), but does this mean that I have to manually set to null all applet's member variables upon destroy()? I believe this should not be a requirement for non-static members...
    I am able to reproduce this problem on the following PC configurations:
    * Windows XP, both JRE v1.6.0 and JRE v1.5.0_11, both with MSIE and with Firefox
    * Linux (Sun Java Desktop), JRE v1.6.0, Mozilla browser
    * Mac OS X v10.4, JRE v1.5.0_06, Safari browser
    Your comments would be really appreciated.
    Thank you in advance for your feedback.
    Regards,
    Marco.

    Hi Marco,
    my guess as to why JPI would keep references around, if it does keep them, is that it propably is an implementation side effect. A lot of things are cached in the name of performance and it is easy to leave things laying around in your cache. Maybe the page with the associated images/applets is kept in the browser cache untill the browser needs some memory and if the browser memory manager is not co-operating with the JPI/JVM memory manager the browser is not out of memory, thus not releasing its caches but the JVM may be out of memory. Thus the browser indirectly keeps the reference that it realy does not need. This reference could be inderect through some 'applet context' or what ever the browser uses to interact with JPI, don't realy know any of these details, just imaging what must/could be going on there. Browser are amazingly complicated beast.
    This behaviour that you are observing, weather the origin is something like I speculated or not, is not nice but I would not expect it to be fixed even if you filed a bug report. I guess we are left with relleasing all significatn memory structures in destroy. A simple way to code this is not to store anything in the member fields of the applet but in a separate class; then one has to do is to null that one reference from the applet to that class in the destroy method and everything will be relased when necessary. This way it is not easy to forget to release things.
    Hey, here is a simple, imaginary, way in which the browser could cause this problem:
    The browser, of course needs a reference to the applet, call it m_Applet here. Presume the following helper function:
    Applet instantiateAndInit(Class appletClass) {
    Applet applet=appletClass.newInstance();
    applet.init();
    return applet;
    When the browser sees the applet tag it instantiates and inits the new applet as follows:
    m_Applet=instantiateAndInit(appletClass);
    As you can readily see, the second time the instantiation occurs, the m_Applet holds the reference to the old applet until after the new instance is created and initlized. This would not cause a memory leak but would require that twice the memory needed by the applet would be required to prevent OutOfMemory.I guess it is not fair to call this sort of thing a bug but it is questionable design.In real life this is propably not this blatant, but could happen You could try, if you like, by allocating less than 32 Megs in your init. If you then do not run out of memory it is an indication that there are at most two instances of your applet around and thus it could well be someting like I've speculated here.
    br Kusti

  • IIS, Javascript, Signed Applet and ASP Blank Page Problem

    Hi,
    I'm having a problem using a Signed Applet in a site that runs in a IIS (Windows Server 2003).
    My aspx web page uses the applet to read my smart card and get information from it.
    This applet uses an auxiliar dll (stored in a second Signed Jar file) in order to read the information from my smart card.
    The way the solution is design:
    1) Aspx page is asked from server
    2) Internet Explorer recieve the page and asks the server for it content (images, applet, javascripts, etc)
    3) After this the JVM runs (console opens)
    4) After the Aspx page render fully a javascript register onload fires and call an applet method
    5) Applet receive the call and run the logic of the method:
         - reads the smart card;
         - calls Javascript function in order to fill aspx fields with information from smart card
         - calls Javascript function the simulates a click in a botton of aspx page (in order to call server side part sending data readed from smart card to server)
    5) The server makes some logic with the information receive and responds to client registering in aspx page a call to another Javascrit function
    6) The client received the asnwer from server and runs the Javascript function registered on step 5)
         This Javascript calls another method from applet and runs the following logic:
         - reads more information from smart card;
         - call javascript function in order to fill more fields of aspx page with the information readed
         - calls Javascript function the simulates a click in a botton of aspx page (in order to call server side part sending data readed from smart card to server)
    7) The server makes some logic and call another pages with no Applets
    8) Client asks for a second page with the same applet and we start with another logic express on steps 1);2);3),4);5) and then 7).
    This is all ok, until sometimes the server stop responding correcly for requests regarding this two pages with the Applet.
    When this happens the server just responds with a blank page.
         - with fiddler I can seer the request for the aspx page (that uses the applet)
         - but server responds with a blank html page
    The JVM doesn't fire.
    The IIS log don't show errors.
    The eventviewer doesn't show errors.
    The problem is solved with an IIS reset or a Application Pool reset.
    After a while the problem returns.
    This problem occours for other user in another machine, the server just stops responding correcly to request regarding pages with applets, the other pages still continue to work.
    If we disable Java Control Panel->Advanced->Java Plug-in->Enable the next-generation Java Plug-in the problem seend to stop, but we can't force all clients to disable this option right?
    Or there is a way to force the Applet to run with this option disabled?
    As anyone experience similar problem?
    Regards,
    OF

    This is all ok, until sometimes the server stop responding correcly for requests regarding this two pages with the Applet.
    When this happens the server just responds with a blank page.
    - with fiddler I can seer the request for the aspx page (that uses the applet)
    - but server responds with a blank html pageWell, if http requests look identical in case of success and failure (pay attention to cookies, etc) then it has to be something on the server side.
    It could be that server gets into this wrong state because of previous requests made by applet but it is hard to tell.
    I am not clear how old/new plugin can make a difference unless your applets run in the legacy mode (i.e. you are actually trying to reuse SAME instance of the applet when
    it is loaded next time).
    I'd start with
    1) carefully comparing good/bad sessions
    2) checking whether server will serve correct response to another client when it serves "bad" page for current client
    3) add debug statements to aspx - it is scripted page, may be some condition is not met and then it returns blank?
    4) record all http requests in one session until you get to "error" state and then use any http server testing tool to "replay" this set of requests.
    You should be able to get server into the same state without use of applet. Then you can try to tweak set of requests to see what makes a difference.

  • Portal activity report(image problem).

    Hi All,
    I have a problem in Portal Activity report of Number of users who logged on.
    In "Number of users who logged on" report, there is one java image(applet).It is not rendering. It is giving the error :
    Java Plug-in 1.6.0_01
    Using JRE version 1.6.0_01 Java HotSpot(TM) Client VM
    User home directory = C:\Documents and Settings\km39649
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    p:   reload proxy configuration
    q:   hide console
    r:   reload policy configuration
    s:   dump system and deployment properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    Piglet Version 1.1.35 - 07.12.01
    java.lang.NullPointerException
         at com.sap.miniapps.graphics.CategoryChart.setChartType(CategoryChart.java:898)
         at com.sap.miniapps.graphics.Piglet.init(Piglet.java:268)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception in thread "Thread-7" java.lang.NullPointerException
         at sun.plugin.util.AnimationPanel.createTranslucentImage(Unknown Source)
         at sun.plugin.util.AnimationPanel.createGradientShapeImage(Unknown Source)
         at sun.plugin.util.AnimationPanel.initBackground(Unknown Source)
         at sun.plugin.util.AnimationPanel.preloadResources(Unknown Source)
         at sun.plugin.util.AnimationPanel.doPaint(Unknown Source)
         at sun.plugin.util.AnimationPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Can any one please help me why it is coming?
    Thanks in Advance,
    Kavitha

    I am using ORACLE.
    Actually the iview is the standard par iview, so i have created it from the "iview from Par" and that too in my test server seperately. I have created a new folder and under it i have created this new iview from Par. I have taken the com.sap.km.activityreport.frontend. and under this the activity report component.
    I have also restarted the Data collection service. Other than these I did not do any other configurations. Any thing else is required?
    Thanks in advance,
    kavitha

  • How to avoid applet getting focus ?

    When i put an applet on a html page, it takes the focus when it starts up (in all browser, IT, Firefox, Safari). I want the focus to stay at other html object - How can I avoid the applet from getting focus ?

    Hi Me too facing the same problem.Looks Like onblur event is getting fired when applet is loaded which is taking the focus to the image applet .So how do we block the onblur from getting invoked.

  • Need a simple, free program to make bootable disk image.

    Folks,
    I'm looking all around for a freeware backup to create simple, bootable disk images for both Win7/64 and XP/32 builds. Nothing fancy, just as a disaster backup for the seven computers I'm zeroing out and re-loading for my math class.  My builds are straightforward single-partition, single-disk machines.
    I need to keep these machines clean and the school's network uninfected, so if I suspect an ugly virus or porn has sneeked in on a thumb drive my hope is to zero out the drive and simply re-load. I haven't yet had the pleasure of trying to re-load from a disk image.
    I've got 40 hours into this project and am ready to backup all of them. I'll probably do something rash if another glitch causes me to re-load for the nth time this week.  Freakin' 10 hours a day at it!  (Please - don't even ask about the deadline today in getting my XP Service Pack 2 machines updated before Microsoft ends support for SP2....)
    Luckily, Win 7 has a disk image applet I've used to create a disk image on an external drive and a recovery disk for these builds.  I hope this built-in feature is good enough.
    My three XP builds have no such luxury, so I'm looking for a freeware app to create bootable recovery disks on DVD. The full XP load is only about 10GB, so this is merely three DVD's.
    I've gone all 'round the net, checking out reviews.  Anybody here have a favorite?  I do see a vote for Terabyte in Harm's "Favorite Tools" thread.

    Clonezilla
    Macrium Reflect

  • GetImage() throws nullpointerException in Netscape (but not IE)

    1. Does getImage work on Netscape Navigator? When I load pictures to my applet, NN's java console doesn't say anything. After creating a new Panel that actually uses the Images, applet gives a nullPointerException because of the images. The same code works in Internet Explorer and appletviewer.
    2. What ways do I have for loading Images to my applet? Is there an optional way other than getImage?
    Thanks in advance,
    Rakhi
    Here's the code sample :
    The commented areas are the various possiblities I have tried without success.
    import java.awt.*;
    import java.net.*;
    import java.awt.image.*;
    import java.applet.*;
    public class ImageTrial extends Applet {
    Image baseImage;
    public void init() {
    baseImage = getImage(getCodeBase(),"xxx.gif");
    //baseImage = getImage(getDocumentBase(),"xxx.gif");
    /*try {
    URL u = new URL("http://localhost:8080/xxx.gif");
    baseImage = getImage(u);
    } catch (MalformedURLException m) {m.printStackTrace(); }
    /*try {
    URL u = new URL("http://127.00.00.01/xxx.gif");
    baseImage = getImage(u);
    } catch (MalformedURLException m) {m.printStackTrace(); }
    /*try {
    URL u = new URL(getDocumentBase(),"xxx.gif");
    baseImage = getImage(u);
    } catch (MalformedURLException m) {m.printStackTrace(); }
         /*MediaTracker mt = new MediaTracker(this);
    mt.addImage(baseImage,0);
    try {
    mt.waitForID(0);
    catch (InterruptedException e) { e.printStackTrace(); }
    if (baseImage == null)
    System.out.println("image is null");
    else
    System.out.println("image is not null");
    repaint();
    public void paint(Graphics g) {
    if (baseImage == null)
    g.drawString("IMAGE DISPLAY ERROR:IMAGE IS NULL",10,10);
    else
    g.drawImage(baseImage,10,10,this);
    The following is the HTML code:
    <APPLET CODEBASE="/jsdk/webpages/NeGraphical" CODE="ImageTrial.class" WIDTH = 100 , HEIGHT = 100>
    </APPLET>

    Hi !
    I've tried this code and it works on both IE and Netscape:
    import java.awt.*;
    import java.net.*;
    import java.awt.image.*;
    import java.applet.*;
    public class ImageTrial extends Applet
      Image baseImage;
      public void init()
        URL imageURL;
        Class cl = ((Applet)this).getClass();
        imageURL = cl.getResource("java.gif");
        baseImage = getImage(imageURL);
        if(baseImage == null)
          System.out.println("image is null");
        else
        System.out.println("image is not null");
        repaint();
      public void paint(Graphics g)
        if(baseImage == null)
          g.drawString("IMAGE DISPLAY ERROR: IMAGE IS NULL",10,10);
        else
          g.drawImage(baseImage,10,10,this);
    }With this html code:
    <HTML>
      <HEAD>
        <TITLE>Image Test</TITLE>
        <BODY BGCOLOR="FFF3A8" text="00686D">
        <CENTER>
        <HR WIDTH=40% ALIGN=CENTER>
        <B>Image Test</B>
        <HR WIDTH=40% ALIGN=CENTER><BR>
        <SCRIPT LANGUAGE="JavaScript">
        <!--
          var _info = navigator.userAgent;
          var _ns = false;
          var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
           //-->
        </SCRIPT>
        <SCRIPT LANGUAGE="JavaScript1.1">
        <!--
          if(!_ie)
             var _ns = (navigator.appName.indexOf("Netscape") >= 0
             && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0
             && java.lang.System.getProperty("os.version").indexOf("3.5") < 0)
             || _info.indexOf("Sun") > 0));
         //-->
        </SCRIPT>
        <SCRIPT LANGUAGE="JavaScript">
        <!--
           if(_ie == true)
             document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ' +
             'WIDTH = 400 ' +
             'HEIGHT = 200 ' +
             'align = baseline ' +
             'codebase = "/plugin/j2re1_3_0_win.exe"><NOEMBED><XMP>');
           else if(_ns == true)
             document.writeln('<EMBED ' +
             'type="application/x-java-applet;version=1.3" ' +
             'width=400 height=200 align=baseline ' +
             'code="ImageTrial.class" ' +
             'pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html" ' +
             'frame="task"><NOEMBED><XMP>');
            //-->
          </SCRIPT>
          <APPLET CODE="ImageTrial.class"
            ALIGN="baseline"
            WIDTH="400"
            HEIGHT="200">
          </XMP>
          <PARAM NAME="java_code" VALUE="ImageTrial.class">
          <PARAM NAME="java_type" VALUE="application/x-java-applet;version=1.3">
          <PARAM NAME="scriptable" VALUE="true">
          ALT = "Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
          <B>No JDK 1.3 support for APPLET!!</B>
          </APPLET></NOEMBED></EMBED>
          </OBJECT>
        </CENTER>                    
      </BODY>
    </HTML>Hope it helps...let me know...

  • IPlanet WebServer 6.0 with WebSphere Application Server 5.0

    How can I connect WebSphere Application Server with iPlanet WebServer?
    I have start the iplanet and the websphere but my images (that are in
    C:\iPlanet\Servers\<serverId>\images) are not found!
    In WebSpherer ApplicationServer I have jsp, and classes (inside web-inf). In iPlanet WebServer I have html, images,applets and styles.
    Anyone knows why images don't appear? Thanks

    Sounds messy. I wouldn't mix environments like that. You could even end up with different versions of jdk, jsp and servlet specs.
    Just leave the jsp/servlets on websphere, use iplanet for the static pieces. Let the proxy forward the dynamic stuff to websphere. Then you can also have the ability to load balance sessions etc..

  • How can I pass the userId and pasword to proxy while opening the URLConnect

    First I was having problem on how can I send a userid and password for proxy authentication while trying to connect to a servlet from a applet, finally I figured out that I need to add Authenticator as
    Authenticator.setDefault(new MyAuthenticator());
    and everything started working fine but only from a java application not from a applet. In applet when I try to add a Authenticator I get exception that cannot add defualt Authenticator. Please someone help how can I add Authenticator in a applet? I dont think for adding a defualt autheticator I need to get my applet signed. Please comment.
    Thanks,
    Mandeep

    Can u tell me please how can I add
    java.net.NetPermission on the target setDefaultAuthenticator.
    And by the way for sending the password I tried the following code which doesn't use Authenticator and it worked. U can use it what Iam doin is iam using my own base64encoder instead of jdk's which was giving problems to me. U can try with jdk base64encoder and if u get any problems let me know I'll send u my version of the encoder.
    If u r using any images in ur applet and getting the images by using getImage() method then probably while getting the image applet is prompting for user and password.
    URLConnection con = url.openConnection();
    String authString = "userid:passsword";
    String auth = "Basic " + new sun.misc.BASE64Encoder().encode(authString.getBytes());
    //String auth = "Basic " + new MyBase64Converter().encode(authString.getBytes());
    con.setRequestProperty("Proxy-Authorization", auth);

  • How to avoid BDCDATA getting cleared

    I am updating TCODE - OH11
    The SAP Standard memory is clearing the values which i am trying to update using BDCDATA.
    How to avoid this happening

    Hi Me too facing the same problem.Looks Like onblur event is getting fired when applet is loaded which is taking the focus to the image applet .So how do we block the onblur from getting invoked.

  • Maybe Constructors plz help Part 2

    class BitmapSprite extends Sprite {
    protected int locx;
    protected int locy;
    // image dimensions
    protected int width,height;
    Image image;
    Applet applet;
    public BitmapSprite(int x,int y,Image i,Applet a) {
    locx = x;
    locy = y;
    image = i;
    applet = a;
    if (image != null) {
         width = image.getWidth(a); // get size of background
         height = image.getHeight(a);
    restore();
    class BitmapLoop extends BitmapSprite implements Moveable{
    protected Image images[]; // sequence of bitmaps
    protected int currentImage; // the current bitmap
    protected boolean foreground; // are there foreground images?
    // constructor. Assumes that background image is already
    // loaded. (use MediaTracker)
    public BitmapLoop(int x,int y,Image b,Image f[],Applet a) {
    super(x,y,b,a);
    if (b != null) {
    width = image.getWidth(a); // get size of background //error trace****
    height = image.getHeight(a);
    images = f;
    currentImage = 0;
    if (images.length == 0) {
    foreground = false; // nothing in images[]
    else {
    foreground = true;
    public class UFO extends BitmapLoop implements Intersect {
    byte state;
    int max_x, max_y; // max coords of this UFO
    static Intersect target; // refers to the gun
    static int gun_y; // the y-coord of gun
    public UFO(Image ufoImages[],int max_x,int max_y, Applet a) {
         super(0,0,null,ufoImages,a); //error trace*******
         System.out.println("UFO CREATION22");
    this.max_x = max_x;
    this.max_y = max_y;
    currentImage = getRand(5); // start at random image
    startStandby();
    public class UFOManager {
    static int width, height; // applet dimensions
    private UFO ufo[];
    static final int NUM_UFOS = 7;
    public UFOManager(int width,int height,
    Image ufoImages[],Applet a) {
    this.width = width;
    this.height = height;
    ufo = new UFO[NUM_UFOS];
    for (int i=0; i<ufo.length; i++) {
              System.out.println("UFO CREATION");
    ufo[i] = new UFO(ufoImages,width,height,a); //error trace
    System.out.println("UFO CREATION2");
    initializePosition(ufo);
    class GameMmanager extends Applet{
         init()
    um = new UFOManager(width,height,ufoImages,this);
    Still getting null pointer exception this is a fuller example of the code thanx for any help

    You have not closed off the constructor function in class UFO. You need to add a '}' to close off the constructor.

  • Image Processing using applet

    hi,
    I am doing my project in java.My project is " Online Image Processing ".
    I did some processing like gray Scale, Invert , Contrast and rotate 90 degree.
    can any one help me for
    1. I vant to rotate Image to 1 degree...
    2. How to get Blure and Sharpen image?
    3. Can i append frames inside applet?
    plz Help me ..

    I did not read the content of the links (To lazy) just found them for you.
    You say that the examples use frames:
    this should not be a problem as the required code is the same.
    Tip:
    How whould you display a image in a frame?
    How whould you display a image in a applet?
    Concentrate on the above 2 and simply change the code accordingly.
    This should be easy also try asking google.

  • Image processing with applets

    Hi
    I need to create a website with several image processing applets on it. however although the applets work locally they will not load at all through a server (i'm a student) my supervisor tells me i cant use an applet to display an image stored on a server. but as applets specifically have getImage methods which must be able to get images from the server i think he is wrong but do not know how to do it.
    Any advice will result in some really great Karma directed your way.
    thanks

    here's the code I use, make special note of the getDocumentBase(), as this request will be a URL based request, rather than a file read
    try {
    img = getImage(getDocumentBase(), "logo.gif");
    }catch(Throwable t) {
    System.out.println("Unable to load logo image",t);
    t.printStackTrace();
    hope this helps

  • Problem with Image I/O and applet

    I am having trouble using Image I/O to load a PNG image in an applet. I am just using a very basic applet that simply loads the image from a URL and that's it, and the exception I get is -
    java.lang.SecurityException: Unable to create temporary file
    at java.io.File.checkAndCreate(File.java:1294)
    at java.io.File.createTempFile(File.java:1385)
    The simple applet is as follows -
    import java.awt.image.*;
    import java.net.*;
    import java.io.*;
    import javax.swing.*;
    import javax.imageio.ImageIO;
    public class CheckImageApplet extends JApplet
    public BufferedImage bi = null;
    public void init()
    URL url = null;
    BufferedImage bi = null;
    try
    url = new URL( "http://localhost/CheckImageSystem/checkimages/backGS.png" );
    catch ( MalformedURLException mfue )
    try
    bi = ImageIO.read( url );
    catch ( IOException ioe )
    Any thoughts on this exception would be appreciated

    It seems the line
    bi = ImageIO.read( url );
    fails. Can't see anything else. Perhaps this method needs to create a temp image for some reason, and tries to do this at the local harddrive (not allowed). Use getImage(URL, String); instead. ImageIO isn't intended for applets, I think, so you should use the applet methods.
    Nille

Maybe you are looking for