Using Labels
This example shows how to use Labels from Jython.
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.setLayout(GridLayout(0,1))
self.add(Label('Left'))
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
aligned.
|