Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /htdocs/applets/label.ht [000000] .. [110918] Maximize Restore

  Switch to side-by-side view

--- a
+++ b/htdocs/applets/label.ht
@@ -0,0 +1,31 @@
+Title: Label Example
+
+<h3>Using Labels</h3>
+
+<p>This example shows how to use Labels from Jython.
+<p>
+<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>
+</applet>
+
+<p>The complete source code for this example is included below.
+
+<blockquote><pre><hr>
+from java import applet
+from java.awt import Label, GridLayout
+
+class LabelDemo(applet.Applet):
+    def init(self):
+        self.setLayout(GridLayout(0,1))
+        self.add(Label('Left'))
+        self.add(Label('Center', Label.CENTER))
+        self.add(Label('Right', Label.RIGHT))
+<hr></pre></blockquote>
+
+
+Three labels are created with different alignments.  The first has 
+the default left alignment and the other two are centered and right 
+aligned.
+
+<p>