private void toolStripMenuItem1_Click(object sender, EventArgs e) { NewClass nc = new NewClass(tabControl2.SelectedTab.Name); nc.ShowDialog(); if (nc.Successful) { ClassInfo ci = new ClassInfo(); ci.FileName = nc.Contents + ".java"; ci.ClassName = nc.Contents; ci.Access = "public"; ci.Type = "class"; if (nc.HasConstructor) { Method m = new Method(); m.Name = ci.ClassName; m.Access = "public"; ci.AddMethod(m); } if (nc.HasMain) { Method m = new Method(); m.Name = "main"; m.Access = "public"; m.Attributes = new String[1] { "static" }; m.ReturnType = "void"; Variable v = new Variable(); v.Name = "args"; v.Type = "String[]"; //edit dimension here v.Method = m.Name; m.AddParameter(v); ci.AddMethod(m); } InsertTemplate(ci); } }
private void toolStripMenuItem2_Click(object sender, EventArgs e) { ClassInfo ci = new ClassInfo(); ci.FileName = "HelloWorldExample.java"; ci.ClassName = "HelloWorldExample"; ci.Access = "public"; ci.Type = "class"; Method m = new Method(); m.Name = "main"; m.Access = "public"; m.Attributes = new String[1] { "static" }; m.ReturnType = "void"; Variable v = new Variable(); v.Name = "args"; v.Type = "String[]";//edit dimension here m.AddParameter(v); m.Code = "System.out.println(\"Hello World!\");"; ci.AddMethod(m); InsertTemplate(ci); }
public static void InitializeContents() { instance = new ArrayList(); local = new ArrayList(); classes = new ArrayList(); ci = new ClassInfo(); m = new Method(); ci.ClassName = "Object"; m.Name = "toString"; m.Access = "public"; m.Attributes = null; m.ReturnType = "String"; m.Parameters = new ArrayList(); ci.AddMethod(m); classes.Add(ci); ci = new ClassInfo(); ci.ClassName = "Character"; m = new Method(); m.Name = "isUpperCase"; m.Access = "public"; m.Attributes = new String[1]{"static"}; m.ReturnType = "boolean"; m.Parameters = new ArrayList(); v = new Variable(); v.Name = "ch"; v.Type = "char"; m.Parameters.Add(v); ci.AddMethod(m); m = new Method(); m.Name = "isDigit"; m.Access = "public"; m.Attributes = new String[1]{"static"}; m.ReturnType = "boolean"; m.Parameters = new ArrayList(); v = new Variable(); v.Name = "ch"; v.Type = "char"; m.Parameters.Add(v); ci.AddMethod(m); classes.Add(ci); }