Java

Java Servlets

An alternate form of server-side computation that uses Java. The Web server is extended to support an API, and then Java programs use the API to create dynamic web pages. Using Java servlets provides a platform-independent replacement for CGI scripts. Servlets can be embedded in many different servers because the servlet API, which you use […]






Java

Java RMI Example

TO execute Java RMI Program, follow below steps. 1. Create a file called “HelloWorldRMIServer.java” as following code. import java.rmi.*; import java.rmi.server.UnicastRemoteObject; public class HelloWorldRMIServer { public static void main(String[] argv) { System.setSecurityManager(new RMISecurityManager()); try { HelloWorldRMIImpl implementation = new HelloWorldRMIImpl (“HelloWorldRMIImplInstance”, “Hello World! from Java RMI Server machine-MITindia”); } catch (Exception e) { System.out.println(“Exception occurred: […]






Java

Java RMI

RMI : Remote Method Invocation Why distributed object system.? Large problems can be solved easily if they are split among two or more people. Distributed computing helps to solve large problems by splitting them. The split components are kept in different computers. Objects on remote systems can be accessed with the same ease as those […]






Java

Java Swing

Java Foundation Classes extends Abstract Window ToolKit(AWT) and contains improved user interface called the Swing Components. A container object is a component that can contain other Swing components. A container is responsible for laying the components that it contains. Commonly used containers are JFrame, JPanel andJScrollPane. A component is placed on a user interface and […]






Java

Applet Examples

Creating first java applet program to display simple strings. import java.applet.Applet; import java.awt.*; /*<applet code=app.class width=200 height=200> </applet> */ public class app extends Applet { String str,str2; public void init() { str=”Hello to applet Programming”; str2=”Hello to applet Programming”; } public void paint(Graphics g) { g.drawString(str, 10, 10); g.drawString(str2, 10, 30); g.drawString(“hello to MIT India”, […]






Java

Java Applet programming

The Abstract Window Toolkit (AWT) is a set of Java classes that allow the programmer to create a Graphical User Interface (GUI) and accept user input through the keyboard and the mouse. They are heavyweight components of Java Foundation Classes (JFC). The java.awt package contains all classes for creating user interfaces and for painting graphics […]






Java

File Handling in Java

File is a collection of bytes stored in secondary storage device i.e. disk. Thus, File handling is used to read, write, append or update a file without directly opening it. Types of File: Text File Binary File Text File contains only textual data. Text files may be saved in either a plain text (.TXT) format […]






Java

JDBC Example using Forms

JDBC Program to Insert a record to database using Forms. import javax.swing.*; import java.awt.*; import java.io.*; import java.awt.event.*; import java.sql.*; class Form extends JFrame { JButton ADD; JPanel panel; JLabel label1,label2,label3,label4,label5; final JTextField text1,text2,text3,text4,text5; Form() { label1 = new JLabel(); label1.setText(“UserID:”); text1 = new JTextField(20); label2 = new JLabel(); label2.setText(“First Name:”); text2 = new JTextField(20); […]






Java

JDBC Example3

JDBC Example to show records on JTable import java.awt.*; import java.sql.*; import java.util.*; import javax.swing.*; import java.awt.event.*; import javax.swing.table.*; public class JTableDatabase { public static void main(String[] args) { Vector columnNames = new Vector(); Vector data = new Vector(); JPanel p=new JPanel(); try { Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”); Connection con = DriverManager.getConnection(“jdbc:odbc:test”); String sql = “Select * from […]






Java

Java swing with Database connection

Here is a Java swing program to do all database operation (insert/delete/update) import javax.swing.*; import java.awt.*; import java.sql.*; import java.awt.event.*; import java.applet.*; public class JDBCAllinOne implements ActionListener { JLabel lblFname,lblLname,lblAddress,lblSalary,lblf,lbll,lbla,lbls; JLabel lblfVal,lbllVal,lblaVal,lblsVal; JTextField txtFname,txtLname,txtAddress,txtSalary; JButton btnInsert,btnUpdate,btnDelete,btnPrev,btnNext,btnClear; ResultSet rs ; public static void main(String[] args) { JDBCAllinOne obj = new JDBCAllinOne(); obj.createUI(); } private void createUI() […]






Java

JDBC Examples

JDBC or Java Data Base Connectivity – provides an interface to Relational Data Sources JDBC library provides the means for executing SQL statements to access and operate on a relational database JDBC library is implemented in the java.sql package Set of classes and interfaces that provide a uniform API for access to broad range of […]