Category: Code . Programming Samples . প্রোগ্রাম উদাহরন

Code . Programming Samples . প্রোগ্রাম উদাহরন

Driver template to create and start a Thread object.

** Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,   *  © 2001 Marty Hall and Larry Brown;  *  may be freely used or adapted.  */ public class DriverClass extends SomeClass {   …   public void startAThread() {     // Create a Thread object.     ThreadClass thread = new …

Continue reading

Pointers

/* The following code example is taken from the book  * “The C++ Standard Library – A Tutorial and Reference”  * by Nicolai M. Josuttis, Addison-Wesley, 1999  *  * (C) Copyright Nicolai M. Josuttis 1999.  * Permission to copy, use, modify, sell and distribute this software  * is granted provided this copyright notice appears in …

Continue reading

Valarray Example

/* The following code example is taken from the book  * “The C++ Standard Library – A Tutorial and Reference”  * by Nicolai M. Josuttis, Addison-Wesley, 1999  *  * (C) Copyright Nicolai M. Josuttis 1999.  * Permission to copy, use, modify, sell and distribute this software  * is granted provided this copyright notice appears in …

Continue reading

Statics.java Demonstrates static and non-static methods.

*/ public class Statics {  public static void main(String[] args) {     staticMethod();     Statics s1 = new Statics();     s1.regularMethod();   }   public static void staticMethod() {     System.out.println(“This is a static method.”);   }   public void regularMethod() {     System.out.println(“This is a regular method.”);   } }

Batton’s java

import java.applet.Applet; import java.awt.*; /././././././ public class Buttons extends Applet {   private Button button1, button2, button3;     public void init() {     button1 = new Button(“Button One”);     button2 = new Button(“Button Two”);     button3 = new Button(“Button Three”);     add(button1);     add(button2);     add(button3);   } } /././././././././.

IfTag.java, IfConditionTag.java, IfThenTag.java, and IfElseTag.java, Custom tags that make use of tag nesting

IfTag.java, IfConditionTag.java, IfThenTag.java, and IfElseTag.java, Custom tags that make use of tag nesting IfTag.java package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import javax.servlet.*; /** A tag that acts like an if/then/else.  *  <P>  *  Taken from Core Web Programming Java 2 Edition  *  from Prentice Hall and Sun Microsystems Press,  *  .  *  May …

Continue reading

FilterExample.jsp Page that uses the FilterTag custom tag

FilterExample.jsp Page that uses the FilterTag custom tag <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Illustration of FilterTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>HTML Logical Character Styles</TITLE> <LINK REL=STYLESHEET       HREF=”JSP-Styles.css”       TYPE=”text/css”> …

Continue reading

Demonstrates using a TexturePaint to fill an shape with a tiled image

^^^^^^^^^^^^^^^^^ TiledImages.java Demonstrates using a TexturePaint to fill an shape with a tiled image. Uses the following class and images:     * ImageUtilities.java Simplifies creating a BufferedImage from an image file. ~~~~~~~~~~~~~~~~~~ import javax.swing.*; import java.awt.*; import java.awt.geom.*; import java.awt.image.*; /** An example of using TexturePaint to fill objects with tiled  *  images. Uses the …

Continue reading

Draws a filled ellipse

import javax.swing.*;   // For JPanel, etc. import java.awt.*;      // For Graphics, etc. import java.awt.geom.*; // For Ellipse2D, etc. /** An example of drawing/filling shapes with Java 2D in  *  Java 1.2 and later.  * ************************** public class ShapeExample extends JPanel {   private Ellipse2D.Double circle =     new Ellipse2D.Double(10, 10, 350, 350);   private Rectangle2D.Double …

Continue reading

JavaTextField.java

import java.applet.Applet; import java.awt.*; /** Lets the user enter the name of any  *  good programming language. Or does it?  *    ********************* public class JavaTextField extends Applet {   public void init() {     setFont(new Font(“Serif”, Font.BOLD, 14));     setLayout(new GridLayout(2, 1));     add(new Label(“Enter a Good Programming Language”,                   Label.CENTER));     LanguageField langField …

Continue reading