SourceForge.net Logo

Button 1

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 the title
    cts.attachToComponent(TOP, ELASTIC, 5, title, BOTTOM);

    // Make sure button is to the right of the longest label in column_1
    // Component[] column_1 = {label_1, label_2, label_3}; //deprecated
    // cts.attachToComponents(LEFT, FIXED, 3, column_1, RIGHT); //deprecated
    cts.attachToBox(LEFT, FIXED, 3, "column_1", RIGHT);

    // Align bottom with label bottom
    cts.attachToComponent(BOTTOM, FIXED, 0, label_1, BOTTOM);

    // Make sure label leaves a minimum of 120 pixels for the text area
    cts.attachToBorder(RIGHT, ELASTIC, 120);

    // Set button width
    cts.setPreferredWidth(80);

    panel.add(button_1, cts);