Results 1 to 2 of 2
  1. #1
    madnaelo is offline Member
    Join Date
    Dec 2010
    Posts
    8
    Rep Power
    0

    Question Java applet size problem

    Hi,

    I have an applet like,

    public class Graph extends Applet
    {
    ......
    ......
    ......

    public void init ( )
    {
    setSize ( 800 , 600 ) ;
    ...............
    ................
    ...............
    }

    ......................
    ...................

    }

    When I include it in my html file by,
    <applet class="Graph.class" />
    only a small upper left corner of the applet shows up.

    <applet class="Graph.class" width=800 height=600 /> works fine.
    Is there any way to include it into html file without width and height parameters, so that it automatically adjusts the size..
    Why I have to mention width, height in html file even when i have set it in my applet by setSize funtion.?

    Please help me
    Last edited by madnaelo; 12-05-2010 at 12:32 PM.

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    i'm pretty sure the applet when it is placed into a HTML page is a bit like an image, which might have its own default size, but that to have it display properly it needs to have the size parameters in the HTML tag. It is possible the applet is not showing up properly without these HTML things because of the rest of the HTML on your page, ? Does it still do that when you just have only the <applet> tag ?

Similar Threads

  1. Changing default Applet Viewer Size?
    By dsym@comcast.net in forum Java Applets
    Replies: 6
    Last Post: 08-27-2010, 07:42 PM
  2. Applet JTextField Size Problem
    By a13w in forum New To Java
    Replies: 4
    Last Post: 09-19-2009, 08:52 AM
  3. Replies: 4
    Last Post: 02-22-2009, 07:31 AM
  4. [SOLVED] JAVA heap size problem
    By sreedevi in forum New To Java
    Replies: 3
    Last Post: 02-11-2009, 08:05 AM
  5. Problem with run Java Applet
    By Albert in forum Java Applets
    Replies: 1
    Last Post: 07-13-2007, 04:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •