Java Swing | Reuse design in all the jframe by creating your own components.

In this article we will see how to reuse design in all the jframe by creating your own components.

First of all create JFrame form inside your project.

Then create one package inside your project name it the "componentsPac".

After creating package create one JPanel form inside your package name it the "headerSection".

Java Swing | Reuse design in all the jframe by creating your own components.

Create your Jpanel form like header section.

Java Swing | Reuse design in all the jframe by creating your own components.

Use this JPanel form like other component for that create your component category and add this jpanel inside it. Right click on palette component section for create new component category.

Java Swing | Reuse design in all the jframe by creating your own components.

Click on Create new category.

Java Swing | Reuse design in all the jframe by creating your own components.

Give your component name.

Your component category has become created. Scroll down palette section and see your created component category.

Java Swing | Reuse design in all the jframe by creating your own components.

Add this JPanel form in your created component category for that right click on your JPanel form > Tools > Add to palette.

Java Swing | Reuse design in all the jframe by creating your own components.

Select your created component category.

Java Swing | Reuse design in all the jframe by creating your own components.

Your JPanel form have added inside your component category.

Open your main JFrame form and drag & drop created header component inside your jframe form.

Then run this JFrame form.

Add this header component in your other JFrame forms and reuse the header section in other JFrame forms.