Credits

Thursday, September 30, 2010

Teacher: Drained from School Papers

I have been sleeping for days now and because I jog early mornings, I am always deprived of my good eight - hour sleep. I have been caught in between checking test papers, making grades, recording stocks, doing inventory, and alike.

Consequently, my body could only manifest the stress and physical restraints specifically skin wrinkling, and   dark circles     among others.  In spite of the hard toil, I am however happy that I teach because I get to influence life and create friendship with my students and colleagues.

I only hope that I can finish all my duties on time since next week  can be quite tough on more paper works.

Intro on Java Applets

The very reason why Java has overwhelmed the greater public is because it is internet - capable and oriented. And with the basics of object - oriented  programming, Java allows reusability of codes making it more acceptable.

With Java's applets, we can create little utility codes or applets to run in our browser, offline or online. You can actually run your Java applet - embedded through your Java software's applet viewer or through an HTML document that calls for your java program.

Unlike a typical Java program, your applet does not require any main method; using the different stages of applet, it can run successfully without main method.

The program below illustrates this example.



[+/-] show/hide


import java.applet.*;
import java.awt.*;

import java.awt.event.*;

public class AppletFinalExercise1 extends Applet implements ActionListener{
Label myTeam = new Label(" ");
Button myQuestion= new Button("Who is your number 1 team?");
Font myFont = new Font("Dialog",Font.BOLD+Font.ITALIC,17);
@Override
public void init(){
myQuestion.addActionListener(this);
add(myQuestion);
add(myTeam);

}

public void actionPerformed(ActionEvent e)
{
myTeam.setLocation(20,0);
myTeam.setFont(myFont);
myTeam.setText("Purefoods");

}

}

School Sports Events Heat Up

My day was quite filled with  long hours in school, business and bills. We are now on the fourth day of our six - day intramurals and then, another three weeks of academic instructions are soon to be hurdled with.

Today, indoor games like scrabble, word factory and chess were played in one of the school's rooms and the evening is set for cultural displays. 

Funny though that I was assigned as a scrabble official and though I had my fair share of playing when I was younger, I could not at all remember some rules in scrabble. I had to confirm the queries and rules with my co - official and the players themselves. LOL!

I was however felt so bored and sleepy waiting for the game to end. tsk ! tsk ! tsk ! Must be my sleep - deprived nights and busy days. 

Tomorrow is another day of playing but I am scheduled to hold our project defense. I can only hope that somehow I can finish all my tasks.

Sunday, September 26, 2010

Encouraging Recycling Among Students

As part of our sports events, the school held a recycling - base competition where students from information technology education programs and  business courses made use of old bottles, product boxes, old paints and newspapers among others.

The competition did not only showcase the students' skills but it also encourages the significance of recycling and reuse for big savings and protection of our mother earth.

So, if products like from   Kwikset    are only of quality and elegance, they can sure last for a lifetime and they can be reused and recycled in so many different ways.

The grand winner of the competition was a big robot model made from buttons, card boxes and CD's.  The winning artists shall have their awards during the culminating event on Saturday.

Why Students Must Have Field Trips

My kid and nephew join their entire class in their field trip to a national science high school for field exposure. But, why should students join field trips? Here is my short list of benefits of field exposures:


  • It reinforces classroom teachings as students get to see the actual illustration or application of the theories;
  • It encourages their inquisitive skills as they ask further questions to make the exposure more clear and comprehendable;
  • It can provide an opportunity for new discovery;
  • It gives them a breather as they break from their typical classroom arrangement;
  • It provides another venue to socialize with their peers and community;
  • It is a compliance of educational government agencies; and
  • It promotes social recognition;

How to Prepare for a School Project Panel Defense

The semester is almost over and as a typical requirement for subjects with inclusive projects to complete and defend, project defenses are soon to be set and scheduled.

To prepare my students for their final defense, I decided to hold a pre - project defense this Friday and Saturday to correct and improve their information system projects.

Just like any project, it is quite important that your project is well made and supported. Thus, with the given time to create and test a project, make sure that you abide strictly by the project's timetable.

To prepare you of possible questions during defense, you can ask your colleagues of questions pertaining to your  project at hand, take note of questions that you are not confident with or have lack of support.  Also, it will help you if you seek out an expert to be your dummy panelist. Just the same, take note of  the feedbacks.

Make sure that you have the proper documentation about your project; Note all your resources and references for credible support.

Lastly, you are the expert of your project, simply be confident and with the long painstaking works you have on your project, you can just hurdle through your defense with flying colors.

School Intramurals Rocks the Road

Today is the start of the  six - day event of our school as we hold our sports intramurals. Since I only hold a part - time job with my school, I can go at any available time to the sports venue and just complete my week's required hours. I decided not to join in their early morning motorcade since I still have other valuable things to attend to.

I decided to be on long pants and shirts with high UV sunglasses as protection from the scourging sun but I wish I can buy a new pair of jogging shoes from a local store or best, from  an     online auction    for wider selection.  The long standing and walking only require me to be on rubber shoes for more ease and comfort.

As soon as I finish with my house works, I shall run and be up to head to our sports' venue.

School Participation in Gensan City Celebration


Schools typically join city festivals and other events and normally, only the public schools have the pressing duty to join.

So, yesterday as a culminating day of Tuna Festival in General Santos City, around 7 elementary schools and 5 high schools join in the Mardi Gras street dancing and the streets became livelier and colorful as they paraded their costumes while dancing. My kid had his share of nice shots too; in spite of the hot day, the dancers could only be gleeful with their stances.

The day culminated in our biggest gym as a showdown of all big events in the Tuna Festival.

Java's Multilistener

It is possible to integrate all event handling on different GUI components. In the example below, events on button and list were integrated. You can both add these listeners in the class header or along with the addObjectListner method.

See the example below.

[+/-] show/hide



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

import javax.swing.event.ListSelectionListener;
import javax.swing.event.ListSelectionEvent;

public class GUIPrefinalEventv2 extends JFrame implements ActionListener, ListSelectionListener
{

String[] numbers={" Zero "," One "," Two "," Three "," Four "," Five "," Six "," Seven "," Eight "," Nine "};
JList numList=new JList(numbers);
JButton print=new JButton("Print");
String choice;

public GUIPrefinalEventv2() {
super("Exam");
setSize(100, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

FlowLayout flo = new FlowLayout();
numList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
numList.addListSelectionListener(this);

JScrollPane scroller=new JScrollPane(numList);
print.addActionListener(this);
setLayout(flo);
add(scroller);
add(print);

setVisible(true);
}



public void valueChanged(ListSelectionEvent e) {
choice=(String) numList.getSelectedValue();
}

public void actionPerformed(ActionEvent a)
{ System.out.println("You chose: "+choice);}

public static void main(String[] arguments) {
GUIPreFinalEvent app = new GUIPreFinalEvent();
}
}

Sunday, September 19, 2010

New School Semester Up Next

We are now done with our pre - finals exam, our third - term exam, and in just three weeks, our first semester can officially be ended. And, teachers along with the entire studentry can only rejoice for the upcoming semestral break. And, most likely, I shall be away for a week with my kid for a family reunion.

So, now that we are already anticipating for the new semester to be up and running again, perhaps, we can start buying new set of school stuffs including  easy spirit shoes  for convenience and big savings.

Waiting for second semester is faster this time since a week from now, we shall hold a week of sports intramurals, so, we only have around 15 days before break time! Thank God!

No Expulsion for Pregnant Unmarried Students, Teachers and More for Women Rights

I oftentimes say to my students that our country, Philippines, is way too discriminating when it comes to gender issues. For one, married women are not easily hired, then, social and legal bias on adultery on both sides are quite an issue too.

And, being in school for over a decade, I had seen punishments among pregnant unmarried teachers and students who had to leave school because of their unacceptable state.

But, effective July 2010, the unmarried pregnant women are protected already from expulsion under the new implementing rules and regulations of Magna Carta for Women. This along with other gender - issues were repelled and shall soon be revised to give equal justice to both sexes.

Read the complete article from United Nations Development Programme.

Teacher's Worst Nightmare: Losing a Class Record

There are other worse things that can happen to a teacher but nothing beats losing a class record. I did experience this when I had to enter my papers' raw scores directly to my ASUS Eee PC notebook and it went KABOOM! So, I had to ask my students their quizzes and other classroom papers to record again their scores. But, not all papers were returned, so, I could only trust their honesty.


Now, I was knocked off again when I had lost my pre - final term class record. The only blessing, however, is that all the papers are still in my custody. I can only complain of re - writing the scores again and rechecking their laboratory works since the scores were only kept on a little sheet of paper. Sigh!


This is really all draining but I could not do otherwise.

Thursday, September 16, 2010

Mobile Education in the Philippines

There are more than 250,000 street children in the major cities of the Philippines and while there are different reasons why this number continues to boom, private and public institutions pool their resources to provide mobile education among the street children and to remote areas where city schools are too remote to be attended to.

This is an excellent  strategy to make sure that education is dispersed even to the underprivileged.  Heroes say that the only way poverty can be alleviated is through education, and bringing this right to every one can be quite hopeful.

Along with this, different sectors bring forth education on other relevant issues including health problems and treatments including reviews  from coloncleanser.net.  And, this is only timely because one of the top causes of deaths nowadays is colon cancer and finding ways to  treat or prevent this can indeed reduce or eventually eliminate instances of colon - related problems.

We can only hope that education, mobile or not, can define a better and healthy life for everyone.

Tuna Festival in GenSan City Up and Running

September is a festive month for us Generals as we celebrate Tuna Festival. History sets Tuna Festival on the 5th of September, but, for unanticipated reasons, the city government moved this year's celebration to third week of September.

In spite of the delay, the city is however, packed with countless talent showdowns, trade fairs, food exhibits and congress, competition to boost the pride and honor of city locals.

With the elegance and grandness of Tuna Festival every year, tourists from other cities and even foreign guests are appealed with the preparations and standoff of Tuna Festival.

So, to see the rest of the events that shall culminate until end of September,  you can see this schedule below.

Tunafest Schedule as of September 9, 2010

Online Jobs for My Students

WIth a hard life in the Philippines, it is only natural that most Filipinos look for second or nth job just to augment their present income.


This is one of the things we emphasize and teach our students that life is harder, so, they have to better appreciate their parents' efforts and hard labor.


For my other students, they get to join other online workers who do all sorts of works including programming jobs, technical support, writing tasks among others.


So, while my students and other graduates wait for full - time works, they make online jobs as their starting employment. While jobs can be bountiful,  security issues are not to be ignored. Thus, saving and investing their hard - earned income can make a difference.


We can only hope that while students do their online works, they can equally value their studies. We cannot compromise our future for an easy  short - term benefits.

Be Informed and Save Lives!

Last September 5, my SOCCSKSARGEN Bloggers community conducted a blood drive for Red Cross and it was only timely and relevant because of the accelerating cases of Dengue nationwide.


But, what can be the perks of donating blood apart from saving lives?  Articles say that it allows rejuvenation or replenishment  of blood supply, makes you check your health status, lowers down your iron level that  prevents heart problems, and reduces cancer risks including lung, liver, colon and throat cancers.


Knowing all these health perks, donating blood is simply helpful. Thus, when one is informed on how to protect and save one's health including  colon cleanse  can indeed protect  your life and your loved ones.


After the blood donation, the group headed to a local orphanage for feeding. We can only hope that we can do our community works again.

Box Layout of Java

When you need to pile components in rows or in columns, then a Box Layout can be used. To compare Grid Layout with Box Layout, Grid Layout makes your components in matrix or table format while Box Layout creates only a stack EITHER in a single row or single column.

The program below  illustrates the use of this layout along with Flow Layout.
[+/-] show/hide


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

public class BoxLayoutDemo extends JFrame {

public BoxLayoutDemo()
{


super("Stacker");
setSize(430,150);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//create top panel
JPanel commandPane=new JPanel();
BoxLayout horizontal =new BoxLayout(commandPane,BoxLayout.Y_AXIS);
commandPane.setLayout(horizontal);
JButton subscribe = new JButton("Subscribe");
JButton unsubscribe = new JButton("Unsubscribe");
JButton refresh = new JButton("Refresh");
JButton save = new JButton("Save");

commandPane.add(subscribe);
commandPane.add(unsubscribe);
commandPane.add(refresh);
commandPane.add(save);

//create bottom panel
JPanel textPane=new JPanel();
JTextArea txt = new JTextArea(4,70);
JScrollPane scrollPane=new JScrollPane(txt);

//put them together
FlowLayout flow =new FlowLayout();
setLayout(flow);
add(commandPane);
add(scrollPane);
setVisible(true);



}

public static void main (String [] args){
BoxLayoutDemo frm = new BoxLayoutDemo();

}
}

Card Layout of Java

Another interesting layout manager in Java is the Card Layout. Card Layout allows you to display set  of components over other components one at a time.

So, with limited space, a Card Layout can be quite useful. The program adopted from the net below is an illustration of this Card Layout.

[+/-] show/hide


/*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of Oracle or the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package layout;

/*
* CardLayoutDemo.java
*
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class CardLayoutDemo implements ItemListener {
JPanel cards; //a panel that uses CardLayout
final static String BUTTONPANEL = "Card with JButtons";
final static String TEXTPANEL = "Card with JTextField";

public void addComponentToPane(Container pane) {
//Put the JComboBox in a JPanel to get a nicer look.
JPanel comboBoxPane = new JPanel(); //use FlowLayout
String comboBoxItems[] = { BUTTONPANEL, TEXTPANEL };
JComboBox cb = new JComboBox(comboBoxItems);
cb.setEditable(false);
cb.addItemListener(this);
comboBoxPane.add(cb);

//Create the "cards".
JPanel card1 = new JPanel();
card1.add(new JButton("Button 1"));
card1.add(new JButton("Button 2"));
card1.add(new JButton("Button 3"));

JPanel card2 = new JPanel();
card2.add(new JTextField("TextField", 20));

//Create the panel that contains the "cards".
cards = new JPanel(new CardLayout());
cards.add(card1, BUTTONPANEL);
cards.add(card2, TEXTPANEL);

pane.add(comboBoxPane, BorderLayout.PAGE_START);
pane.add(cards, BorderLayout.CENTER);
}

public void itemStateChanged(ItemEvent evt) {
CardLayout cl = (CardLayout)(cards.getLayout());
cl.show(cards, (String)evt.getItem());
}

/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event dispatch thread.
*/
private static void createAndShowGUI() {
//Create and set up the window.
JFrame frame = new JFrame("CardLayoutDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Create and set up the content pane.
CardLayoutDemo demo = new CardLayoutDemo();
demo.addComponentToPane(frame.getContentPane());

//Display the window.
frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {
/* Use an appropriate Look and Feel */
try {
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
} catch (UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
} catch (IllegalAccessException ex) {
ex.printStackTrace();
} catch (InstantiationException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
/* Turn off metal's use of bold fonts */
UIManager.put("swing.boldMetal", Boolean.FALSE);

//Schedule a job for the event dispatch thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}

Wednesday, September 15, 2010

Health Benefits of Cordial Student – Teacher Relationship

Classroom management is unique and relative to a teacher’s skill in handling his or her class. I had tried to be strict but strictness does not suit me. It only drains my energy and discourages me to give my best every class period.

Thus, I cultivate a culture of cordial friendship among my students. Of course, this only happens after we agree on house rules. I never let personal relationship influence how I do the grades.


But, having a friendly relationship brings health benefits too: relaxed mood, reduced stress and positive disposition.


Casual conversations need not to be academic; basically, life's common issues like people, health issues including cleanliness through regular bath habits and salicylic acid face wash  among others, relationship, technology, lifestyles including drinking, recreational activities can be openly discussed and you can never really when fun hits in.


Teaching needs not be dragging. You can have fun while exercising your job.

Schools and Other Establishments Rock for City Festival

September is a special month for us General Santos locals as we celebrate Tuna Festival. Thus, as always, entities from private and public sectors. This is a month - long celebration culminated with dozens of contest, showdowns, and more fun dining.

Normally, schools join in the street dance as  they showcase the province's native tribes and their grand and colorful culture.

The celebration started already September 3 with former senator Mar Roxas as the Keynote speaker in behalf of the president, Noynoy Aquino.

The locals and tourist shall however witness more as the grandest celebration shall commence September 18  until 26.

We can only witness the spectacular world class talents of the Generals as the Tuna Festival completely unfolds.

Teaching and Learning is For Everyone


The craft of teaching does not only apply to and for people. This is quite evident when a pet owner teaches his pet to sit or roll over or walk around hurdles.

But, the principles of teaching still remain: patient and repetitive participatory learning. Animals can't just learn tricks from one - time teaching and this applies to people too (well, perhaps a review will be more than enough).

But, what can be a major motivation when one opts to teach? It is in the knowledge that your students (animals or otherwise) get to comprehend your instructions  and put this learning into action.

So, perhaps as teachers, we can just be loving and patient individuals as we impart learnings with our students.

When Pressures Hamper your Exam Performance

I am in the middle of my class examination and though I have stopped with my masteral schooling, I can only feel for my students who have to endure reviews and more readings for their term exams. Students oftentimes dread to take the test especially if these exams have major impact on their academic program.


But, when pressures become a toil during examination, it is then imperative that students take necessary ways to alleviate or eliminate any form of pressures.


Typically, when you are too nervous for your exams, breathing relaxation can help. Also, mind condition can make miracle. When you let pressures and stress overwhelm you, it is not unusual that your body manifest these problems through skin degeneration like wrinkles, pimples, acne and alike. These may be a problem, but, medications like wrinkle creams can be appropriately used.


You can reduce your anxiety level if you are well prepared for your exams or something else. It is equally important too that you equip yourself with the right support system.

Reconnecting with Your Old Professors

I happened to read this "Tuesdays with Morrie" novel of a true story between an old professor diagnosed with ALS and an ambitious young man who reconnected because of the fatal disease.

It made me cry from cover to cover as it teaches compassion, love, service, life, commitment and other basic essentials that are oftentimes forgotten. What is more dramatic than learning this through the death of a loved one or a close person, in this case, a student to his dying professor.

It reminded me that when students graduate, they make their own lives through their chosen career. And, when professors are lucky to see them again, it only typical that the old memories are rekindled. But, oftentimes, teachers (and perhaps other older people) are forgotten not until they are on obituaries. Thus, the novel  reminds us to bond whenever we can, especially to the old ones who seem to be ignored and forgotten by the society.

The novel is a good teaching material about caring for people more than any materialistic possession.  So, perhaps, a quick time with your elders, closed friends, or loved ones can make you appreciate their roles in your life and that you are happy that they are around to be with you.

Lessons need not to conclude in classrooms. I guess the  true test about what we all have learned in school is how we act as individuals in the real world.

How to Enforce Honesty during Examination

As a teacher for over a decade, I detest any form of dishonesty may it be in major or minor exams. I may have kid around my students about preparing cheat logs but that goes to say that they must be ready because teachers are aware of possible chances for cheating.


Teachers respond in varying ways when they caught their students cheating. Normally, students tend to chat with one another during exams and warnings are promptly given. But when these unwanted conversations persist, I could relocate the students to next to my table. Worse, I can stop them from taking their tests. Thus, before starting the test, I make sure that the chairs are physically dispersed, notes and bags are away, and house rules are set.


Students who are caught cheating are given failed exam grades, sent to the guidance counselor for counseling and parents are informed. Normally, I do chat with the student too, explaining the nature of his grievance and its consequences. Having done this, students can better understand their punishment and eventually appreciate your ways to correct them.

How to Prepare for Major Exams

The ultimate goal of any student is to pass in their exams, may it be major or minor examination. Well, this goes to say that if a student is really concerned with his or her grades, then, passing can be a major issue.

But, how do we really prepare for major exams? These exams are pre-scheduled, thus, having known when to have them gives you enough time to review and prepare.

When I took my comprehensive exam as the commencing requirement before earning the degree of Masters in Public Administration, I prepared for a year. I started with skimming over readings given from an outline, read newspapers for relevant issues, prepared my notes, and re – read them. Basically, I mastered my resources. Now, these were countless resources with no finite questions to address. I simply enrich my reading for whatever possible question that may arise.

Thus, I tell my students to prepare ahead of schedule especially for their major tests. Having an outline, and studying with group mates can also be motivating and helpful. Preparing for an exam needs not be idle or boring, you can still have fun with your friends as you do recreational activities,  simply shop using  coupons   or  paint the town red through fun drinking and dancing.

Should there be topics that are not clear or simply not understood, getting a mentor can be an option.

More importantly, when you prepare for examinations, make sure that you have all the paper requirements like permits or clearances. That way, you can better focus on your tests.

Pending Reunion with My Old Student

Come November, I shall be gone for a week to join my parents in their Hongkong trip. While we shall enjoy the pleasures of  an out-of-the country travel, I shall use the time to shop for the boutique. This new venture consumes much of my energy as I have to update it with latest fashion apparel and accessories at reasonable and competitive rates. Thus, our US items are now mixed with Bangkok, Korea and Hongkong novelties.

But, since we are new to the place, it makes us worried where to stay and how to go around the city. Good thing though that my old student from my previous school is now in Hongkong, working. So, she will somehow be our guide as we enjoy the week's trip.

The trip however will make me miss my second semester class and my family at home. Well, I just have to  see them when I get back.

Pains of Teaching

I am just done with one examination, and two others are set until Saturday afternoon. While we take a break from the regular classroom teaching, we are soon to be burdened with too many papers to check and grades to make. Sigh!


I may be doing part-time works but that does not spare me from the usual requirements: grades, reports, attendance sheets, exams and others. The only perk I enjoy with this part-time arrangement is the fact that I can just go out whenever I can and do whatever I like and that I only need to be around during required class time.


I shall however seek the help of my sibling again in checking the test papers, to help speed up preparation of grades and to help me attend to other things.


For now, I can only savor the free time of no class works.

Bonding with Students

This evening is free from studying lessons or checking papers as students shall go through their exams tomorrow until Saturday. I wish to make use of our three - day prefinal exams to check on quizzes, term papers and laboratory works.

But, with this short time of not attending to my regular class, I begin to miss my students. When my classroom topics allow for class discussion, we get to bond more as I make use of real - time examples that hit home among my students.

We get to discuss family, friendship, hobbies, social issues, lifestyles including  crash diets that work.  I guess with three hours of being together a week can make the mood more casual and friendly.

I can only wish that my students have done their reviews, so, they can do better in their major exams. For now, I can only enjoy the free night without academic worries.

Java's Grid Layout

Another commonly used layout manager is the Grid Layout. If you want your components in rows and columns, then, a Grid Layout is used.

The sizes of the components are adjusted to fit inside the container. A Grid Layout requires you to set the number of rows and columns and even the gaps among these components.

The program below illustrates this example.

[+/-] show/hide


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

public class GridLayoutDemo extends JFrame {
Container con = getContentPane();
public GridLayoutDemo()
{

JButton b1,b2,b3,b4,b5;

con.setLayout(new GridLayout(2,3,10,1)); // where 2=rows,3=columns,10=hgap,1=vgap
b1 = new JButton("Button1");
b2 = new JButton("Button2");
b3 = new JButton("Button3");
b4 = new JButton("Button4");
b5 = new JButton("Button5");

con.add(b1);
con.add(b2);
con.add(b3);
con.add(b4);
con.add(b5);


setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public static void main (String [] args){
GridLayoutDemo frm = new GridLayoutDemo();
frm.setSize(300,100);
frm.setTitle("Grid Layout Demo");
frm.setVisible(true);
}
}

Java's Flow Layout

One of the layout manager is Flow Layout which is the default layout for panels.  Flow Layout is used when you need to align evenly your components and line wrapping is employed to allow all components to be seen.

The constants that can be used with Flow Layout are the following:

FlowLayout.CENTER
FlowLayout.LEFT
FlowLayout.RIGHT

The program below illustrates the use of these constants.

[+/-] show/hide



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

public class FlowLayoutDemo extends JFrame implements ActionListener{
JButton lb = new JButton("Left Button");
JButton rb = new JButton("Right Button");
FlowLayout layout = new FlowLayout();
Container con = getContentPane();
public FlowLayoutDemo()
{
con.setLayout(layout);
con.add(lb);
con.add(rb);

lb.addActionListener(this);
rb.addActionListener(this);


setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public void actionPerformed(ActionEvent e){
Object source = e.getSource();
if (source==lb)
layout.setAlignment(FlowLayout.LEFT);
else
layout.setAlignment(FlowLayout.RIGHT);
layout.layoutContainer(con);
}
public static void main (String [] args){
FlowLayoutDemo frm = new FlowLayoutDemo();
frm.setSize(300,100);
frm.setTitle("Flow Layout Demo");
frm.setVisible(true);
}
}

Saturday, September 11, 2010

School Intramural is Ready to Rumble!

Just like any school from different levels, our STI network shall hold its annual sports events. This is line with the mandates of government institutions, Commission on Higher Education (CHED) and Department of Education (DepEd), to provide opportunities for students to develop holistic skills. Thus, sports events are presented to allow students to develop social values and relationship with others and their physical stamina.

I was never athletic when I was still in college but since I have been teaching all my life, I get to attend sports events in all the schools I went through.

I personally like watching cheer dance and physical games like basketball , volleyball and track and field where players are mostly on   men's running shorts  for more ease and  flexibility.

However, I just don’t know if I have to stay the entire week in my school’s events since my employment status is only part-time. Perhaps, I have to have this issue straighten out before the game event.

Java's Border Layout with Event Handling

Layout managers in Java can be used to manipulate placement of components (i.e buttons, labels, text fields, and others). There are about  six (6) containers which include FlowLayout, BorderLayout, BoxLayout, GridLayout, CardLayout, and GridBagLayout.

If your design includes use of different regions (North, South, East, West, and Center) or at least, few of these regions,  then, use a BorderLayout instead. Below is an example of this layout with event methods whenever a button in a specific region is clicked on.

[+/-] show/hide


import java.awt.*;
import java.awt.event.*;

public class BorderLayoutEvents extends Frame implements WindowListener,ActionListener {

Button b1,b2,b3,b4,b5;

public BorderLayoutEvents(String title) {

super(title);
setLayout(new BorderLayout());
addWindowListener(this);
b1 = new Button("North");
add(b1, BorderLayout.NORTH);
b1.addActionListener(this);

b2 = new Button("West");
add(b2, BorderLayout.WEST);
b2.addActionListener(this);

b3 = new Button("Center");
add(b3, BorderLayout.CENTER);
b3.addActionListener(this);

b4 = new Button("East");
add(b4, BorderLayout.EAST);
b4.addActionListener(this);

b5 = new Button("South");
add(b5, BorderLayout.SOUTH);
b5.addActionListener(this);
}

public void actionPerformed(ActionEvent e){
remove((Component)e.getSource());
validate();
}

public static void main(String[] args) {

BorderLayoutEvents myWindow = new BorderLayoutEvents("Border Layout");
myWindow.setSize(250,150);
myWindow.setVisible(true);

}


public void windowActivated(WindowEvent arg0) {
}

public void windowClosed(WindowEvent arg0) {
}

public void windowClosing(WindowEvent arg0) {
dispose();
System.exit(0);
}

public void windowDeactivated(WindowEvent arg0) {
}

public void windowDeiconified(WindowEvent arg0) {
}

public void windowIconified(WindowEvent arg0) {
}

public void windowOpened(WindowEvent arg0) {
}

}

Prefinal Exam Soon

My laboratory class in Operating System subject is already done, well if I have to consider students’ attendance since everyone else is gone already as their works are already completed and graded. However, I can’t leave since my time to stay in school is not done yet.

So, I just have to prepare for prefinal exams next week, particularly on Thursday until Saturday. Our supposed – to – be exams from the central head office had not dispatched all centralized tests, thus, we just had to make use of old exams.

With more papers to check next week, I just have to work on my backlog papers. This is one of the draining toils of being a teacher, more papers and more papers to hurdle through.

Thursday, September 9, 2010

Learn with Technology

Students from the old schools are more apt for school learning than most students today. I guess with fewer reasons to miss schools and with stricter parents and social norms, students then were more conscientious of their duties as students.


But, in spite of this shift in moral and social values, it is still commendable how most students and people today make use of technology like Samsung TV, projector, theater systems and computers to make life more convenient and easy.


In school alone, I have to use my notebook and projector to present programming examples and lectures to make my teaching easier and more understandable.


Each generation indeed has its outstanding qualities and downsides but the thing is how people make the best of what their generation has to offer.


For now, we can only guide the young ones to a brighter and more productive life.

Java's Checkbox Component and Events

To add aesthetics and ease in data entry, check box is also used for pre - determined constants like Gender ( only options Female and Male are valid) or Civil Status (like Single, Married, Widow, Separated, Head of the Family)

To make use of a check box, you can have your constructor as:

JCheckbox object = new JCheckbox (String); 

If this check box is selected, you can use an event method to respond to this selection; a method  ItemStateChanged   shall be performed.

The program below illustrates this point.


[+/-] show/hide


/* sample use of JCheckbox with Item event */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class JCheckBoxEvent extends JFrame implements ItemListener{

Container con = getContentPane();
JCheckBox bold = new JCheckBox("Bold");
JCheckBox italic = new JCheckBox("Italic");
JTextField result = new JTextField("",25);


//constructor for JCheckBoxEvent

public JCheckBoxEvent()
{ super("JCheckBox Demo");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
con.setLayout(new GridLayout(0,1));
con.add(bold);
con.add(italic);
con.add(result);

//adding an item listener
bold.addItemListener(this);
italic.addItemListener(this);
result.setEditable(false);

setContentPane(con);


}

public void itemStateChanged(ItemEvent e){
Font ShowFont;
String text;
int style;

text = "12 point";
style =0;

Object source = e.getSource();

if (source==bold){
int select = e.getStateChange();
if(select == ItemEvent.SELECTED){
style=style|Font.BOLD;
text +=" boldface";
}
else text +=" regular weight";
}
else if (source==italic){
int select = e.getStateChange();
if(select == ItemEvent.SELECTED){
style=style|Font.ITALIC;
text +=" italic";
}
else text +=" roman";
}

text += " font";
ShowFont = new Font("Arial",style,12);
result.setFont(ShowFont);
result.setText(text);

}


public static void main (String[] args)
{ JFrame aFrame = new JCheckBoxEvent();
aFrame.setSize(250,150);
aFrame.setVisible(true);
}}

Integration of Common GUI Java Components

GUI components like buttons, labels, text fields, radio buttons, check boxes, scrollpane and others can be all put to use.

A program below illustrates the use of commonly used components with item and action events to respond to combo box selection and a button click.

[+/-] show/hide


/*adding of components to frame without a panel*/
import java.awt.FlowLayout;
import javax.swing.*;
import java.awt.event.*;
public class GUIStudInfoQuiz extends JFrame implements ActionListener{

JLabel nameLabel= new JLabel("Name",SwingConstants.LEFT);
JLabel courseLabel= new JLabel ("Course:",SwingConstants.LEFT);
JLabel addressLabel= new JLabel ("Address:",SwingConstants.LEFT);
JLabel genderLabel= new JLabel ("Gender:",SwingConstants.LEFT);
JLabel statusLabel= new JLabel ("Civil Status:",SwingConstants.LEFT);
JTextArea addressArea = new JTextArea (2,15);
JTextField nameField=new JTextField(15);
JTextField courseField = new JTextField(15);
String[] status = {"Single","Widow","Married"};
JComboBox statusBox = new JComboBox(status);
JTextField statusField = new JTextField(8);
JRadioButton female = new JRadioButton("Female");
JRadioButton male = new JRadioButton("Male");
ButtonGroup gender = new ButtonGroup();

JButton save = new JButton("Save");
JButton cancel = new JButton("Cancel");

public GUIStudInfoQuiz(){

setSize(250,250);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

FlowLayout flo=new FlowLayout();


setLayout(flo);
add(nameLabel);
add(nameField);
add(courseLabel);
add(courseField);
add(addressLabel);
add(addressArea);
add(genderLabel);
statusBox.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
String str = (String)statusBox.getSelectedItem();
statusField.setText(str);
}
});
add(statusBox);
add(statusField);
add(statusLabel);

add(male);
add(female);
gender.add(male);
gender.add(female);

save.addActionListener(this);
cancel.addActionListener(this);

add(save);
add(cancel);

setVisible(true);
}

public void actionPerformed(ActionEvent evt) {

Object source = evt.getSource();
if (source==save)
JOptionPane.showMessageDialog(null,"File saved.");
else
System.exit(0);


}
public static void main (String args[]){
GUIStudInfoQuiz myFrame=new GUIStudInfoQuiz();
}
}