All Downloads are FREE. Search and download functionalities are using the official Maven repository.

stanford.karel.HPanel Maven / Gradle / Ivy

Go to download

This the original Stanford Karel for Java, packaged for Maven. ACM Library is included. See also https://cs.stanford.edu/people/eroberts/karel-the-robot-learns-java.pdf

The newest version!
/*
 * File: HPanel.java
 * -----------------
 * This file implements a CSPanel subclass that is useful for
 * creating a horizontal assembly of components.  The details
 * of its operation are described in the HVLayout manager,
 * which is common to both HPanels and VPanels.
 */

package stanford.karel;

import java.awt.*;

class HPanel extends Panel {
    public HPanel() {
        setLayout(new HVLayout(HVLayout.HORIZONTAL));
    }

    public Component add(String constraint) {
        return add(constraint, null);
    }

    public Component add(Component comp) {
        return add("", comp);
    }

    public Component add(String constraint, Component comp) {
        if (comp == null) comp = new EmptyCanvas();
        return super.add(constraint, comp);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy