package com.jeromecompsci.dgui;

import javax.swing.*;
import java.awt.*;

/**
 * @author Derek Wang
 */
public abstract class Widget {
    static int PADDING = 2;
    static int DEFAULT_WIDTH = 150;
    static int DEFAULT_HEIGHT = 25;
    abstract JComponent getInternal();
    public void setSize(int width, int height) {
        Dimension d = new Dimension(width, height);
        getInternal().setSize(d);
        getInternal().setMinimumSize(d);
        getInternal().setPreferredSize(d);
    }
}

@@ -492,11 +492,813 @@
 );%0A    %7D
+%0A%0A    public void setWidth(int width) %7B%0A        Dimension s = getInternal().getSize();%0A        s.width = width;%0A        getInternal().setSize(s);%0A%0A        Dimension m = getInternal().getMinimumSize();%0A        m.width = width;%0A        getInternal().setMinimumSize(m);%0A%0A        Dimension p = getInternal().getPreferredSize();%0A        p.width = width;%0A        getInternal().setPreferredSize(p);%0A    %7D%0A%0A    public void setHeight(int height) %7B%0A        Dimension s = getInternal().getSize();%0A        s.height = height;%0A        getInternal().setSize(s);%0A%0A        Dimension m = getInternal().getMinimumSize();%0A        m.height = height;%0A        getInternal().setMinimumSize(m);%0A%0A        Dimension p = getInternal().getPreferredSize();%0A        p.height = height;%0A        getInternal().setPreferredSize(p);%0A    %7D
 %0A%7D%0A

Add methods on Widget to set width and height independently of each other.