Skip to content

NadaMAlharbi/Java-Coding-Practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Coding Practice

This repository contains Java code files created during my early learning journey. All files are aimed at practicing and understanding basic to intermediate Java programming concepts. Each file reflects a step in exploring and experimenting with Java, covering foundational topics and exercises for learning purposes.

File Descriptions

  1. EventObject.java: Demonstrates handling action events in Java Swing. Contains three buttons, each displaying a message when clicked to indicate which button was pressed.

  2. ExceptionMessage.java: A program that prompts the user to enter a filename. It attempts to open the file and displays an error message if the file is not found.

  3. Fact.java: Calculates the factorial of a number using recursion. This program demonstrates basic recursion concepts by finding the factorial of a given integer.

  4. GridPanelWindow.java: Shows how to use a GridLayout in Java Swing. This program arranges six buttons and labels in a 2x3 grid layout within a JFrame.

  5. ListWindow.java: Demonstrates the use of JList to display a list of months. When a month is selected, it is displayed in a text field below the list.

  6. MenuWindow.java: Illustrates creating a menu bar with options to change text color and visibility. The menu allows users to set the text color or hide it using menu items.

  7. MetricConverter.java: A simple metric converter that converts kilometers to miles, feet, or inches. The user enters a distance in kilometers and selects the unit for conversion.

  8. MultipleIntervalSelection.java: Demonstrates multiple selection in a JList. The program allows users to select multiple months from a list, and displays the selected months in another list.

  9. MyCatImage.java: Displays a GUI with a button that changes the background color when clicked. It has a sample image icon and a placeholder for loading an external cat image (if available).

  10. ParseIntError.java: Shows how to handle NumberFormatException. The program attempts to convert a non-numeric string to an integer and catches the exception if the conversion fails.

  11. RangSum.java: Uses recursion to find the sum of a range of elements in an array. This program takes an array of numbers and calculates the sum within a specified range.

  12. ReadBinaryFile.java: Reads integers from a binary file Numbers.dat and displays them. The program uses DataInputStream to read data and handles the end of the file with EOFException.

  13. ReadRandomLetters.java: Demonstrates random access to read specific characters from a binary file Letters.dat. The program seeks different positions in the file and reads characters.

  14. SalesReport.java: Reads monthly sales data from a file and calculates the total and average sales. Handles non-numeric data and informs the user if there is an error in the file.

  15. StackTrace.java: Demonstrates how a StackTrace works by creating an intentional error. It tries to access a character out of bounds in a string and displays the stack trace.

  16. TempConverter.java: A temperature converter GUI that converts Celsius to Fahrenheit. Includes a slider to adjust the Celsius value and dynamically displays the Fahrenheit equivalent.

  17. TextArea.java: Shows how to use JTextArea with a scroll pane in Java Swing. The text area allows multi-line text input, with line wrap enabled and a scroll bar.

  18. WriteBinaryFile.java: Writes an array of integers to a binary file Numbers.dat using DataOutputStream. This program demonstrates writing data to a binary file.

  19. WriteLetters.java: Writes characters from 'a' to 'z' into a binary file Letters.dat using RandomAccessFile. Demonstrates basic file writing and data persistence.

  20. openFile.java: Prompts the user to enter a filename and attempts to read and display its contents line by line. If the file is not found, it displays an error message.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages