HMeter is a highly customizable Java Swing widget designed to display horizontal progress visually. It provides developers with a simple yet versatile tool to showcase progress in graphical form. With HMeter, you can easily integrate progress meters into your Java Swing applications, allowing for a more intuitive user experience.
- Customizable Progress: Set the progress value dynamically from 0 to 100.
- Color Customization: Customize the colors of the progress arc, text, background, and boundary.
- Text Display: Display custom text within the progress meter.
- Hollow or Filled Arc: Choose between a hollow or filled arc for the progress indicator.
- Animation: Optionally animate the progress to provide a more engaging user experience.
- Mouse Interaction: Enable interactive control of the progress through mouse dragging.
- Responsive Design: Ensures a minimum height for the meter to maintain proper visibility.
- Set Background: Ensure a consistent design and personalization.
To integrate HMeter into your Java Swing application, follow these steps:
- Download the
HMeter.jar
file. - Include
HMeter.jar
in your project folder libraries,import HASNAT.HMeter. - Instantiate an
HMeter
object and add it to your Swing component hierarchy. - Customize the meter's appearance and behavior using the provided setter methods.
- Monitor and update the progress as needed in your application logic.
Here's a simple example demonstrating how to use HMeter:
import javax.swing.; import java.awt.; // import HASNAT.HMeter
public class MainFrame extends JFrame { public MainFrame() { super("HMeter Demo");
// Create an HMeter with initial progress and text
HMeter hMeter = new HMeter(50, "Processing...");
// Customize HMeter appearance
hMeter.setProgressColor(Color.BLUE);
hMeter.setTextColor(Color.BLACK);
hMeter.setBackgroundColor(Color.WHITE);
// Add HMeter to the frame
getContentPane().add(hMeter);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300, 300);
setLocationRelativeTo(null);
setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> new MainFrame());
}
}
Contributions to HMeter are welcome! If you find any issues or have suggestions for improvements, please feel free to submit a pull request or open an issue on GitHub.
HMeter is licensed under the MIT License. See the LICENSE file for details.
Enjoy using HMeter in your Java Swing projects and let us know how it enhances your user interfaces!