Hello,since there are many applications on to become a utopian moderations i thought that would be great to show how to create a Utopian moderation application applet.We start with defining two of our libraries for this program.
Java.applet.Applet is basically used to create a applet and java.awt is to create and import all the graphics that used on java program.
import java.applet.Applet;
import java.awt.*;
Now i define my class and using "extends" Applet because this method is used for below of the code that i am going to tell you about.In java applets you use "Init" method,this method reads all the tags,functions etc. you defined above.
public class NewApplet extends Applet
In this step i created new labels,first defined my title then asked users utopian id and with using "TextField" method you can create a text field for user then adding maximum character limit at the end of the method for example i made my limit 30 characters; (TextField(30).
Then i added "Apply" button and i used checkboxgroup to make user choose only one option that i wanted on my applet.I used checkboxgroup for two of the options that you are going to see below,first to make user choose how long they have been contributing on utopian,second to make user choose which supervisor they would like to nominate if they become moderator.
If we want to make user choose all our options we can use "checkbox",but if we want user to choose only one of the options that we want we use checkboxgroup and add true/false at the end of the line.You can see the examples below.
Label title = new Label("Utopian Moderator Application");
Label name = new Label("Your Utopian Id: @");
TextField nm = new TextField(30);
Label Phone_number = new Label("Your Registered Phone Number :");
TextField pn = new TextField(30);
Button Apply = new Button("Apply");
CheckboxGroup cbduration=new CheckboxGroup();
Label apply2 = new Label("How Long You Have Been Contributing For Utopian.io");
Label best = new Label("Choose Your Best Categories You Would Like To Moderate");
Checkbox cbsu=new Checkbox("Suggestion");
Checkbox cbde=new Checkbox("Development");
Checkbox cbbh=new Checkbox("Bug Hunting");
Checkbox cbts=new Checkbox("Translation");
Checkbox cbgh=new Checkbox("Graphics");
Checkbox cban=new Checkbox("Analysis");
Checkbox cbvi=new Checkbox("Visibillity");
Checkbox cbdc=new Checkbox("Documentation");
Checkbox cbtt=new Checkbox("Tutorials");
Checkbox cbvt=new Checkbox("Video Tutorials");
Checkbox cbcw=new Checkbox("Copywriting");
Checkbox cbbp=new Checkbox("Blog Post");
Label Supervisor = new Label("Which SV you want to nominate");
CheckboxGroup cbsupervisors=new CheckboxGroup();
Now i am about to define a new class named "Init" that i told you above.We basically implementing all the labels,checkboxs,checkboxgroups we defined in above class in this class.I want you to see the difference between regular "add" and "add(new Checkbox...) . In the end of the add(new Checkbox("Jestemkioskiem ",cbsupervisors,false)); there is a "false" or "true" this actually would allow user to choose only the ones we allow user to choose but not in this program.In this program user can only choose one supervisor.We will talk about this method in next tutorials.
public void init() {
add(title);
add(name);
add(nm);
add(Phone_number);
add(pn);
add(apply2);
add(new Checkbox("Over 6 Months ",cbduration,true));
add(new Checkbox("Below 6 Months ",cbduration,false));
add(best);
add(cbsu);
add(cbde);
add(cbbh);
add(cbts);
add(cbgh);
add(cban);
add(cbvi);
add(cbdc);
add(cbtt);
add(cbvt);
add(cbcw);
add(cbbp);
add(Supervisor);
add(new Checkbox("Ruah ",cbsupervisors,true));
add(new Checkbox("Espoem ",cbsupervisors,true));
add(new Checkbox("Knowledges ",cbsupervisors,true));
add(new Checkbox("Omeratagun ",cbsupervisors,true));
add(new Checkbox("Arie.Steem ",cbsupervisors,true));
add(new Checkbox("Podanrj ",cbsupervisors,true));
add(new Checkbox("Mcfarhat ",cbsupervisors,true));
add(new Checkbox("Mkt ",cbsupervisors,true));
add(new Checkbox("Jestemkioskiem ",cbsupervisors,false));
add(Apply);
At the final step i choose my programs font and size.You can google "java fonts" to find all the fonts.I choosed my font as arial and made my letter type bold and i choosed my letter size as "17".I named my font as "abc" and to assign all the labels i want to i add title of label and use ".setfont" method then finally add "(abc)" because i named my font name as "abc" as you know like this ; best.setFont(abc);
Finally i choosed my applet size with using "setlayout" as (36,35); 36 is number of row and 35 is number of column in my applet.
Font abc = new Font("Arial",Font.BOLD,17);
title.setFont(abc);
best.setFont(abc);
apply2.setFont(abc);
Supervisor.setFont(abc);
setLayout(new GridLayout(36,35));
package Utopian;
import java.applet.Applet;
import java.awt.*;
public class NewApplet extends Applet
{
Label title = new Label("Utopian Moderator Application");
Label name = new Label("Your Utopian Id: @");
TextField nm = new TextField(30);
Label Phone_number = new Label("Your Registered Phone Number :");
TextField pn = new TextField(30);
Button Apply = new Button("Apply");
CheckboxGroup cbduration=new CheckboxGroup();
Label apply2 = new Label("How Long You Have Been Contributing For Utopian.io");
Label best = new Label("Choose Your Best Categories You Would Like To Moderate");
Checkbox cbsu=new Checkbox("Suggestion");
Checkbox cbde=new Checkbox("Development");
Checkbox cbbh=new Checkbox("Bug Hunting");
Checkbox cbts=new Checkbox("Translation");
Checkbox cbgh=new Checkbox("Graphics");
Checkbox cban=new Checkbox("Analysis");
Checkbox cbvi=new Checkbox("Visibillity");
Checkbox cbdc=new Checkbox("Documentation");
Checkbox cbtt=new Checkbox("Tutorials");
Checkbox cbvt=new Checkbox("Video Tutorials");
Checkbox cbcw=new Checkbox("Copywriting");
Checkbox cbbp=new Checkbox("Blog Post");
Label Supervisor = new Label("Which Supervisor Would you Like To Nominate");
CheckboxGroup cbsupervisors=new CheckboxGroup();
public void init() {
add(title);
add(name);
add(nm);
add(Phone_number);
add(pn);
add(apply2);
add(new Checkbox("Over 6 Months ",cbduration,true));
add(new Checkbox("Below 6 Months ",cbduration,false));
add(best);
add(cbsu);
add(cbde);
add(cbbh);
add(cbts);
add(cbgh);
add(cban);
add(cbvi);
add(cbdc);
add(cbtt);
add(cbvt);
add(cbcw);
add(cbbp);
add(Supervisor);
add(new Checkbox("Ruah ",cbsupervisors,true));
add(new Checkbox("Espoem ",cbsupervisors,true));
add(new Checkbox("Knowledges ",cbsupervisors,true));
add(new Checkbox("Omeratagun ",cbsupervisors,true));
add(new Checkbox("Arie.Steem ",cbsupervisors,true));
add(new Checkbox("Podanrj ",cbsupervisors,true));
add(new Checkbox("Mcfarhat ",cbsupervisors,true));
add(new Checkbox("Mkt ",cbsupervisors,true));
add(new Checkbox("Jestemkioskiem ",cbsupervisors,false));
add(Apply);
Font abc = new Font("Arial",Font.BOLD,17);
title.setFont(abc);
best.setFont(abc);
apply2.setFont(abc);
Supervisor.setFont(abc);
setLayout(new GridLayout(36,35));
}
}