Skip to content

WishvaRajaguru/DecoratedComponentsProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

🎨 About DecoratedComponentsProject

The DecoratedComponentsProject is a lightweight Java Swing library designed to simplify the creation of visually appealing UI components. The library currently provides two powerful components:

  • DecoratedPanel
  • DecoratedImagePanel

This library is a perfect choice for developers looking to enrich their Swing applications with enhanced visuals without compromising performance.





✨ Features

⁜ IDE drag & drop designing support (Netbeans).
⁜ Easily understandable property customization.

🖼️ DecoratedPanel

  • Customizable rouded corners and background colors.

🌄 DecoratedImagePanel

  • Display images seamlessly with advanced scaling options.
  • Smooth rendering for high-resolution images.


🚀 Getting Started

Installation

Simply download the .jar file and Add the library to your project.

Usage

The usage is pretty self explanatory since it is easy with Netbeans IDE. (Explained usage instructions will be added sooner!)

DecoratedPanel

  • Create a new DecoratedPanel Object and set border radius as needed:
    import com.rajaguru.DecoratedPanel;
    import javax.swing.*;

    public class Main {
        public static void main(String[] args) {
            JFrame frame = new JFrame("DecoratedPanel Example");
            DecoratedPanel panel = new DecoratedPanel();
            panel.setBackgroundColor(Color.BLUE);

            //To set Top-Left Radius
            panel.setArchTopLeft(100);

            //To set Top-Right Radius
            panel.setArchTopRight(100);

            //To set Bottom-Right Radius
            panel.setArchBottomRight(100);

            //To set Bottom-Left Radius
            panel.setArchBottomLeft(100);
    
            frame.add(panel);
            frame.setSize(800, 800);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        }
    }

DecoratedImagePanel

  • Create a new DecoratedImagePanel Object and set the Image:
    import com.rajaguru.DecoratedImagePanel;
    import javax.swing.*;
    import javax.swing.ImageIcon;
    
    public class Main {
        public static void main(String[] args) {
            JFrame frame = new JFrame("DecoratedPanel Example");
            DecoratedImagePanel panel = new DecoratedImagePanel();

            //Add Image to panel
            panel.setImageIcon(new ImageIcon(getClass().getResource("path")));
    
            frame.add(panel);
            frame.setSize(800, 800);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        }
    }
  • Set the border radius for DecoratedImagePanel:
            //MAKE SURE TO SET THIS PROPERTY TRUE TO ACTIVATE THIS FEATURE
            panel.setRoundedCorners(true);

            //To set Top-Left Radius
            panel.setArchTopLeft(100);

            //To set Top-Right Radius
            panel.setArchTopRight(100);

            //To set Bottom-Right Radius
            panel.setArchBottomRight(100);

            //To set Bottom-Left Radius
            panel.setArchBottomLeft(100);
  • To center image within the panel:
            panel.setCenterImage(true);
  • To Fit the image to the container:
            panel.setFitContent(true);
  • To Contain the Image withint the conrainer (New):
  • This feature can be used along-side centerImage function as well.
            panel.setContainContent(true);
  • To Enable Smooth Rendering of the image: This feature may slow down the loading process based on the performance of your workstation. How ever this will get rid of that laggy edges of the image if you need it.
            panel.setSmoothDecoration(true);


🛠️ Built With

  • Java Swing
  • JDK 8+

🧑‍💻 Author


Connect with me on GitHub !

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.

🙌 Support

If you find this project helpful, please ⭐ the repository and share it with others!

About

The DecoratedComponentsProject is a lightweight Java Swing library designed to simplify the creation of visually appealing UI components.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors