Tag: code

CheckboxGroups

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– CheckboxGroups.java /./././././././././ ///////////////////// import java.applet.Applet; import java.awt.*; ////////////////////   public class CheckboxGroups extends Applet {   public void init() {     setLayout(new GridLayout(4, 2));     setBackground(Color.lightGray);     setFont(new Font(“Serif”, Font.BOLD, 16));     add(new Label(“Flavor”, Label.CENTER));     …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/checkboxgroups/

A textfield and three buttons arranged by a verticle BoxLayout

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– BoxLayoutTest.java A textfield and three buttons arranged by a verticle BoxLayout. Uses WindowUtilities.java and ExitListener.java. ################## import java.awt.*; import java.awt.event.*; import javax.swing.*; /** An example of BoxLayout.  *  *********** public class BoxLayoutTest extends JPanel                            implements …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/a-textfield-and-three-buttons-arranged-by-a-verticle-boxlayout/

Implementation of a simple browser in Swing (The user can specify a URL to load into the browser (JEditorPane))

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Browser.java Implementation of a simple browser in Swing. The user can specify a URL to load into the browser (JEditorPane). By attaching an Hyperlink Listener, the editor pane is responsive to hyperlinks selected by the user. …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/implementation-of-a-simple-browser-in-swing-the-user-can-specify-a-url-to-load-into-the-browser-jeditorpane/

A simple applet (JApplet) created in Swing.

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 javax.swing.*; /** Tiny example showing the main differences in using  *  JApplet instead of Applet: using the content pane,  *  getting Java (Metal) look and feel by default, and  *  having BorderLayout be …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/a-simple-applet-japplet-created-in-swing/

Illustrates the insertion of menu entries in Frame menu bars.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ************** ColorMenu.java ************** import java.awt.*; import java.awt.event.*; /** Illustrates the insertion of menu entries in Frame  *  menu bars.  *   public class ColorMenu extends CloseableFrame                        implements ActionListener {                            private String[] colorNames …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/illustrates-the-insertion-of-menu-entries-in-frame-menu-bars/

JTable Examples

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– # JTableSimpleExample.java Simple table that takes column names and data from arrays of Strings. import java.awt.*; import javax.swing.*; /** Simple JTable example that uses a String array for the  *  table header and table data.  * …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/jtable-examples/

Eight buttons: four each in two panels

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– mport java.applet.Applet; import java.awt.*; *************************** /** Eight buttons: four each in two panels. * */ public class ButtonTest2 extends Applet { public void init() { String[] labelPrefixes = { “Start”, “Stop”, “Pause”, “Resume” }; Panel p1 …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/eight-buttons-four-each-in-two-panels/

JList Examples

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– All examples, except for FileTransfer use WindowUtilities.java and ExitListener.java. WindowUtilities.java: import javax.swing.*; import java.awt.*;   // For Color and Container classes. /** A few utilities that simplify using windows in Swing.  *   */ public class WindowUtilities …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/jlist-examples/

Position circles down the diagonal so that their borders

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.applet.Applet; /** Position circles down the diagonal so that their borders  *  just touch. Illustrates that AWT components are  *  rectangular and opaque.   */ public class CircleTest2 extends Applet {   public …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/position-circles-down-the-diagonal-so-that-their-borders/

Insert three circles into an Applet using FlowLayout

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.applet.Applet; /** Insert three circles into an Applet using FlowLayout.  *  */ public class CircleTest extends Applet {   public void init() {     setBackground(Color.lightGray);     add(new Circle(Color.white, 30));     add(new Circle(Color.gray, 40)); …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/insert-three-circles-into-an-applet-using-flowlayout/

Message.java Applet that reads customization parameters from an HTML file

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ******************* Message.java Applet that reads customization parameters from an HTML file ******************* import java.applet.Applet; import java.awt.*; ****************   public class Message extends Applet {   private int fontSize;   private String message;     public void …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/message-java-applet-that-reads-customization-parameters-from-an-html-file/

Accesses methods in a Ship2 object

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ********************************************* Test2.java Accesses methods in a Ship2 object ********************************************* // Give the ship public move and printLocation methods. class Ship2 {   public double x=0.0, y=0.0, speed=1.0, direction=0.0;   public String name = “UnnamedShip”;   private …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/accesses-methods-in-a-ship2-object/

Placement of buttons in a BoxLayout using rigid areas, struts, and glue

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ############### InvisibleComponentTest.java Placement of buttons in a BoxLayout using rigid areas, struts, and glue ############### import java.awt.*; import javax.swing.*; import javax.swing.border.*; /** Example of using rigid areas, struts, and glue to  *  produce the effect of …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/placement-of-buttons-in-a-boxlayout-using-rigid-areas-struts-and-glue/

Adds typing to the 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.*; /** A better whiteboard that lets you enter  *  text in addition to freehand drawing.  *    ****************** public class Whiteboard extends SimpleWhiteboard {   protected FontMetrics fm;   public …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/adds-typing-to-the-freehand-drawing/

java Nested container where the top-level panels are positioned by hand

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ###################### ButtonCol.java Nested container where the top-level panels are positioned by hand ###################### import java.applet.Applet; import java.awt.*; /** An example of a layout performed manually. The top-level  *  panels are positioned by hand, after you determine …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/java-nested-container-where-the-top-level-panels-are-positioned-by-hand/

Layout of complicated GUI by taking advantage of nested containers

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ################# NestedLayout.java Layout of complicated GUI by taking advantage of nested containers. Uses WindowUtilities.java and ExitListener.java. ################## import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; /** An example demonstrating the use of …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/layout-of-complicated-gui-by-taking-advantage-of-nested-containers/

A demo providing multiple buttons to select a playing card-A Panel, using CardLayout control which of four possible subpanels, holding a different card, to display

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ####################### # CardDemo.java A demo providing multiple buttons to select a playing card. A Panel, using CardLayout control which of four possible subpanels, holding a different card, to display.Uses the following class and images:     * …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/a-demo-providing-multiple-buttons-to-select-a-playing-card-a-panel-using-cardlayout-control-which-of-four-possible-subpanels-holding-a-different-card-to-display/

BorderLayout divides the window into five regions

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– # BorderTest.java Five buttons arranged by BorderLayout BorderLayout divides the window into five regions: NORTH, SOUTH, EAST, WEST, and CENTER. /./././././././././././././ import java.applet.Applet; import java.awt.*; /** An example of BorderLayout.  *  &&&&&&&&&&&&&&&&&&&&&&&&&&& public class BorderTest extends …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/borderlayout-divides-the-window-into-five-regions/

Checkboxes

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

Continue reading

Permanent link to this article: http://bangla.sitestree.com/checkboxes/

Places a Panel holding 100 buttons in a ScrollPane

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.*; /** Places a Panel holding 100 buttons in a ScrollPane that is  *  too small to hold it.  *   */ public class ScrollPaneTest extends Applet {   public void init() { …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/places-a-panel-holding-100-buttons-in-a-scrollpane/

Five buttons arranged by FlowLayout

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– FlowTest.java ************* FlowTest.java Five buttons arranged by FlowLayout By default, FlowLayout arranges components in rows, left to right, and centered. /././././././././././././ import java.applet.Applet; import java.awt.*; /** FlowLayout puts components in rows.  *  ************************************ public class FlowTest …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/five-buttons-arranged-by-flowlayout/

A Frame that lets you draw circles with mouse clicks

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SavedFrame.java **************** A Frame that lets you draw circles with mouse clicks //************** import java.awt.*; import java.awt.event.*; import java.io.*; /** A Frame that lets you draw circles with mouse clicks  *  and then save the Frame …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/a-frame-that-lets-you-draw-circles-with-mouse-clicks/

FrameExample1.java and 2

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ****************** # FrameExample1.java ****************** import java.awt.*; /**  */ public class FrameExample1 {   public static void main(String[] args) {     Frame f = new Frame(“Frame Example 1”);     f.setSize(400, 300);     f.setVisible(true);   } } ********************* …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/frameexample1-java-and-2/

ThreadedRSAKey.java Illustrates converting a method in an existing class from a single-threaded method to a multi-threaded method.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ThreadedRSAKey.java  Illustrates converting a method in an existing class from a single-threaded method to a multi-threaded method. In this example, RSAKey  computes an RSA public-private key pair, where the key size has a specified number of …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/threadedrsakey-java-illustrates-converting-a-method-in-an-existing-class-from-a-single-threaded-method-to-a-multi-threaded-method/

Eight ungrouped buttons in an Applet using FlowLayout

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– mport java.applet.Applet; import java.awt. *; ************************** /** Eight ungrouped buttons in an Applet using FlowLayout. * */ public class ButtonTest1 extends Applet { public void init() { String[] labelPrefixes = { “Start”, “Stop”, “Pause”, “Resume” }; …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/eight-ungrouped-buttons-in-an-applet-using-flowlayout/

A Circle component built using a Canvas

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.*; /** A Circle component built using a Canvas.  *   */ public class Circle extends Canvas {   private int width, height;                    public Circle(Color foreground, int radius) {     setForeground(foreground); …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/a-circle-component-built-using-a-canvas/

Simplifies the setting of native look and feel

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– WindowUtilities.java Simplifies the setting of native look and feel. #################### import javax.swing.*; import java.awt.*;   // For Color and Container classes. /** A few utilities that simplify using windows in Swing.  * ################### public class WindowUtilities { …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/simplifies-the-setting-of-native-look-and-feel/

Using the this reference in class Ship3

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /./././././././././. // Give Ship3 a constructor to let the instance variables // be specified when the object is created. /./././././././././ class Ship3 {   public double x, y, speed, direction;   public String name;   public …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/using-the-this-reference-in-class-ship3/

DashedStrokeExample.java Draws a circle with a dashed line segment (border). 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– >>>>>>>>>>>>>>>>> import java.awt.*; /** An example of creating a custom dashed line for drawing.  *  ********************* public class DashedStrokeExample extends FontExample {   public void paintComponent(Graphics g) {     clear(g);     Graphics2D g2d = (Graphics2D)g;     …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/dashedstrokeexample-java-draws-a-circle-with-a-dashed-line-segment-border-inherits-from-fontexample-java/

draws a circle wherever mouse was pressed

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– CircleListener.java A subclass of MouseAdapter that draws a circle wherever mouse was pressed. Illustrates first approach to event-handling with listeners: attaching a separate listener *********** import java.applet.Applet; import java.awt.*; import java.awt.event.*; /** The listener used by …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/draws-a-circle-wherever-mouse-was-pressed/

Six buttons arranged in a 2 row x 3 column grid by GridLayout

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /././././././ GridTest.java Six buttons arranged in a 2 row x 3 column grid by GridLayout.GridLayout divides the window into equal-sized rectangles based upon the number of rows and columns specified. ****************** import java.applet.Applet; import java.awt.*; /** …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/six-buttons-arranged-in-a-2-row-x-3-column-grid-by-gridlayout/

ListEvent2.java

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– # ListEvents.java Uses the following classes:     * CloseableFrame.java     * SelectionReporter.java     * ActionReporter.java /././././././././././././ import java.awt.event.*; /././././././ public class ListEvents2 extends ListEvents {   public static void main(String[] args) {     new ListEvents2();   …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/listevent2-java/

A Frame that can actually quit

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 Frame that you can actually quit. Used as the starting  *  point for most Java 1.1 graphical applications.  * public class CloseableFrame extends Frame {   public CloseableFrame(String title) { …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/a-frame-that-can-actually-quit/

creating a simple Swing application using a JFrame

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– JFrameExample.java Demonstrates creating a simple Swing application using a JFrame. As with a JApplet, components must be added to the content pane, instead of the window directly.import java.awt.*; import javax.swing.*; /** Tiny example showing the main …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/creating-a-simple-swing-application-using-a-jframe/

Explicit placement of five buttons with the layout manager turned off

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– NullTest.java Explicit placement of five buttons with the layout manager turned off (set to null) ########################## import java.applet.Applet; import java.awt.*; /** Layout managers are intended to help you, but there  *  is no law saying you …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/explicit-placement-of-five-buttons-with-the-layout-manager-turned-off/

JTree Examples

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SimpleTree.java Basic tree built out of DefaultMutableTreeNodes. A DefualtMutableTreeNode is a starting point for a root node, in which children nodes can be added. import java.awt.*; import javax.swing.*; import javax.swing.tree.*; /** Example tree built out of …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/jtree-examples/

Printing in Java 2

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science–    *           o PrintExample.java Demonstrates printing a Graphics2D object. import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.print.*; /** An example of a printable window in Java 1.2. The key point  *  here is that any …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/printing-in-java-2/

BetterCircleTest.java

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ********************** BetterCircleTest.java ********************** import java.awt.*; import java.applet.Applet; /** Position circles down the diagonal so that their borders  *  just touch. Illustrates that Java 1.1 lightweight  *  components can be partially transparent.  *   */ public class …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/bettercircletest-java/

RMI Example – Numerical Integration, a more realistic RMI example that sends an evaluatable object (function) from a client to a server for numerical integration.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Integral.java  Performs actual numerical integration of the function (evaluatable object). /** A class to calculate summations and numeric integrals. The  *  integral is calculated according to the midpoint rule.  *  *  Taken from Core Web Programming …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/rmi-example-numerical-integration-a-more-realistic-rmi-example-that-sends-an-evaluatable-object-function-from-a-client-to-a-server-for-numerical-integration/

A JPanel that displays six radio buttons with labels.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– A JPanel that displays six radio buttons with labels. import java.awt.*; import javax.swing.*; /** A JPanel that displays six JRadioButtons.  *  *.  */ public class SixChoicePanel extends JPanel {   public SixChoicePanel(String title, String[] buttonLabels) { …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/a-jpanel-that-displays-six-radio-buttons-with-labels/

ThreadedEchoServer.java A multithreaded version of EchoServer, where each client request is serviced on a separate thread. Requires 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– import java.net.*; import java.io.*; /** A multithreaded variation of EchoServer.  *  *  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: http://bangla.sitestree.com/threadedechoserver-java-a-multithreaded-version-of-echoserver-where-each-client-request-is-serviced-on-a-separate-thread-requires-the-following-classes/

Implementing a Server : Network Server

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– NetworkServerTest.java  Establishes a network Server that listens for client requests on the port specified (command-line argument). Uses the following classes:   /** Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/implementing-a-server-network-server/

UrlTest.java Demonstrates the ease in which the various components of an URL can be determined (host, port, protocol, etc.)

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.*; /** Read a URL from the command line, then print  *  the various components.  *  *  Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,  *  .  *  © …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/urltest-java-demonstrates-the-ease-in-which-the-various-components-of-an-url-can-be-determined-host-port-protocol-etc/

Counter2Test.java Driver class that creates three threaded objects (Counter2) that count from 0 to 4.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** Try out a few instances of the Counter2 class. Driver class that creates three threaded objects (Counter2) that count from 0 to 4. In this case, the driver does not start the threads, as each …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/counter2test-java-driver-class-that-creates-three-threaded-objects-counter2-that-count-from-0-to-4/

Template illustrating the first approach for creating a class with thread behavior.

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 ThreadClass extends Thread …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/template-illustrating-the-first-approach-for-creating-a-class-with-thread-behavior/

Creates three radio buttons and illustrates handling

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– JRadioButtonTest.java Creates three radio buttons and illustrates handling ItemEvents in response to selecting a radio button. import javax.swing.JRadioButton; import javax.swing.ButtonGroup; import java.awt.*; import java.awt.event.*; import javax.swing.*; /**  */ public class JRadioButtonTest extends JPanel                               implements ItemListener …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/creates-three-radio-buttons-and-illustrates-handling/

Simple button that the user can select to load the entered URL.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– JIconButton.java A simple button that the user can select to load the entered URL. import javax.swing.*; /** A regular JButton created with an ImageIcon and with borders  *  and content areas turned off.  *   */ …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/simple-button-that-the-user-can-select-to-load-the-entered-url/

A simple button that contains an image and a label for use in a toolbar

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ToolBarButton.java A simple button that contains an image and a label for use in a toolbar. import java.awt.*; import javax.swing.*; /** Part of a small example showing basic use of JToolBar.  *  The point here is …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/a-simple-button-that-contains-an-image-and-a-label-for-use-in-a-toolbar/

Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference. The dialog returns a Color object based on the user’s selection or …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/demonstrates-the-use-of-a-jcolorchooser-which-presents-a-dialog-with-three-different-tabbed-panes-to-allow-the-user-to-select-a-color-preference-2/

Creates various buttons. In Swing

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 javax.swing.*; /** Simple example illustrating the use of JButton, especially  *  the new constructors that permit you to add an image.  *   */ public class JButtons extends JFrame {   public static …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/creates-various-buttons-in-swing/

Multithreaded Graphics and Double Buffering

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ShipSimulation.java  Illustrates the basic approach of multithreaded graphics whereas a thread adjusts parameters affecting the appearance of the graphics and then calls repaint to schedule an update of the display.   import java.applet.Applet; import java.awt.*; public …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/multithreaded-graphics-and-double-buffering/

Driver class that creates three threaded objects (Counter2) that count from 0 to 4.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** Try out a few instances of the Counter2 class. public class Counter2Test {   public static void main(String[] args) {     Counter2 c1 = new Counter2(5);     Counter2 c2 = new Counter2(5);     Counter2 c3 …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/driver-class-that-creates-three-threaded-objects-counter2-that-count-from-0-to-4/

Template illustrating the second approach for creating a class with thread behavior.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Template illustrating the second approach for creating a class with thread behavior. In this case, the class implements the Runnable interface while providing a run method for thread execution. public class ThreadedClass extends AnyClass implements Runnable …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/template-illustrating-the-second-approach-for-creating-a-class-with-thread-behavior/

Creates and starts three threaded objects

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Creates and starts three threaded objects which count from 0 to 4. Uses the following class: CounterTest.java Counter.java /** Try out a few instances of the Counter class. public class CounterTest { public static void main(String[] …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/creates-and-starts-three-threaded-objects/

DOM example that represents the basic structure of an XML document as a JTree

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– //XMLTree.java //Uses the following files Uses the following files:     * XMLFrame.java:Swing application to select an XML document and display in a JTree. ExtensionFileFilter.java Allows you to specify which file extensions will be displayed in a …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/dom-example-that-represents-the-basic-structure-of-an-xml-document-as-a-jtree/

Simple example illustrating the use of check boxes

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– JCheckBoxTest.java Simple example illustrating the use of check boxes. import javax.swing.*; import java.awt.event.*;  */ public class JCheckBoxTest extends JPanel                            implements ItemListener,                                       ActionListener{   JCheckBox checkBox1, checkBox2;       public JCheckBoxTest() {     checkBox1 …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/simple-example-illustrating-the-use-of-check-boxes/

Basic tool bar for holding multiple buttons.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– BrowserToolBar.java A basic tool bar for holding multiple buttons. import java.awt.*; import javax.swing.*; /** Part of a small example showing basic use of JToolBar.  *  Creates a small dockable toolbar that is supposed to look  *  …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/basic-tool-bar-for-holding-multiple-buttons/

Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Demonstrates the use of a JColorChooser which presents a dialog with three different tabbed panes to allow the user to select a color preference. The dialog returns a Color object based on the user’s selection or …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/demonstrates-the-use-of-a-jcolorchooser-which-presents-a-dialog-with-three-different-tabbed-panes-to-allow-the-user-to-select-a-color-preference/

WebClient – Client application that can talk interactively to Web servers. Requires the components listed below

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.*; // For BorderLayout, GridLayout, Font, Color. import java.awt.event.*; import java.util.*; import javax.swing.*; /** A graphical client that lets you interactively connect to  *  Web servers and send custom request lines and  *  request headers. …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/webclient-client-application-that-can-talk-interactively-to-web-servers-requires-the-components-listed-below/

EchoServer.java A simple HTTP server that creates a Web page showing all data sent from the client (browser), including all HTTP request headers sent form the client. 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– EchoServer.java  A simple HTTP server that creates a Web page showing all data sent from the client (browser), including all HTTP request headers sent form the client. Uses the following classes:   import java.net.*; import java.io.*; …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/echoserver-java-a-simple-http-server-that-creates-a-web-page-showing-all-data-sent-from-the-client-browser-including-all-http-request-headers-sent-form-the-client-uses-the-following-classes/

StoppableThread.java A template to place a thread in a RUN, WAIT, or STOP state.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– /** A template to control the state of a thread through setting  *  an internal flag. public class StoppableThread extends Thread {    public static final int STOP    = 0;    public static final int RUN     …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/stoppablethread-java-a-template-to-place-a-thread-in-a-run-wait-or-stop-state/

mall example showing the basic use of a JToolBar

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– mall example showing the basic use of a JToolBar import java.awt.*; import javax.swing.*; import java.awt.event.*; /** Small example showing basic use of JToolBar.  *  *  */ public class JToolBarExample extends JFrame                              implements ItemListener {   …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/mall-example-showing-the-basic-use-of-a-jtoolbar/

UrlRetriever2.java Illustrates how the URL class can simplify communication to an HTTP server.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– UrlRetriever2.java  Illustrates how the URL class can simplify communication to an HTTP server. import java.net.*; import java.io.*; /** Read a remote file using the standard URL class  *  instead of connecting explicitly to the HTTP server. …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/urlretriever2-java-illustrates-how-the-url-class-can-simplify-communication-to-an-http-server/

RMI Example – Message, illustrates retrieving a message from an object located on a remote server. Requires 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– Rem.java  Establishes which methods the client can access in the remote object. import java.rmi.*; /** The RMI client will use this interface directly. The RMI  *  server will make a real remote object that implements this, …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/rmi-example-message-illustrates-retrieving-a-message-from-an-object-located-on-a-remote-server-requires-the-following-classes/

Creates three common types of sliders

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Creates three common types of sliders: one without tick marks, one with tick marks, and one with both tick marks and labels. import java.awt.*; import javax.swing.*; /** Simple example illustrating the use of JSliders, especially  *  …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/creates-three-common-types-of-sliders/

Basic Swing Details

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– WindowUtilities.java Utility class that simplifies creating a window and setting the look and feel. ExitListener.java A WindowListener with support to close the window. JAppletExample.java A simple applet (JApplet) created in Swing. Illustrates setting the look and …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/basic-swing-details/

AddressVerifier.java Connects to an SMTP server and issues a expn request to display details about a mailbox on the server. 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– import java.net.*; import java.io.*; /** Given an e-mail address of the form user@host,  *  connect to port 25 of the host and issue an  *  ‘expn’ request for the user. Print the results.  *  *  Taken …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/addressverifier-java-connects-to-an-smtp-server-and-issues-a-expn-request-to-display-details-about-a-mailbox-on-the-server-uses-the-following-classes/

Buggy Counter Applet.java Demonstrates that data shared by multiple threads is candidate for a potential race condition

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.*; /** Emulates the Counter and Counter2 classes, but this time  *  from an applet that invokes multiple versions of its own run  *  method. This version is likely to work correctly  *  …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/buggy-counter-applet-java-demonstrates-that-data-shared-by-multiple-threads-is-candidate-for-a-potential-race-condition/

SplitTest.java Illustrates parsing a string with a String.split

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SplitTest.java Illustrates parsing a string with a String.split /** Prints the tokens resulting from treating the first * command-line argument as the string to be tokenized * and the second as the delimiter set. Uses * …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/splittest-java-illustrates-parsing-a-string-with-a-string-split/

TokTest.java Illustrates parsing a string with a StringTokenizer.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– TokTest.java  Illustrates parsing a string with a StringTokenizer. import java.util.StringTokenizer; /** Prints the tokens resulting from treating the first  *  command-line argument as the string to be tokenized  *  and the second as the delimiter set. …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/toktest-java-illustrates-parsing-a-string-with-a-stringtokenizer/

NetworkClientTest.java Makes a simple connection to the host and port specified on the command line. 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– NetworkClientTest.java  Makes a simple connection to the host and port specified on the command line. Uses the following classes: /** Make simple connection to host and port specified.  *  *  Taken from Core Web Programming from …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/networkclienttest-java-makes-a-simple-connection-to-the-host-and-port-specified-on-the-command-line-uses-the-following-classes/

ShowSession.java Servlet that uses session tracking to determine if the client is a repeat visitor. Uses the ServletUtilities class to simplify the DOCTYPE and HEAD output.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ShowSession.java Servlet that uses session tracking to determine if the client is a repeat visitor. Uses the ServletUtilities class to simplify the DOCTYPE and HEAD output. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.net.*; …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/showsession-java-servlet-that-uses-session-tracking-to-determine-if-the-client-is-a-repeat-visitor-uses-the-servletutilities-class-to-simplify-the-doctype-and-head-output/

LongLivedCookie.java Subclass of Cookie that automatically sets the max age to one year.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– LongLivedCookie.java  Subclass of Cookie that automatically sets the max age to one year. package cwp; import javax.servlet.http.*; /** Cookie that persists 1 year. Default Cookie doesn’t  *  persist past current session.  *    *  Taken from …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/longlivedcookie-java-subclass-of-cookie-that-automatically-sets-the-max-age-to-one-year/

SearchEngines.java Servlet that redirects requests to various search engines. Uses the SearchSpec helper class. Accessed by means of SearchEngines.html.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SearchEngines.java  Servlet that redirects requests to various search engines. Uses the SearchSpec  helper class. Accessed by means of SearchEngines.html. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.net.*; /** Servlet that takes a search string, …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/searchengines-java-servlet-that-redirects-requests-to-various-search-engines-uses-the-searchspec-helper-class-accessed-by-means-of-searchengines-html/

SetCookies.java Servlet that sets a few persistent and session cookies. Uses the ServletUtilities class to simplify the DOCTYPE and HEAD output.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SetCookies.java  Servlet that sets a few persistent and session cookies. Uses the ServletUtilities  class to simplify the DOCTYPE and HEAD output.   package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Sets six cookies: three that …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/setcookies-java-servlet-that-sets-a-few-persistent-and-session-cookies-uses-the-servletutilities-class-to-simplify-the-doctype-and-head-output/

EncodedPage.java Servlet that shows the bandwidth benefits of gzipping pages to browsers that can handle gzip. Uses the ServletUtilities class to simplify the DOCTYPE and HEAD output.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– EncodedPage.java  Servlet that shows the bandwidth benefits of gzipping pages to browsers that can handle gzip. Uses the ServletUtilities  class to simplify the DOCTYPE and HEAD output. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/encodedpage-java-servlet-that-shows-the-bandwidth-benefits-of-gzipping-pages-to-browsers-that-can-handle-gzip-uses-the-servletutilities-class-to-simplify-the-doctype-and-head-output/

PrimeNumbers.java Servlet that processes a request to generate n prime numbers, each with at least m digits. If these results are not complete, it sends a Refresh header instructing the browser to ask for new results a little while later. Uses the Primes

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– PrimeNumbers.java  Servlet that processes a request to generate n prime numbers, each with at least m digits. If these results are not complete, it sends a Refresh header instructing the browser to ask for new results …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/primenumbers-java-servlet-that-processes-a-request-to-generate-n-prime-numbers-each-with-at-least-m-digits-if-these-results-are-not-complete-it-sends-a-refresh-header-instructing-the-browser-to-ask/

ShowRequestHeaders.java Servlet that shows all request headers sent by browser in current request.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ShowRequestHeaders.java Servlet that shows all request headers sent by browser in current request. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; /** Shows all the request headers sent on this request. * * Taken …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/showrequestheaders-java-servlet-that-shows-all-request-headers-sent-by-browser-in-current-request/

ServletUtilities.java Utility class that, among other things, contains the static filter method that replaces special HTML characters with their HTML character entities.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ServletUtilities.java  Utility class that, among other things, contains the static filter  method that replaces special HTML characters with their HTML character entities. package cwp; import javax.servlet.*; import javax.servlet.http.*; /** Some simple time savers. Note that most …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/servletutilities-java-utility-class-that-among-other-things-contains-the-static-filter-method-that-replaces-special-html-characters-with-their-html-character-entities/

ThreeParams.java Servlet that reads and displays three request (form) parameters. Uses the ServletUtilities class.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ThreeParams.java  Servlet that reads and displays three request (form) parameters. Uses the ServletUtilities  class. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Simple servlet that reads three parameters from the  *  form data.  *   …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/threeparams-java-servlet-that-reads-and-displays-three-request-form-parameters-uses-the-servletutilities-class/

ShowMessage.java Servlet that demonstrates the use of initialization parameters.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ShowMessage.java  Servlet that demonstrates the use of initialization parameters. Remember that, to use this servlet, you have to do three things:     * Put the modified web.xml file in the WEB-INF directory.     * Restart the …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/showmessage-java-servlet-that-demonstrates-the-use-of-initialization-parameters/

ServletUtilities.java Utility class that simplifies the output of the DOCTYPE and HEAD in servlets, among other things. Used by most remaining servlets in the chapter.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ServletUtilities.java  Utility class that simplifies the output of the DOCTYPE and HEAD  in servlets, among other things. Used by most remaining servlets in the chapter. package cwp; import javax.servlet.*; import javax.servlet.http.*; /** Some simple time savers. …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/servletutilities-java-utility-class-that-simplifies-the-output-of-the-doctype-and-head-in-servlets-among-other-things-used-by-most-remaining-servlets-in-the-chapter/

SimplerHelloWWW.java Servlet that uses ServletUtilities to simplify the generation of the DOCTYPE and HEAD part of the servlet.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– SimplerHelloWWW.java  Servlet that uses ServletUtilities  to simplify the generation of the DOCTYPE and HEAD part of the servlet. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Simple servlet that generates HTML. This variation of  *  …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/simplerhellowww-java-servlet-that-uses-servletutilities-to-simplify-the-generation-of-the-doctype-and-head-part-of-the-servlet/

HelloWWW.java Servlet that generates HTML. This and all remaining servlets are in the cwp package and therefore should be installed in the cwp subdirectory.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– HelloWWW.java  Servlet that generates HTML. This and all remaining servlets are in the cwp package and therefore should be installed in the cwp subdirectory. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Simple servlet that …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/hellowww-java-servlet-that-generates-html-this-and-all-remaining-servlets-are-in-the-cwp-package-and-therefore-should-be-installed-in-the-cwp-subdirectory/

ServletTemplate.java Starting point for servlets.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ServletTemplate.java Starting point for servlets. import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Servlet template.  *    *  Taken from Core Web Programming Java 2 Edition  *  from Prentice Hall and Sun Microsystems Press,  *  .  *  …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/servlettemplate-java-starting-point-for-servlets/

StringBean.java Bean used to demonstrate jsp:useBean, etc. Remember to install it in the WEB-INF/classes/cwp directory.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– StringBean.java  Bean used to demonstrate jsp:useBean, etc. Remember to install it in the WEB-INF/classes/cwp directory. package cwp; /** A simple bean that has a single String property  *  called message.  *  <P>  *  Taken from Core …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/stringbean-java-bean-used-to-demonstrate-jspusebean-etc-remember-to-install-it-in-the-web-infclassescwp-directory/

PluginApplet.jsp Page that demonstrates the use of jsp:plugin.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– PluginApplet.jsp  Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java  Since these are classes sent to the client to used by applets, the .class files should be …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/pluginapplet-jsp-page-that-demonstrates-the-use-of-jspplugin/

BGColor.jsp Page that demonstrates JSP scriptlets. Uses the JSP-Styles style sheet.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– BGColor.jsp  Page that demonstrates JSP scriptlets. Uses the JSP-Styles  style sheet. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!–     Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/bgcolor-jsp-page-that-demonstrates-jsp-scriptlets-uses-the-jsp-styles-style-sheet/

Excel.jsp Page that demonstrates the use of JSP to build Excel spreadsheets

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Excel.jsp  Page that demonstrates the use of JSP to build Excel spreadsheets First    Last    Email Address Marty    Hall    hall@corewebprogramming.com Larry    Brown    brown@corewebprogramming.com Bill    Gates    gates@sun.com Larry    Ellison    ellison@microsoft.com <%@ page contentType=”application/vnd.ms-excel” %> <%– There are tabs, …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/excel-jsp-page-that-demonstrates-the-use-of-jsp-to-build-excel-spreadsheets/

Expressions.jsp Page that demonstrates JSP expressions. Uses the JSP-Styles style sheet.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– Expressions.jsp  Page that demonstrates JSP expressions. Uses the JSP-Styles  style sheet. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of JSP Expressions.     Taken from Core Web Programming Java 2 Edition from Prentice Hall …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/expressions-jsp-page-that-demonstrates-jsp-expressions-uses-the-jsp-styles-style-sheet-2/

ImportAttribute.jsp Page that demonstrates the import attribute of the page directive. Uses the ServletUtilities class

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– ImportAttribute.jsp  Page that demonstrates the import attribute of the page directive. Uses the ServletUtilities class (Check Servlet Section) <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of the import attribute of the page directive. Taken …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/importattribute-jsp-page-that-demonstrates-the-import-attribute-of-the-page-directive-uses-the-servletutilities-class/

QueryViewer.java: An interactive database query viewer

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– # QueryViewer.java  An interactive database query viewer. Connects to the specified Oracle or Sybase database, executes a query, and presents the results in a JTable. Uses the following file:     * DBResultsTableModel.java Simple class that tells …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/queryviewer-java-an-interactive-database-query-viewer/

AccessCounts.jsp Page that demonstrates JSP declarations.

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

Continue reading

Permanent link to this article: http://bangla.sitestree.com/accesscounts-jsp-page-that-demonstrates-jsp-declarations/

PreparedStatements.java An example to test the timing differences resulting from repeated raw queries vs. repeated calls

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– package cwp; import java.sql.*; /** An example to test the timing differences resulting  *  from repeated raw queries vs. repeated calls to  *  prepared statements. These results will vary dramatically  *  among database servers and drivers. …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/preparedstatements-java-an-example-to-test-the-timing-differences-resulting-from-repeated-raw-queries-vs-repeated-calls/

EmployeeCreation.java: Make a simple “employees” table using the database utilities

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– package cwp; import java.sql.*; /** Make a simple “employees” table using DatabaseUtilities.  */ public class EmployeeCreation {   public static Connection createEmployees(String driver,                                            String url,                                            String username,                                            String password,                                            boolean close) { …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/employeecreation-java-make-a-simple-employees-table-using-the-database-utilities/

extract relevant data from a DBResults

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– # QueryViewer.java  An interactive database query viewer. Connects to the specified Oracle or Sybase database, executes a query, and presents the results in a JTable. Uses the following file:     * DBResultsTableModel.java Simple class that tells …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/extract-relevant-data-from-a-dbresults/

EmployeeTest2.java: A test case for the database utilities. Prints results formatted as an HTML table.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– package cwp; import java.sql.*; /** Connect to Oracle or Sybase and print “employees” table  *  as an HTML table.  *    */ public class EmployeeTest2 {   public static void main(String[] args) {     if (args.length …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/employeetest2-java-a-test-case-for-the-database-utilities-prints-results-formatted-as-an-html-table/

DBResults.java: Class to store completed results of a JDBC Query. Differs from a ResultSet in several ways

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– # DBResults.java  Class to store completed results of a JDBC Query. Differs from a ResultSet in several ways:     * ResultSet doesn?t necessarily have all the data; reconnection to database occurs as you ask for later …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/dbresults-java-class-to-store-completed-results-of-a-jdbc-query-differs-from-a-resultset-in-several-ways/

DatabaseUtilities.java: Several general-purpose utilities discussed and used in the chapter.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– package cwp; import java.sql.*; /** Three database utilities:  *   1) getQueryResults. Connects to a database, executes  *      a query, retrieves all the rows as arrays  *      of strings, and puts them inside a DBResults  *      object. …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/databaseutilities-java-several-general-purpose-utilities-discussed-and-used-in-the-chapter/

EmployeeTest.java: A test case for the database utilities. Prints results in plain text.

Huge Sell on Popular Electronics Subscribe to Our Youtube Channel –|–Our Online Shop:ShopForSoul–|Get Trained in AI, Big-Data, Data Science– package cwp; import java.sql.*; /** Connect to Oracle or Sybase and print “employees” table.  *    */ public class EmployeeTest {   public static void main(String[] args) {     if (args.length < 5) {       printUsage(); …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/employeetest-java-a-test-case-for-the-database-utilities-prints-results-in-plain-text/

Load more