SMALL "PAINTING"CONCEPT ..

by barkkathulla 2012-09-22 13:05:54

PAINTING HELPS IN DRAWING SOMETHING ON THE SCREEN, BE IT TEXT, A LINE,

A COLORED BACKGROUND, OR AN IMAGE. THE PAINT () METHOD LOOKS LIKE THIS:

PUBLIC VOID PAIT (GRAPHICS G) {

...

}

PAINT () TAKES AN ARGUMENT WHICH IS AN INSTANCE OF THE CLASS GRAPHICS.

IT IS NECESSARY THAT THE GRAPHICS CLASS (PART OF THE JAVA.AWT PACKAGE)

GETS IMPORTED INTO YOUR APPLET CODE< THROUGH AN IMPORT STATEMENT AT THE

TOP OF YOUR JAVA FILE: IMPORT JAVA. AWT. GRAPHICS;


THE REPAINT () METHOD

~~~~~~~~~~~~~~~~~~~~~

THIS METHOD IS USED IN CASE AN APPLET IS TO BE REPAINTED. THE REPAINT ()

CALLS THE UPDATE () METHOD, TO CLEAR THE SCREEN OF ANY EXISTING CONTENT.

THE UPDATE () METHOD IN TURN CALLS THE PAINT () METHOD THAT THEN DRAWS

THE CONTENTS OF THE CURRENT FRAME. REPAINT () CAN BE DONE MENTIONING TIME IN MILLISECONDS TO BE PERFORMED IN FUTURE. IF THE TIME EXPIRES BEFORE UPDATE () CAN BE CALLED, UPDATE IS NOT SUMMONED.

REPAINT () TAKES FOUR ARGUMENTS TO UPDATE ONLY A PART OF THE SCREEN. THE FIRST TWO ARGUMENTS ARE THE X AND THE Y COORDINATES, THE NEXT TWO ARE THE

WIDTH AND THE HEIGHT OF THE RECTANGLE.

THIS HELPS IN FASTER UPDATION OF THE SCREEN.


GRAPHICS,FONTS, AND COLOR

~~~~~~~~~~~~~~~~~~~~~~~~~

IN JAVA,ALL GRAPHICS OPERATIONS CAN BE PERFORMED USING THE JAVA .AWT PACKAGE.THIS PACKAGE CONTAINS VARIOUS CASES AND METHODS FOR PAINTING,GRAPHICS AND

IMAGE ETC...

DRAWING AND FILLING

~~~~~~~~~~~~~~~~~~~

THE GRAPHICS CLASS PROVIDES A SET OF SIMPLE BUILT-IN GRAPHICS PRIMITIVES FOR DRAWING,
493
like
0
dislike
0
mail
flag

You must LOGIN to add comments