[110918]: htdocs / applets / label.ht Maximize Restore History

Download this file

label.ht    31 lines (23 with data), 849 Bytes

Title: Label Example

<h3>Using Labels</h3>

<p>This example shows how to use Labels from Jython.
<applet code="LabelDemo" archive="appletdemo.jar" width = 150 height = 100
        alt="This browser doesn't support JDK 1.1 applets.">
<h3>Something has gone wrong loading this applet.</h3>

<p>The complete source code for this example is included below.

from java import applet
from java.awt import Label, GridLayout

class LabelDemo(applet.Applet):
    def init(self):
        self.add(Label('Center', Label.CENTER))
        self.add(Label('Right', Label.RIGHT))

Three labels are created with different alignments.  The first has 
the default left alignment and the other two are centered and right