Example Java code to create Applet

Creates Java Applet for information to be displayed in.


package ws;  //Comment out or replace with own package declaration
//import com.sap.mw.jco.*;
import javax.swing.*;          //This is the final package name.
//import com.sun.java.swing.*; //Used by JDK 1.2 Beta 4 and all
			       //Swing releases before Swing 1.1 Beta 3.
import java.awt.*;
import java.awt.event.*;
//import java.applet.Applet;
//import java.util.*;
public class CallSapApplet extends JApplet  implements ActionListener, ItemListener {
	JLabel valueLabel, convertedValueLabel;
	JTextField valueField, convertedValueField;
	JButton convertButton, restartButton;
	
	public void init() {
		Container container = getContentPane(); //.add(contents, BorderLayout.CENTER);	
		container.setLayout(new FlowLayout());
					
		
//		Create the top-level container and add contents to it.
		JFrame frame = new JFrame("SwingApplication");
		CallSapFunc app = new CallSapFunc();
		CallSapSwing swingapp = new CallSapSwing(app.myArrList);
		Component contents = swingapp.createComponents();
		container.add(contents, BorderLayout.CENTER);					
	}
	
	
	public void itemStateChanged(ItemEvent ie) {
	}
	public void actionPerformed(ActionEvent ea) {
	}
}


Related Articles

Using the Java connector (JCo) to retrieve data from an SAP system
Example JCo code to call SAP function module
Call an SAP function module and display data in a swing application
Applet to retrieve data from SAP(using JCo) and display it using Swing
Application to retrieve data from SAP(using JCo) and display it using Swing
Example JCo code to call SAP function module
Java class to create Swing Application from Array of data
Example JCo code to call SAP function module
Example Swing code to display list of material numbers