Пример #1
0
        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);
        }
Пример #2
0
        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);
            }
        }