//****************************************************************************** // AddEm.java: Applet // //****************************************************************************** import java.applet.*; import java.awt.*; //============================================================================= // Main Class for applet AddEm // //============================================================================= public class AddEm extends Applet { private int m_BitWidth = 8; // dimention used to compute following private Dimension m_MySize = new Dimension(0,0); // size of each square private int m_SqSize = 0 ; // border around each square private int m_SqBord = 0 ; // width of square plus border private int m_SqOfft = 0 ; // offset for first bit position private int m_SqOff0 = 0 ; // numbers to add private boolean m_In1[] ; private boolean m_In2[] ; // the carries private boolean m_Carry[] ; // the result private boolean m_Sum[] ; private final String PARAM_BitWidth = "BitWidth"; // AddEm Class Constructor //-------------------------------------------------------------------- public AddEm() { } // APPLET INFO SUPPORT: // The getAppletInfo() method returns a string describing the applet's // author, copyright date, or miscellaneous information. public String getAppletInfo() { return "Name: AddEm\r\n" + "Author: Dean Brock\r\n" + "Created with Microsoft Visual J++ Version 1.0"; } public String[][] getParameterInfo() { String[][] info = { { PARAM_BitWidth, "int", "Width of the adder" }, }; return info; } public void init() { String param; int i; // BitWidth: Width of the adder param = getParameter(PARAM_BitWidth); if (param != null) m_BitWidth = Integer.parseInt(param); m_In1 = new boolean [m_BitWidth] ; m_In2 = new boolean [m_BitWidth] ; m_Sum = new boolean [m_BitWidth] ; m_Carry = new boolean [m_BitWidth+1] ; // I bet there's a better way to do this for (i=0; i