XMFORMLAYOUT is a freeware Java layout manager that arranges an applet's display components (e.g. buttons, choice menus, lists, text areas, text fields, etc.) according to constraints. It was inspired by Motif's XmForm widget, and has similar functionality (except that it works with Java not Motif).

A WORKiNG familiarity with the XmForm widget is helpful if you wish to understand the this layout manager (or read the tutorial). It's main benefit is that it gracefully resizes and repositions display components when the containing window is sized differently.

THE THREE examples below illustrate how XmFormLayout will size and position display components differently as the applet's window size is varied. In these examples, there are four display components:

  • Tweedle (text area, top left)
  • Dee (text area, top right)
  • Humpty (button, bottom left)
  • Dumpty (button, bottom right)

THE CONSTRAiNTS (see TestXFL.java) are:

	String constraints[] = {
		"Humpty.bottom=form.bottom-23",
		"Humpty.left=form.left+21",
		"Humpty.right=Tweedle.right",
		"Tweedle.left=Humpty.left",
		"Tweedle.top=form.top+24",
		"Tweedle.bottom=Humpty.top-10",
		"Dumpty.bottom=Humpty.bottom",
		"Dumpty.left=Humpty.right+30",
		"Dumpty.right=form.right-22",
		"Dumpty.top=Humpty.top",
		"Dee.bottom=Tweedle.bottom",
		"Dee.top=Tweedle.top",
		"Dee.left=Dumpty.left",
		"Dee.right=Dumpty.right",
	};

Example 1: Applet Window's Width is 500 Height is 300

Example 2: Applet Window's Width is 450 Height is 275

Example 3: Applet Window's Width is 400 Height is 250

THE SOURCE files are below (click here to download them):

ADDiTiONAL information about layout managers may be found in Layout Manager Launch, a web page entirely devoted to "legendary links level-headed lessons and lively lunacy about layout managers."