stanford.karel.VPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javakarel Show documentation
Show all versions of javakarel Show documentation
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);
}
}