Category: Source Code: Programing Source Code

Simple Mouse Tracker GUI using Java Swing

This Java source code defines a simple mouse tracking program using Swing which is a graphical user interface toolkit. The program displays a window with a drawing surface that captures and visualizes various mouse events. The mouse’s current coordinates, modifier keys (Shift, Control, Meta, and Alt), and the type of the most recent mouse event are displayed in real-time on the window.

Read More

Interactive Java Stopwatch Component

The StopWatch class introduces a versatile stopwatch component with enhanced functionality in Java. Extending JLabel and implementing the MouseListener interface, this interactive component not only measures elapsed time but also dynamically updates to display the current time in the format “Hours:Minutes:Seconds:Milliseconds”.

Read More

Towers of Hanoi Java Program

This Java Program solves the Towers of Hanoi problem for a tower of 10 disks. Ten differently-sized disks are stacked in a pile, in order of decreasing size. There are two other places for piles. The object is to move the pile to the second available place, subject to the rules that only one disk at a time can be moved, and no disk can be piled on top of a smaller disk. The Towers of Hanoi problem is a standard example of recursion.

Read More

Java Swing GUI Example Program

This Java source code is an example of a Graphical User Interface (GUI) with different GUI elements such as TextBox, Buttons, TextArea, Text Area and Labels. It is implemented using Java Swing API which provides a set of “lightweight” (all-Java language) components. This code example extends the functionality of JFrame class to show a JFrame window and Implements ActionListener on buttons to catch the click event on those buttons.

Read More

Java Calculator Program with AWT and Swing Based GUI

This Java source code implements a basic calculator with a graphical user interface (GUI) using AWT and Swing. The program is structured in a way that makes it suitable for novice programmers to understand and learn about GUI development in Java. It serves as an excellent starting point for those looking to explore basic GUI applications and understand the principles of event-driven programming.

Read More

Simple Java Contact Form

The following Java code defines a simple GUI application using Swing. It creates a form with text fields for name and email, a text area for messages, and actions buttons for OK and Cancel operations. Additionally, there is a button to change the background color of the form.

Read More