Cancel Button

Click on any component (labels, buttons, text area) to see its layout code. A complete source code overview is available as well.

    // Make sure button is below title
    cts.attachToComponent(TOP, ELASTIC, 5, title, BOTTOM);

    // Center between one third and two thirds of the panel's width
    cts.attachToRelativePosition(LEFT, ELASTIC, 3, 33);
    cts.attachToRelativePosition(RIGHT, ELASTIC, 3, 67);

    // Attach to panel bottom
    cts.attachToBorder(BOTTOM, FIXED, 5);

    // Set button width

    panel.add(button_cancel, cts);