Posts

Draw arrow line example

Draw arrow line example -  Its a complete example import java.awt.*; import java.awt.geom.*; import javax.swing.*; public class Test { public static void main (String args[]) { SwingUtilities.invokeLater ( new Runnable () { Test arrows = new Test(); public void run () { JFrame frame = new JFrame ( "Arrows" ); frame.add ( new JPanel() { public void paintComponent ( Graphics g ) { arrows.draw ( ( Graphics2D ) g, getWidth(), getHeight() ); } } , BorderLayout.CENTER ); frame.setSize ( 800, 400 ); frame.setDefaultCloseOperation ( JFrame.EXIT_ON_CLOSE ); frame.setVisible ( true ); } } ); } interface Arrow { void draw ( Graphics2D g ); } Arrow[] arrows = { new LineArrow(), new CurvedArrow() }; void draw ( Graphics2D g, int width, int height ) { g.setRenderingHint ( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); g.setColor ( Color.WHITE ); g.fillRect ( 0, 0, width, height ); for ( Arrow arrow : arrows ) { g.setColo...

What is Implicit Objects in jsp

Implicit Objects:- In this article, I will try to describe about the objects on the jsp page. There are two type of objects can be on a jsp page. Jsp Implicit Objects Jsp Explicit Objects What is Implicit Objects in jsp Objects which are directly available on the Jsp page are called Implicit object. Actually these objects are Java objects and Jsp container provide these objects on the Jsp page. These objects automatically instantiate on the Jsp page. Jsp has nine type of Implicit Objects. We are describing these implicit objects below. Object             Class application         javax.servlet.ServletContext config                 javax.servlet.ServletConfig exception           java.lang.Throwable out                  ...

JSP Directive Taglib

Taglib Directive :- Taglib Directive is used for include the tag from tag library. It defines the prefix for particular tag library. Syntax of Taglib Directivs is : <%@ taglib=" URIToTagLibrary "  prefix=" tagPrefix "%> Example : <%@ taglib uri="struts-bean.tld" prefix="bean"%> <%@ taglib uri="struts-html.tld" prefix="html"%> <%@ taglib uri="struts-logic.tld" prefix="logic"%> <HTML> <HEAD><title>Example Include Directive</title> </HEAD> <BODY>     <logic:empty>            // some logic here …............    </logic:empty> </BODY> </HTML> Taglib is used to define the custom tag library and used the tag of this library through the tag prefix.

JSP Directives Include

Include Directive - Include directives is used for include any static JSP or HTML file in the JSP page. Syntax of Include Directives :- <%@ include  file=”relative Path” %> Example:- First.jsp <HTML> <HEAD><title>Example Include Directive</title> </HEAD> <BODY>     <%@ include file="/second.jsp" %> </BODY> </HTML> second.jsp <h1>Include me</h1> More about :- Include directive works at compilation time of JSP. It statically include JSP or HTML file. Mean content of included file written in the main servlet. The included file might be open and available to all requests, or it might have security restrictions. The JSP page might be recompiled if the included file changes.

Array concept

Image
Array in Java  - Array is a container where we can put the objects or values of same data type. Size of this container will be predefined and fixed length. It means when you will make the object of array then defines the length of array. Now I am trying to explain in image. In this figure, there is a array container with fixed 10 length. There is a value stored at 3 index in this array container. In the java context, We are writing a java program to know how value stored in java programming. java in array Example : public class ArrayExample{   public static void main(String[] args) {       // this is a array container of int data type.       int []array = null;       // Now fixed the length of this array container       array = new int[10];       //Now i have put the value in array at 3rd index.     ...

JSP Directives

JSP Directives -     JSP Directives is very powerful components in the Jsp. In this page you will learn about JSP Directives. JSP Directives are responsible for giving the special information about the jsp to the Jsp container. Jsp Directives tag syntax is : <%@ directive  attribute=”Value” %> JSP has three type of jps Directives tag. page taglib include page Directive : page Directive is used for manipulating the behaviour of the jsp page. Jsp page can be import the java file through the import attribute. If isErrorPage attribute will be true then jsp will work as a error page. There are list of attribute of page directive. autoFlush buffer     contentType errorPage extends import info isErrorPage isThreadSafe language pageEncoding session autoFlush Attribute :- autoFlush Attribute is used to flush the jsp page when buffer size is overflows. By-default the value of autoFlush attribute is true. If you will set value as fa...

Java Classes

Java Classes : Now I will try to explain about the java classes which implements the interfaces of collections framework. There is a list of class within the collections frame work. AbstractCollection AbstractList AbstractMap AbstractMap.SimpleEntry AbstractMap.SimpleImmutableEntry AbstractQueue AbstractSequentialList AbstractSet ArrayDeque ArrayList Arrays BitSet Calendar Collections Currency Date Dictionary EnumMap EnumSet EventListenerProxy EventObject FormattableFlags Formatter GregorianCalendar HashMap HashSet Hashtable IdentityHashMap LinkedHashMap LinkedHashSet LinkedList ListResourceBundle Locale Observable PriorityQueue Properties PropertyPermission PropertyResourceBundle Random ResourceBundle ResourceBundle.Control Scanner ServiceLoader SimpleTimeZone Stack StringTokenizer Timer TimerTask TimeZone TreeMap TreeSet UUID Vector WeakHashMap

Recent Post

Recent Posts Widget