Wednesday 19 November 2014

Event driven programming suitability for a Graphical user interface

Event driven programming suitability for a Graphical user interface
Event driven programming is very suitable for GUI (Graphics interface) due to the range of event commands that are available which proves very compatible with graphics user interface for example Mouse over, keystroke, click or touch.these are some of the events that are suitable for these events when using the graphical buttons labels or text boxes is effective

Service orientated
Service orientated is When a user use of an event driven program/app in order to get a service from it for example you go to setting and set a reminder on the calender for a certain day and time. So the service is the reminder going of on the right day and time.

Events
events can be sub categorized into five different categories which refers to different hardware and software uses of events. These events are: mouse events, keyboard events, HTML object events, Form events and User Interface Events.

Mouse events
mouse events refer to actions performed by the mouse which can be dependant on either mouse buttons e.g. left click, right click, double click; the scroll wheel e.g. scroll up, scroll down, scroll wheel click or even mouse motion and movement sensor e.g. mouse move forward, back, left, right.

Keyboard Events
Keyboard events refer to actions performed with a keyboard which is dependant on either individual key presses of any keys on the board or even a combination is a good example of this is Ctrl+Alt+Delete function which triggers a windows menu which allows you to lock your computer; change your password or open your task manager using a windows operating system.
Html Events
Html events such as on-click, on-mouse move and on-key down is used in online applications using software like JavaScript and cascading style sheets which are designed for working on browser applications. These triggers are not to be confused with hardware mouse and keyboard events despite being similar these events are only for use on web browsers. 

Time Driven
Time Driven programs such as antivirus scans, task scheduler and operating system updates are important features in the maintain and running of your PC and it is often used in real-time computing.
User Interface events are one of the key features of event driven programming because most applications that are created using event driven programming e.g. calculators apps use buttons as a graphical representation of the number. these buttons are required to trigger the event to begin inputting the sum to create a calculation.


Here is an example

package ran;



import javax.swing.*;



public class Ran {



    public static void main(String[] args) {


     int iMyage=18;  
    

String sMessage = JOptionPane.showInputDialog(null,"State your name?","Enter your name",JOptionPane.INFORMATION_MESSAGE);
      
System.out.println(" Welcome home YJC " + sMessage);
     
char cYou = 'j';
    
if (sMessage.contains("Benhur")){
    
System.out.println("B stands for Best of the Best");
    
}else {
      System.out.println(" Sorry " +sMessage+ " i don't recognize you but i know your name starts with " + cYou);
    
    }
    }

    

}

  

in this image the code is running.
the code is suppose to pop up a box to write your name after you write your name.


















Then it will say you entered your name, And if your name doesn't start with b is will say sorry i don't seem to recognize you but i know that your name start with the first letter in your name,But if your starts with b it will say your name starts with b which stands for best of the best . 







No comments:

Post a Comment