Tag: code

Node.js – কলব্যাক এর ধারণা। কলব্যাক কি? (Callbacks Concept)

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– মোহাম্মদ আব্দুল্লাহ   Callback কি ? Callback একটি ফাংশনের জন্য একটি asynchronous সমতূল্য । একটি কলব্যাক ফাংশন একটি নির্দিষ্ট কাজের শেষে সাধারনত কল করা হয়ে থাকে । Node.js এ callback ফাংশন প্রচুর পরিমানে ব্যবহার হয়ে থাকে …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/node-js-callbacks-concept-callback-%e0%a6%95%e0%a6%bf/

JavaScript Code

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science–                 var browser=navigator.appName;                 var b_version=navigator.appVersion; <a href=”http://www.justetc.net” target=”_blank”> <img border=”0″ alt=”hello” src=”b_pink.gif” id=”b1″ width=”26″ height=”26″ onmouseover=”mouseOver()” onmouseout=”mouseOut()” /> Place the following code under script tag/in a javascript file function mouseOver() {    document.getElementById(“b1″).src =”b_blue.gif”; } …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/javascript-code/

JavaScript Form Validation: Validate a Form Collecting Credit Card Information

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science–     function validateCollectPaymentInformationForm()     {         var method, name, number, expiry, errMsg                  errMsg = “”;                  method = document.getElementById(‘paymentMethod’);         name =   document.getElementById(‘txtCCName’);        …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/javascript-form-validation-validate-a-form-collecting-credit-card-information/

Print three-dimensional valarray line-by-line

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /* 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.  * …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/print-three-dimensional-valarray-line-by-line/

C++ Template Example

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /* 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.  * …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/c-template-example/

Javascript : Miscellaneous Code

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science–                 var browser=navigator.appName;                 var b_version=navigator.appVersion; <a href=”http://www.justetc.net” target=”_blank”> <img border=”0″ alt=”hello” src=”b_pink.gif” id=”b1″ width=”26″ height=”26″ onmouseover=”mouseOver()” onmouseout=”mouseOut()” /> Place the following code under script tag/in a javascript file function mouseOver() {    document.getElementById(“b1″).src =”b_blue.gif”; } …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/javascript-miscellaneous-code/

Example demonstrating the use of packages

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– &&&&&&&&&&&&&&&&&&& Example demonstrating the use of packages.     * Class1.java defined in package1.     * Class2.java defined in package2.     * Class3.java defined in package2.package3.     * Class1.java defined in package4.     * PackageExample.java Driver for …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/example-demonstrating-the-use-of-packages/

Code examples for interfaces

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– **************************** Code examples for interfaces:     * Class1.java implements Interface1.java     * Abstract Class2.java implements Interface1.java and Interface2.java     * Class3.java extends abstract class Class2.java     * Interface3.java extends Interface1.java and Interface2.java *************************** ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Class1.java ~~~~~~~~~~~~~~~~~~~~~~~~~~~ …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/code-examples-for-interfaces/

A Ship class illustrating object-oriented programming concepts

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ************************ Ship.java A Ship class illustrating object-oriented programming concepts. Incorporates Javadoc comments. See ShipTest.java for a test. ************************ /** Ship example to demonstrate OOP in Java.  *  *  @author  *          Larry Brown  *  @version 2.0  */ …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/a-ship-class-illustrating-object-oriented-programming-concepts/

Accesses instance variables in a Ship object.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Test1.java Accesses instance variables in a Ship object. ******************************************************** // Create a class with five instance variables (fields): // x, y, speed, direction, and name. Note that Ship1 is // not declared “public”, so it can …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/accesses-instance-variables-in-a-ship-object/

Application that reports all command-line arguments

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ****************** ShowArgs.java Application that reports all command-line arguments. ******************  */ public class ShowArgs {   public static void main(String[] args) {     for(int i=0; i

Permanent link to this article: https://bangla.sitestree.com/application-that-reports-all-command-line-arguments/

DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground ************************************************************ /** Simulating dropping a ball from the top of the …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/dropball-java-uses-a-while-loop-to-determine-how-long-it-takes-a-ball-to-fall-from-the-top-of-the-washington-monument-to-the-ground-2/

NumFormat.java Formats real numbers with DecimalFormat.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.text.*; /** Formatting real numbers with DecimalFormat.  *  *  Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © 2001 Marty Hall and Larry Brown;  *  may be …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/numformat-java-formats-real-numbers-with-decimalformat/

ModificationTest.java Demonstrates changing fields of an object. Inherits from ReferenceTest.java.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © 2001 Marty Hall and Larry Brown;  *  may be freely used or adapted.  */ import java.awt.Point; public class …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/modificationtest-java-demonstrates-changing-fields-of-an-object-inherits-from-referencetest-java/

Tests the class type of an object using the isInstance method (preferred over instanceof operator).

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © 2001 Marty Hall and Larry Brown;  *  may be freely used or adapted.  */ interface Barking {} class …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/tests-the-class-type-of-an-object-using-the-isinstance-method-preferred-over-instanceof-operator/

URLTest.java Demonstrates try/catch blocks.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © 2001 Marty Hall and Larry Brown;  *  may be freely used or adapted.    */    // Further …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/urltest-java-demonstrates-trycatch-blocks/

ExecTest.java illustrates use of the Exec class.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** A test of the Exec class.  *  *  Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © 2001 Marty Hall and Larry Brown;  *  may be freely …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/exectest-java-illustrates-use-of-the-exec-class/

DropBall.java Uses a while loop to determine how long it takes a ball to fall from the top of the Washington Monument to the ground.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** Simulating dropping a ball from the top of the Washington  *  Monument. The program outputs the height of the ball each  *  second until the ball hits the ground.  *  *  Taken from Core Web …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/dropball-java-uses-a-while-loop-to-determine-how-long-it-takes-a-ball-to-fall-from-the-top-of-the-washington-monument-to-the-ground/

Loading Images

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– JavaMan1.java Applet that loads an image from a relative URL. ************************************************************* import java.applet.Applet; import java.awt.*; /** An applet that loads an image from a relative URL.  * >>>>>>>>>>>>>>>>>>> public class JavaMan1 extends Applet {   private …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/loading-images/

Basic template for a Java applet

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– AppletTemplate.java >>>>>>>>>>>>>>>>>>>> import java.applet.Applet; import java.awt.*; ******************** public class AppletTemplate extends Applet {   // Variable declarations.   public void init() {     // Variable initializations, image loading, etc.   }   public void paint(Graphics g) …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/basic-template-for-a-java-applet/

ForwardSnippet.java Partial servlet illustrating how to use a RequestDispatcher to forward requests

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ForwardSnippet.java Partial servlet illustrating how to use a RequestDispatcher to forward requests public void doGet(HttpServletRequest request,                   HttpServletResponse response)     throws ServletException, IOException {   String operation = request.getParameter(“operation”);   if (operation == null) {     …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/forwardsnippet-java-partial-servlet-illustrating-how-to-use-a-requestdispatcher-to-forward-requests/

Example illustrating inheritance and abstract classes

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– *********************************** # Example illustrating inheritance and abstract classes.     * Shape.java The parent class (abstract) for all closed, open, curved, and straight-edged shapes.     * Curve.java An (abstract) curved Shape (open or closed).     * StraightEdgedShape.java …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/example-illustrating-inheritance-and-abstract-classes-2/

Speedboat.java Illustrates inheritance from Ship class

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ***************************** Speedboat.java Illustrates inheritance from Ship class. See SpeedboatTest.java for a test. ***************************** /** A fast Ship. Red and going 20 knots by default.  *  *********************** public class Speedboat extends Ship {   private String color …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/speedboat-java-illustrates-inheritance-from-ship-class/

Demonstrates overloading methods in class Ship4

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ********************* class Ship4 {   public double x=0.0, y=0.0, speed=1.0, direction=0.0;   public String name;   // This constructor takes the parameters explicitly.     public Ship4(double x, double y, double speed,                double direction, String …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/demonstrates-overloading-methods-in-class-ship4/

HelloWWW.java Basic Hello World (Wide Web) Applet

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ********************* import java.applet.Applet; import java.awt.*; *********************   public class HelloWWW extends Applet {   private int fontSize = 40;     public void init() {     setBackground(Color.black);     setForeground(Color.white);     setFont(new Font(“SansSerif”, Font.BOLD, fontSize));   } …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/hellowww-java-basic-hello-world-wide-web-applet/

Basic Hello World application

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ******************* HelloWorld.java Basic Hello World application. *******************  */ public class HelloWorld {  public static void main(String[] args) {     System.out.println(“Hello, world.”);   } } /*

Permanent link to this article: https://bangla.sitestree.com/basic-hello-world-application/

StringTest.java Demonstrates various methods of the String class.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** 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 StringTest …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/stringtest-java-demonstrates-various-methods-of-the-string-class/

NegativeLengthException.java Illustrates defining and throwing your own exceptions.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.io.*; /** 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 …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/negativelengthexception-java-illustrates-defining-and-throwing-your-own-exceptions/

TreeTest.java Builds a binary tree and prints the contents of the nodes. Uses the following classes:

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Treetest.java /** A NodeOperator that prints each node.  *  *  Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © 2001 Marty Hall and Larry Brown;  *  may be …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/treetest-java-builds-a-binary-tree-and-prints-the-contents-of-the-nodes-uses-the-following-classes/

Illustrates the use of arrays

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** Report on a round of golf at St. Andy?s.  *  *  Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © 2001 Marty Hall and Larry Brown;  *  …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/illustrates-the-use-of-arrays/

Factorial.java Computes an exact factorial, n!, using a BigInteger

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.math.BigInteger; /** Computes an exact factorial, using a BigInteger.  *  *  Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © 2001 Marty Hall and Larry Brown;  *  …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/factorial-java-computes-an-exact-factorial-n-using-a-biginteger/

Exec.java Provides static methods for running external processes from applications.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.io.*; /** A class that eases the pain of running external processes  *  from applications. Lets you run a program three ways:  *        *          exec: Execute the command, returning      *         …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/exec-java-provides-static-methods-for-running-external-processes-from-applications/

Controlling Image Loading

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ~~~~~~~~~~~~~~~~~~~ ImageBox.java A class that incorrectly tries to load an image and draw an outline around it. The problem is that the size of the image is requested before the image is completely loaded, thus, returning …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/controlling-image-loading/

HelloWWW2.java Illustrates the ability of an applet to read parameters contained in the HTML document

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– HelloWWW2.java Illustrates the ability of an applet to read parameters contained in the HTML document (PARAM element containing a NAME-VALUE pair). &&&&&&&&&&&&&&&&&&&&&&&&&&&&&& import java.applet.Applet; import java.awt.*; ************************* public class HelloWWW2 extends Applet {   public void …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/hellowww2-java-illustrates-the-ability-of-an-applet-to-read-parameters-contained-in-the-html-document/

An example Travel Site

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– quick-search.html Front end to travel site <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Front end to travel servlet. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/an-example-travel-site/

GetElementsByName an example: Checkbox

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– <html>     <head>         <script type=”text/javascript”>             function getElements()               {               var x=document.getElementsByName(“myInput[]”);               alert(x.length);               alert(x[0].value);            …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/getelementsbyname-an-example-checkbox/

IfExample.jsp Page that uses the custom nested tags

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– IfExample.jsp Page that uses the custom nested tags <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Illustration of IfTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/ifexample-jsp-page-that-uses-the-custom-nested-tags/

Driver template to create and start a Thread object.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ** 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 …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/driver-template-to-create-and-start-a-thread-object/

Pointers

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /* 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.  * …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/pointers/

Valarray Example

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /* 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.  * …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/valarray-example/

Statics.java Demonstrates static and non-static methods.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– */ 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.”);   …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/statics-java-demonstrates-static-and-non-static-methods/

Batton’s java

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– 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”);     …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/battons-java/

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

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– 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 …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/iftag-java-ifconditiontag-java-ifthentag-java-and-ifelsetag-java-custom-tags-that-make-use-of-tag-nesting/

FilterExample.jsp Page that uses the FilterTag custom tag

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– 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, . …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/filterexample-jsp-page-that-uses-the-filtertag-custom-tag/

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

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ^^^^^^^^^^^^^^^^^ 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.*; …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/demonstrates-using-a-texturepaint-to-fill-an-shape-with-a-tiled-image/

Draws a filled ellipse

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– 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 …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/draws-a-filled-ellipse/

JavaTextField.java

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– 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 …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/javatextfield-java/

Applet that uses processXxx methods to print detailed reports on mouse events. Illustrates low-level alternative to handling events with listeners.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; import java.awt.event.*; /** Prints non-detailed reports of mouse events.  *  Uses the low-level processXxxEvent methods instead  *  of the usual event listeners.  *    ***************** public class MouseReporter extends Applet {   …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/applet-that-uses-processxxx-methods-to-print-detailed-reports-on-mouse-events-illustrates-low-level-alternative-to-handling-events-with-listeners/

HeadingExample.jsp Page that uses the HeadingTag custom tag

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– HeadingExample.jsp Page that uses the HeadingTag custom tag <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Illustration of HeadingTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/headingexample-jsp-page-that-uses-the-headingtag-custom-tag/

PrimeExample.jsp Page that uses the PrimeTag custom tag

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– PrimeExample.jsp Page that uses the PrimeTag custom tag <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Illustration of PrimeTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/primeexample-jsp-page-that-uses-the-primetag-custom-tag/

SimplePrimeExample.jsp Page that uses the SimplePrimeTag custom tag

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SimplePrimeExample.jsp Page that uses the SimplePrimeTag custom tag <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Illustration of SimplePrimeTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/simpleprimeexample-jsp-page-that-uses-the-simpleprimetag-custom-tag/

SimpleExample.jsp Page that uses the ExampleTag custom tag.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SimpleExample.jsp Page that uses the ExampleTag custom tag. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Illustration of very simple JSP custom tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/simpleexample-jsp-page-that-uses-the-exampletag-custom-tag/

ExampleTag.java Very simple custom tag. Remember to install it in the WEB-INF/classes/cwp/tags directory.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ExampleTag.java Very simple custom tag. Remember to install it in the WEB-INF/classes/cwp/tags directory. package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; /** Very simple JSP tag that just inserts a string  *  (“Custom tag example…”) into …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/exampletag-java-very-simple-custom-tag-remember-to-install-it-in-the-web-infclassescwptags-directory/

AccessCountBean.java Bean used to illustrate the difference between running jsp:setProperty for every request vs. only when the object is created

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– AccessCountBean.java Bean used to illustrate the difference between running jsp:setProperty for every request vs. only when the object is created package cwp; /** Simple bean to illustrate sharing beans through  *  use of the scope attribute …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/accesscountbean-java-bean-used-to-illustrate-the-difference-between-running-jspsetproperty-for-every-request-vs-only-when-the-object-is-created/

SaleEntry2.jsp Page that uses the SaleEntry bean, using the param attribute to read request parameters and assign them to bean properties

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SaleEntry2.jsp Page that uses the SaleEntry bean, using the param attribute to read request parameters and assign them to bean properties <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of using jsp:setProperty and an explicity …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/saleentry2-jsp-page-that-uses-the-saleentry-bean-using-the-param-attribute-to-read-request-parameters-and-assign-them-to-bean-properties/

SaleEntry.java Bean used to demonstrate the various approaches to reading request parameters and stuffing them into Java objects.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– package cwp; /** Simple bean to illustrate the various forms  *  of jsp:setProperty.  *  <P>  *  Taken from Core Web Programming Java 2 Edition  *  from Prentice Hall and Sun Microsystems Press,  *  .  *  May …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/saleentry-java-bean-used-to-demonstrate-the-various-approaches-to-reading-request-parameters-and-stuffing-them-into-java-objects/

The class that actually gets the strings over the network by means of an ObjectInputStream via HTTP tunneling.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.net.*; import java.io.*; /** When this class is built, it returns a value  *  immediately, but this value returns false for isDone  *  and null for getQueries. Meanwhile, it starts a Thread  *  to request …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/the-class-that-actually-gets-the-strings-over-the-network-by-means-of-an-objectinputstream-via-http-tunneling/

A class the encapsulates the URLs used by various search engines.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SearchSpec.java ******************* /** Small class that encapsulates how to construct a  *  search string for a particular search engine.  *  Taken from Core Web Programming Java 2 Edition  *  from Prentice Hall and Sun Microsystems Press, …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/a-class-the-encapsulates-the-urls-used-by-various-search-engines/

DebugExample.jsp Page that uses the DebugTag custom tag

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– # DebugExample.jsp Page that uses the DebugTag custom tag <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Illustration of SimplePrimeTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/debugexample-jsp-page-that-uses-the-debugtag-custom-tag/

ShearExample.java. Illustrates the effect of applying a shear transformation prior to drawing a square

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import javax.swing.*; import java.awt.*; import java.awt.geom.*; /** An example of shear transformations on a rectangle.  *  *********************** public class ShearExample extends JPanel {   private static int gap=10, width=100;   private Rectangle rect = new Rectangle(gap, …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/shearexample-java-illustrates-the-effect-of-applying-a-shear-transformation-prior-to-drawing-a-square/

LineStyles.java Provides examples of the available styles for joining line segments

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import javax.swing.*; import java.awt.*; import java.awt.geom.*; /** A demonstration of different controls when joining two line  *  segments. The style of the line end point is controlled  *  through the capStyle parameter.  *  ************************************ public class …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/linestyles-java-provides-examples-of-the-available-styles-for-joining-line-segments/

Illustrates using a local font (Goudy Handtooled BT) to perform drawing in Java 2D

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.awt.*; /** An example of using local fonts to perform drawing in  *  Java 2D.  *  ********************** public class FontExample extends GradientPaintExample {   public FontExample() {     GraphicsEnvironment env =       GraphicsEnvironment.getLocalGraphicsEnvironment();     env.getAvailableFontFamilyNames(); …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/illustrates-using-a-local-font-goudy-handtooled-bt-to-perform-drawing-in-java-2d/

Draws a circle with a gradient fill

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– GradientPaintExample.java Draws a circle with a gradient fill. Inherits from ShapeExample.java. ************************************** import java.awt.*; /** An example of applying a gradient fill to a circle. The  *  color definition starts with red at (0,0), gradually  *  …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/draws-a-circle-with-a-gradient-fill/

An applet that permits freehand drawing

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; import java.awt.event.*; /** An applet that lets you perform freehand drawing.  *    **************** public class SimpleWhiteboard extends Applet {   protected int lastX=0, lastY=0;   public void init() {     setBackground(Color.white); …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/an-applet-that-permits-freehand-drawing/

A TextField that uses key events to correct the spelling of the names of computer languages entered into it

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.awt.*; import java.awt.event.*; /** A spelling-correcting TextField for entering  *  a language name.  *    ******************* public class LanguageField extends TextField {   private String[] substrings =     { “”, “J”, “Ja”, “Jav”, “Java” }; …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/a-textfield-that-uses-key-events-to-correct-the-spelling-of-the-names-of-computer-languages-entered-into-it/

DebugTag.java Custom tag that optionally makes use of a tag body

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– DebugTag.java Custom tag that optionally makes use of a tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import javax.servlet.*; /** A tag that includes the body content only if  *  the “debug” request parameter …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/debugtag-java-custom-tag-that-optionally-makes-use-of-a-tag-body/

HeadingTag.java Custom tag that makes use of a tag body

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– HeadingTag.java Custom tag that makes use of a tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; /** Generates an HTML heading with the specified background  *  color, foreground color, alignment, font, and font size. …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/headingtag-java-custom-tag-that-makes-use-of-a-tag-body/

PrimeTag.java Custom tag that outputs a random prime number of a user-specifiable approximate length

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– PrimeTag.java Custom tag that outputs a random prime number of a user-specifiable approximate length package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; /** Generates an N-digit random prime (default N = 50).  *  Extends SimplePrimeTag, adding …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/primetag-java-custom-tag-that-outputs-a-random-prime-number-of-a-user-specifiable-approximate-length/

SimplePrimeTag.java Custom tag that outputs a random prime number of a fixed approximate length

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SimplePrimeTag.java Custom tag that outputs a random prime number of a fixed approximate length package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import java.math.*; import cwp.*; /** Generates a prime of approximately 50 digits.  *  (50 …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/simpleprimetag-java-custom-tag-that-outputs-a-random-prime-number-of-a-fixed-approximate-length/

cwp-taglib.tld Tag Library Descriptor file used by the custom tags in this chapter.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– cwp-taglib.tld Tag Library Descriptor file used by the custom tags in this chapter. <?xml version=”1.0″ encoding=”ISO-8859-1″ ?> <!DOCTYPE taglib  PUBLIC “-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN”  “http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd”> <!– a tag library descriptor –> <taglib>   …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/cwp-taglib-tld-tag-library-descriptor-file-used-by-the-custom-tags-in-this-chapter/

SharedCounts1.jsp, SharedCounts2.jsp, and SharedCounts3.jsp Three pages that all use the AccessCountBean. Results you get depend on which page is hit first and how many total hits the combined pages receive.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of sharing beans. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/sharedcounts1-jsp-sharedcounts2-jsp-and-sharedcounts3-jsp-three-pages-that-all-use-the-accesscountbean-results-you-get-depend-on-which-page-is-hit-first-and-how-many-total-hits-the-combined-pages-r/

SaleEntry3.jsp Page that uses the SaleEntry bean, using property=”*” to read request parameters and assign them to bean properties

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SaleEntry3.jsp Page that uses the SaleEntry bean, using property=”*” to read request parameters and assign them to bean properties <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of using jsp:setProperty and a general association with …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/saleentry3-jsp-page-that-uses-the-saleentry-bean-using-property-to-read-request-parameters-and-assign-them-to-bean-properties/

SaleEntry1.jsp Page that uses the SaleEntry bean, using explicit Java code to read request parameters and assign them to bean properties.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SaleEntry1.jsp Page that uses the SaleEntry bean, using explicit Java code to read request parameters and assign them to bean properties.   <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of using jsp:setProperty with an …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/saleentry1-jsp-page-that-uses-the-saleentry-bean-using-explicit-java-code-to-read-request-parameters-and-assign-them-to-bean-properties/

StringBean.jsp Page that manipulates the StringBean bean with both jsp:useBean (i.e., XML-style) syntax

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– StringBean.jsp Page that manipulates the StringBean bean with both jsp:useBean (i.e., XML-style) syntax package cwp; /** Simple bean to illustrate sharing beans through  *  use of the scope attribute of jsp:useBean.  *  <P>  *  Taken from …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/stringbean-jsp-page-that-manipulates-the-stringbean-bean-with-both-jspusebean-i-e-xml-style-syntax/

RepeatTag.java Custom tag that repeats the tag body a specified number of times

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– RepeatTag.java Custom tag that repeats the tag body a specified number of times package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; /** A tag that repeats the body the specified  *  number of times.  *  <P> …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/repeattag-java-custom-tag-that-repeats-the-tag-body-a-specified-number-of-times/

An applet that reads arrays of strings packaged inside a QueryCollection and places them in a scrolling TextArea.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.net.*; /** Applet reads arrays of strings packaged inside  *  a QueryCollection and places them in a scrolling  *  TextArea. The QueryCollection obtains the strings  *  by means of …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/an-applet-that-reads-arrays-of-strings-packaged-inside-a-querycollection-and-places-them-in-a-scrolling-textarea/

FilterTag.java Custom tag that modifies the tag body

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– FilterTag.java Custom tag that modifies the tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import cwp.*; /** A tag that replaces <, >, “, and & with their HTML  *  character entities (<, >, …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/filtertag-java-custom-tag-that-modifies-the-tag-body/

An applet that searches multiple search engines, displaying the results in side-by-side frame cells.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Using Applets as Front Ends to Server-Side Programs ************************************************** SearchApplet.java An applet that searches multiple search engines,  displaying the results in side-by-side frame cells. Uses the following files: SearchSpec.javaParallelSearches.htmlSearchAppletFrame.htmlGoogleResultsFrame.htmlInfoseekResultsFrame.htmlLycosResultsFrame.html *************************************************** // import java.applet.Applet; import java.awt.*; import …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/an-applet-that-searches-multiple-search-engines-displaying-the-results-in-side-by-side-frame-cells/

RotationExample.java An example of translating and rotating the coordinate system prior to drawing

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.awt.*; /** An example of translating and rotating the coordinate  *  system before each drawing.  *  ******************************* public class RotationExample extends StrokeThicknessExample {   private Color[] colors = { Color.white, Color.black };   public void …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/rotationexample-java-an-example-of-translating-and-rotating-the-coordinate-system-prior-to-drawing/

Demonstrates setting the pen width (in pixels) using a BasicStroke prior to drawing. Inherits from FontExample.java.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– StrokeThicknessExample.java >>>>>>>>>>>>>>>>>>>>>>>>>>> import java.awt.*; /** An example of controlling the Stroke (pen) widths when  *  drawing.  *  ******************  */ public class StrokeThicknessExample extends FontExample {   public void paintComponent(Graphics g) {     clear(g);     Graphics2D g2d …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/demonstrates-setting-the-pen-width-in-pixels-using-a-basicstroke-prior-to-drawing-inherits-from-fontexample-java/

ListFonts.java Lists all local fonts available for graphical drawing.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ListFonts.java Lists all local fonts available for graphical drawing. *********************** import java.awt.*; /** Lists the names of all available fonts.  *  ****************** public class ListFonts {   public static void main(String[] args) {     GraphicsEnvironment env …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/listfonts-java-lists-all-local-fonts-available-for-graphical-drawing/

Illustrates the effect of different transparency

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ~~~~~~~~~~~~~~~~~~~ TransparencyExample.java Illustrates the effect of different transparency (alpha) values when drawing a shape. ~~~~~~~~~~~~~~~~~~~ import javax.swing.*; import java.awt.*; import java.awt.geom.*; /** An illustration of the use of AlphaComposite to make  *  partially transparent drawings.  * …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/illustrates-the-effect-of-different-transparency/

Handling Events

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ***********************************     * ActionExample1.java Inherits from CloseableFrame.java and uses SetSizeButton.java.     * ActionExample2.java Inherits from CloseableFrame.java.     ********************************************************** ActionExample1.java ******************* import java.awt.*; public class ActionExample1 extends CloseableFrame {   public static void main(String[] args) {     …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/handling-events/

A Frame that uses the Confirm dialog to verify quit

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ConfirmTest.java **************** import java.awt.*; import java.awt.event.*; /** A Frame that uses the Confirm dialog to verify that  *  users really want to quit.  *   public class ConfirmTest extends Frame {   public static void main(String[] …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/a-frame-that-uses-the-confirm-dialog-to-verify-quit/

CircleDrawer3.java Applet that uses a named nested class to handle mouse events and draw circles. Illustrates third approach to event-handling with listeners: using inner classes.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; import java.awt.event.*; /** Draw circles centered where the user clicks.  *  Uses named inner classes.  *    ****************** public class CircleDrawer3 extends Applet {   public void init() {     setForeground(Color.blue);     …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/circledrawer3-java-applet-that-uses-a-named-nested-class-to-handle-mouse-events-and-draw-circles-illustrates-third-approach-to-event-handling-with-listeners-using-inner-classes/

Applet handle mouse events

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ClickReporter.java A simple applet that uses the class to handle mouse events import java.applet.Applet; import java.awt.*; /** Prints a message saying where the user clicks. * Uses an external listener. * public class ClickReporter extends Applet …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/applet-handle-mouse-events/

Custom AWT Slider

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ***************** Custom AWT Slider     * LabeledCostSlider.java. A numeric slider class with attached label.     * CostSlider.java. A slider class that lets you read numeric values. Used in the LabeledCostSlider class.     * Slider.java. A slider …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/custom-awt-slider/

Layout of a complicated GUI interface with GridLayout

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ################################## GridBagTest.java Layout of a complicated GUI interface with GridLayout. Uses WindowUtilities.java and ExitListener.java. ################################## import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; /** An example demonstrating a GridBagLayout GUI with  *  input text …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/layout-of-a-complicated-gui-interface-with-gridlayout/

TextAreas

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– TextAreas.java ************** import java.applet.Applet; import java.awt.*; /././././././,/././././ public class TextAreas extends Applet {   public void init() {     setBackground(Color.lightGray);     add(new TextArea(3, 10));     add(new TextArea(“Some\nInitial\nText”, 3, 10));   } }

Permanent link to this article: https://bangla.sitestree.com/textareas/

Lists.java

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Lists.java Inherits from CloseableFrame.java. /./././././././././ import java.awt.*; /*****************/ public class Lists extends CloseableFrame {   public static void main(String[] args) {     new Lists();   }   public Lists() {     super(“Lists”);     setLayout(new FlowLayout());     …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/lists-java/

ChoiceTest

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; /*******/ public class ChoiceTest extends Applet {   private Choice choice;   public void init() {     setFont(new Font(“SansSerif”, Font.BOLD, 36));     choice = new Choice();     choice.addItem(“Choice 1”);     choice.addItem(“Choice 2”); …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/choicetest/

ButtonExample.java Uses the following

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /./././././././././ # ButtonExample.java Uses the following classes:     * CloseableFrame.java     * FgReporter.java     * BgReporter.java     * SizeReporter.java ****************** ButtonExample.java ****************** import java.awt.*; import java.awt.event.*; /././././././././././ public class ButtonExample extends CloseableFrame {   public static …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/buttonexample-java-uses-the-following/

Uses a FileDialog to choose the file to display

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– DisplayFile.java **************** import java.awt.*; import java.awt.event.*; import java.io.*; /** Uses a FileDialog to choose the file to display.  ***************   public class DisplayFile extends CloseableFrame                          implements ActionListener {                                    public static void main(String[] …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/uses-a-filedialog-to-choose-the-file-to-display/

Applet that uses a anonymous nested class to handle mouse events and draw circles. Variation on third approach to event-handling: using inner classes.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; import java.awt.event.*; /** Draw circles centered where the user clicks.  *  Uses anonymous inner classes.  *   ********************** public class CircleDrawer4 extends Applet {   public void init() {     setForeground(Color.blue);     …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/applet-that-uses-a-anonymous-nested-class-to-handle-mouse-events-and-draw-circles-variation-on-third-approach-to-event-handling-using-inner-classes/

Tiny applet that uses CircleListener to handle mouse events.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; /** Draw circles centered where the user clicks.  *  Uses an external listener.  *    *********** public class CircleDrawer1 extends Applet {   public void init() {     setForeground(Color.blue);     addMouseListener(new CircleListener()); …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/tiny-applet-that-uses-circlelistener-to-handle-mouse-events/

Subclass of MouseAdapter

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– !!!!!!!!!!!! ClickListener.java A simple subclass of MouseAdapter that reports where the mouse was pressed. When attached to an applet, look for the report in the Java Console. !!!!!!!!!!!! import java.awt.event.*; /** The listener used by ClickReporter. …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/subclass-of-mouseadapter/

Create PopupMenu and add MenuItems

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; import java.awt.event.*; ************************ /** Simple demo of pop-up menus.  *  ******************** public class ColorPopupMenu extends Applet                             implements ActionListener {  private String[] colorNames =    { “White”, “Light Gray”, “Gray”, “Dark Gray”, …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/create-popupmenu-and-add-menuitems/

ReverseLabels.java Inherits from CloseableFrame.java and uses ReversibleLabel.java.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ReverseLabels.java Inherits from CloseableFrame.java and uses ReversibleLabel.java. ********************** ReverseLabels.java ********************** import java.awt.*; ****************** public class ReverseLabels extends CloseableFrame {   public static void main(String[] args) {     new ReverseLabels();   }   public ReverseLabels() {     …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/reverselabels-java-inherits-from-closeableframe-java-and-uses-reversiblelabel-java/

TextFields

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– import java.applet.Applet; import java.awt.*; /** A TextField from each of the four constructors.  *  ********************* public class TextFields extends Applet {   public void init() {     add(new TextField());     add(new TextField(30));     add(new TextField(“Initial String”)); …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/textfields/

ChoiceTest2

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ChoiceTest2.java /././././././././ import java.applet.Applet; import java.awt.*; import java.awt.event.*; /***********************/ public class ChoiceTest2 extends Applet                          implements ItemListener {   private Choice choice;   public void init() {     setFont(new Font(“SansSerif”, Font.BOLD, 36));     choice = new …

Continue reading

Permanent link to this article: https://bangla.sitestree.com/choicetest2/

Load more