Skip to content

richie-rich90454/Java-unit-converter

Java Unit Converter

A clean and intuitive Java Swing desktop unit converter for volume, length, and temperature conversion, featuring real-time calculations and a simple GUI. It supports common measurement units in a lightweight Java Swing desktop interface.

Java Platform GUI

License Repo Size Last Commit Issues Pull Requests Latest Release


πŸš€ Overview

Java Unit Converter is a lightweight desktop tool built with pure Java Swing that allows users to convert between common units instantly.
It focuses on clarity, correctness, and ease of use, without external dependencies.

βœ” Real-time bidirectional conversion
βœ” Simple tab-based UI
βœ” Custom typography using open-source fonts
βœ” No libraries, no frameworks β€” just Java


πŸ–₯ Demo & Interface


✨ Features

πŸ“¦ Volume Conversion

Convert between 13 volume units:

  • Gallons, Quarts, Pints
  • U.S. Cups, Tablespoons, Teaspoons
  • Cubic Inches, Feet, Yards
  • Liters, Milliliters
  • Cubic Meters, Cubic Centimeters

πŸ“ Length Conversion

Convert between 8 length units:

  • Miles, Yards, Feet, Inches
  • Meters, Kilometers, Centimeters
  • Nautical Miles

🌑 Temperature Conversion

Convert between 3 temperature scales:

  • Fahrenheit
  • Celsius
  • Kelvin

⚑ How It Works

  1. Select a conversion category
    Choose Volume, Length, or Temperature using tabs.

  2. Generate a conversion box

    • Select a source unit
    • Select a target unit
    • Click Generate Conversion

    Identical unit selections are blocked with a clear error message.

  3. Convert in real time

    • Enter a value in either field
    • The converted value updates instantly
    • Supports decimals and negatives
      (- alone is treated as -1 for convenience)

πŸ›  Installation & Running

Requirements

  • Java Development Kit (JDK) 8+
  • No external dependencies

Project Structure

Java-unit-converter/
β”œβ”€β”€ App.java
β”œβ”€β”€ fonts/
β”‚   β”œβ”€β”€ NotoSans-Regular.ttf
β”‚   β”œβ”€β”€ NotoSans-Bold.ttf
β”‚   └── EBGaramond-Regular.ttf
└── font_licenses/
    β”œβ”€β”€ OFL-Noto_Sans.txt
    └── OFL-EB_Garamond.txt

Compile & Run

javac *.java
java App

πŸ§ͺ Troubleshooting

Fonts not loading?

  • Ensure fonts/ exists and filenames match those in App.java
  • Check file read permissions (especially on Linux/macOS)

Classpath errors?

javac -cp . *.java
java -cp . App

UI looks incorrect?

  • Check console logs for font loading errors
  • Verify font paths are correct

πŸ”€ Font Attribution

This project uses fonts licensed under the SIL Open Font License (OFL).

EB Garamond

Noto Sans


πŸ“œ License Compliance

This project complies with Apache License 2.0 and SIL OFL by:

  1. Including unmodified font files
  2. Bundling full license texts
  3. Preserving copyright notices
  4. Not redistributing fonts independently
  5. Providing clear attribution

🀝 Contributing

Contributions, bug reports, and suggestions are welcome.
If you find this project useful, please consider starring ⭐ the repository β€” it helps others discover it.


Β© 2025 richie-rich90454