Java network chat Applet
This applet simulates a network chat, in which the user chats with someone over a network. Here, there is no network. The partner is simulated by a thread that emits strings at random. The point of the simulation is to show how to use a separate thread for receiving information. The applet has an input [...]
Bank Operations using Threads in Java
Bank Operation demo that uses Bank, Clerk and Account and Transaction objects to complete the operation. Actually this demo shows how you can use threads to perform the tasks intheir own capicity and utilise the maximum system resopurces. What we do is, we have two clerks and they will do the work seperately from each [...]
Client Server in Java
Set up a Server that will receive packets from a client and send packets to a client. Also set up a Client that will send packets to a server and receive packets from a server. /******************************************************* * MYCPLUS Sample Code – http://www.mycplus.com * * * * This code is made available as a service to [...]
Demonstration of the try-catch-finally
This is a demonstration of the try-catch-finally exception handling mechanism in java programming language. It shows different mechanisms on how to handle exceptions, catch errors and show error messages. /******************************************************* * MYCPLUS Sample Code – http://www.mycplus.com * * * * This code is made available as a service to our * * visitors and is [...]
Console Based Java Calculator
This is a small Console Based Java Calculator that can add, subtract , divide and multiply two numbers. Find the square root of a number, cube of a number, nth Power of a number. It is very for the begnners of Java. /******************************************************* * MYCPLUS Sample Code – http://www.mycplus.com * * * * This code [...]
Text Tool
Text Tool /******************************************************* * MYCPLUS Sample Code – http://www.mycplus.com * * * * This code is made available as a service to our * * visitors and is provided strictly for the * * purpose of illustration. * * * * Please direct all inquiries to saqib at mycplus.com * *******************************************************/ import java.awt.*; import java.awt.event.*; [...]
Moving ball applet – Java
An object of type MovingBall holds data about a “ball” that has a color, radius, position, speed, and direction. The ball is restricted to moving around inside a rectangle in the xy-plane. The ball can draw itself in a graphics context and will move when it is told to move. This class uses some trigonometry [...]
Laout managers applet demo
This applet demonstrates various layout managers. The applet itself uses a border layout with a JPanel in the center, a JComboBox menu to the North, and a JLabel to the south. The center panel uses a CardLayout. Each card in the card layout contains a number of buttons and uses a different layout manager. The [...]