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

stanford.karel.VPanel 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: VPanel.java
 * -----------------
 * This file implements a Panel subclass that is useful for
 * creating a vertical 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 VPanel extends Panel {
    public VPanel() {
        setLayout(new HVLayout(HVLayout.VERTICAL));
    }

    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