TYBSC Computer Science – Group II (Advanced Java) (List of Suggested Practicals) A.

Developing GUI applications using Swing
1. Write a program to create a form to enter bio-data of student. Use various components such as JLabel, JButton, JTextField, JTextArea, JComboBox, JTable, JScrollPane, JOptionButton, and JCheckBox. Use GridBagLayout and GridBagConstraints to lay the components. 2. Write a Java program to create a “ShapeToolbar”. This toolbar must contain buttons with shape images. On clicking the button on Toolbar, a respective shape should be displayed. 3. ((Creating MDI Form in SWING) Design a class, which extends JFrame and has three objects of three classes whose name are ColorPanel, CitiesPanel, and FlavourPanel. All the three classes (ColorPanel: Names of colors inside it, CitiesPanel: Names of cities inside it, and FlavourPanel- Names of Icecream flavours) extend JInternalFrame and have a method, which makes the Panel visible. The main JFrame has an object of JDesktopPane and this object holds the three panels, which are displayed on the click of the menu bar item. 4. Write a Java program to create print dialog and prints the text "Hello World" to the selected printer. 5. Use the JColorChooser and JFileChooser class to provide users with a palette of colors to choose from and some text file. Contents of the selected text file should be displayed in the selected color.

B. Database Programming with Java
1. Display all records of given table on console. 2. Write a Java application to insert, delete, update, list records using GUI components with appropriate message to user. 3. Design a database with two tables having parent-child relationship. Use MS Access. Select suitable key value from Parent table. Show all associated records from child table. 4. Create a JFrame, which will add data of Friends (Name, DOB, Address and Tel. No.) to the database and on click of “Show All” button, display the records from the database. 5. Create suitable database for Payroll calculation. Use store procedure to calculate Gross Pay, Total Deductions and Net Pay for all employees.

1

C. Study of Multithreading
1. Create an animation with a single line, which changes its position in a clock-wise direction. This line should produce an effect of a spinning line. In the same example give option for clock-wise or anti-clock-wise spinning. Demonstrate the animation on the screen. 2. Write a Java program to synchronize three threads. 3. Write a Java program to implement a producer and consumer problem. 4. Develop an applet that creates a thread that scrolls the message right to left across the applet's window. 5. Consider any five images. Display these images in rotation in a panel/frame. Image should change after 5 seconds.

D. Study of Socket programming and Distributed computing
1. Define a class to download a file from the Internet and either copy it as a file on the local machine, or output it to the screen. 2. Write a Java Client/Server application, where client will send positive integer to server and servers responds by finding factorial of that number. 3. Write a Java Chat application between client and server. 4. Create RMI application, which calculates the square root of a number using a remote method. 5. The server receives a request from a client, processes it, and returns a result. In this example, the request specifies two numbers. The server adds these together and returns the sum.

E. Server-Side Programming using Servlets
1. Write a Servlet which will display the current time of server in the client. 2. Write a Servlet which will display “Hi World!” message. Also display the counter showing number of time the servlet was requested. 3. Write a servlet that accepts single-valued as well as multi-valued parameters like check boxes and multiple selection list boxes from an HTML document and outputs them to the screen. 4. Write two servlets in which one servlet will display a form in which data entry can be done for the field’s dept-no, dept-name and location. In the same form place a button called as submit and on click of that button this record should be posted to the table called as DEPT in the database. This inserting of record should be done in another servlet. The second servlet should also display all the previous record entered in the database. 5. Write a Servlet that accepts name of an employee and basic salary from a HTML file and displays total salary along with basic. Write a code for HTML file. HRA, TA, DA and total salary are calculated as follows: HRA = 20% of basic TA = 15% of basic
2

DA = 10% of basic Total salary = basic + HRA + TA + DA.

F. Server-side programming using JSP
1. Write a JSP page to connect to a database and display the contents of a database table using the HTML TABLE tag. The column names should also be fetched from the database. 2. Write a JSP page, which displays three text boxes for user name, password, and email. On click of the submit button call another JSP page which will enter the values in the database with the help of PreparedStatement class. Also use jspInit() and jspDestroy() to open and close the connection. 3. Create a java bean that gives information about the current time. The bean has getter properties for time, hour, minute, and second. Write a JSP page that uses the bean and display all the information. 4. Create a multi-page registration form in which the user input is spread across 3 pages. The data is stored in the session with the help of Java Beans. After all the information is entered, read the contents of the java bean and display the contents on a new page. 5. Develop a bookstore application using several custom tags.

G. Developing Enterprise Java Beans
1. Develop “Converter” Stateless Session Bean. Write Enterprise application for converting Japanese yen currency to Eurodollars currency. converter consists of an enterprise bean, which performs the calculations, and two types of clients: an application client and a web client. 2. The cart session bean represents a shopping cart in an online bookstore. The bean’s client can add a book to the cart, remove a book, or retrieve the cart’s contents, using Session bean class and Remote business interface 3. Develop SimpleMessageApp application with following components: • SimpleMessageClient: An application client that sends several messages to a queue • SimpleMessageEJB: A message-driven bean that asynchronously receives and processes the messages that are sent to the queue. 4. Develop a simple inventory and ordering application for maintaining a catalog of parts and placing an itemized order of those parts. It has entities that represent parts, vendors, orders, and line items. These entities are accessed using a stateful session bean that holds the business logic of the application. A simple command-line client adds data to the entities, manipulates the data, and displays data from the catalog. 5. Develop the roster application to maintain the team rosters for players in recreational sports leagues. The application has four components: Java Persistence API entities (Player, Team, and League), a stateful session bean (RequestBean), an application client (RosterClient), and three helper classes (PlayerDetails, TeamDetails, and LeagueDetails).

3

H: Developing Web services in Java
1. Demonstrate a simple web service that generates a response based on information received from the client. HelloServiceBean is a stateless session bean that implements a single method, sayHello. 2. Develop web service for calculator applications, to implement simple arithmetic operations. Use WSDL for these web services to show output. 3. Develop web service for calculator applications, to implement simple arithmetic operations. Use these web services in client application. 4. Develop web service for checking whether a number is prime or not. Use this web service in JSP client. 5. Develop web service for finding GCD of two numbers. Use this web service in the client application using servlet.

4

Sign up to vote on this title
UsefulNot useful