Category: FromSitesTree.com

Excel.jsp Page that demonstrates the use of JSP to build Excel spreadsheets #Programming Code Examples #Java/J2EE/J2ME #JSP

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, not spaces, between columns. –%> Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10259 Categories:Programming …

Continue reading

PluginApplet.jsp Page that demonstrates the use of jsp:plugin. #Programming Code Examples #Java/J2EE/J2ME #JSP

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 in the same directory as the JSP page, not in the WEB-INF/classes directory where classes the server uses go. …

Continue reading

StringBean.java Bean used to demonstrate jsp:useBean, etc. Remember to install it in the WEB-INF/classes/cwp directory. #Programming Code Examples #Java/J2EE/J2ME #JSP

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 Web Programming Java 2 Edition * from Prentice Hall and Sun Microsystems Press, * . * May be freely …

Continue reading

Simplifies the setting of native look and feel #Programming Code Examples #Java/J2EE/J2ME #Layout Managers

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 { /** Tell system to use native look and feel, as in previous * releases. Metal (Java) LAF is the …

Continue reading

Expressions.jsp Page that demonstrates JSP expressions. Uses the JSP-Styles style sheet. #Programming Code Examples #Java/J2EE/J2ME #JSP

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 and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>JSP Expressions</TITLE> <META NAME="keywords" CONTENT="JSP,expressions,JavaServer,Pages,servlets"> <META NAME="description" …

Continue reading

JavaTextField.java #Programming Code Examples #Java/J2EE/J2ME #Mouse and Keyboard Events

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

Continue reading

An applet that permits freehand drawing #Programming Code Examples #Java/J2EE/J2ME #Mouse and Keyboard Events

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); setForeground(Color.blue); addMouseListener(new PositionRecorder()); addMouseMotionListener(new LineDrawer()); } protected void record(int x, int y) { lastX = x; lastY = y; } // Record position …

Continue reading

Five buttons arranged by FlowLayout #Programming Code Examples #Java/J2EE/J2ME #Layout Managers

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 extends Applet { public void init() { for(int i=1; i<6; i++) { add(new Button("Button " + i)); } } …

Continue reading

A textfield and three buttons arranged by a verticle BoxLayout #Programming Code Examples #Java/J2EE/J2ME #Layout Managers

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 ActionListener{ BoxLayout layout; JButton topButton, middleButton, bottomButton; public BoxLayoutTest() { layout = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(layout); JLabel label = new …

Continue reading

Explicit placement of five buttons with the layout manager turned off #Programming Code Examples #Java/J2EE/J2ME #Layout Managers

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 have to use them. * Set the layout to null to turn them off. * ******************* public class NullTest …

Continue reading