Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

auto-resizing applets?

Thread view: 
yawnmoth - 23 Aug 2006 05:01 GMT
Say I have the following applet:

import java.applet.*;
import java.awt.*;

public class Test extends Applet
{
  public void start()
  {
     try
     {
        add(new Label(getParameter("echo")));
     }
     catch (Exception e)
     {
        e.printStackTrace();
     }
  }
}

Here's how I'm including it:

<applet width="500" height="500" code="Test.class">
 <param name="echo" value="hello, world!" />
</applet>

The only problem with this method is that the width and height are
fixed.  Is there a way for the width and height to be exactly as big as
they need to be to display the echo parameter, whatever it may be?

Also, would it be possible to change the font of the Label?  Or maybe
make it so that you can highlight the Label's text just as you can
normal html?
Oliver Wong - 28 Aug 2006 19:30 GMT
> Say I have the following applet:
>
[quoted text clipped - 25 lines]
> fixed.  Is there a way for the width and height to be exactly as big as
> they need to be to display the echo parameter, whatever it may be?

   No easy way, AFAIK. You could try JavaScript on the HTML side.

> Also, would it be possible to change the font of the Label?

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#setFont(java.awt.Font)

>  Or maybe
> make it so that you can highlight the Label's text just as you can
> normal html?

http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#setFocusable(boolean)

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.