Skip to content

DJ-Raven/java-swing-drawer

Repository files navigation

java-swing-drawer

This drawer custom with animation and miglayout and show drawer on glassPane of jfram

Method

Builder Method Parameters Default Values
header Component optional
addChild List<Component> optional
addFooter List<Component> optional
space int optional
separator int , Color optional
background Color new Color(30, 30, 30)
drawerBackground Color Color.WHITE
backgroundTransparent float (0f to 1f) 0.5f
drawerWidth int 250
headerHeight int 150
duration int 500
resolution int 10
itemHeight int 45
closeOnPress boolean true
enableScroll boolean false
enableScrollUI boolean true
leftDrawer boolean true
itemAlignLeft boolean true
event EventDrawer optional
build none required

Example Build Drawer with jfram

drawer = Drawer.newDrawer(jfram)
        .background(new Color(90, 90, 90))
        .enableScroll(true)
        .header(new JLabel("Header"))
        .space(3)

        .addChild(new DrawerItem("User ").icon(new ImageIcon(getClass().getResource("/icon/user.png"))).build())
        .addChild(new DrawerItem("Contacts").icon(new ImageIcon(getClass().getResource("/icon/cont.png"))).build())

        .addFooter(new DrawerItem("Exit").icon(new ImageIcon(getClass().getResource("/icon/exit.png"))).build())

        .event(new EventDrawer() {
            @Override
            public void selected(int index, DrawerItem item) {
                if (drawer.isShow()) {
                    drawer.hide();
                }
                //  More code here
            }
        })
        .build();

Example how to show and hide drawer

if (drawer.isShow()) {
    drawer.hide();
} else {
    drawer.show();
}

Screenshot

2022-07-06_232302

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages