This drawer custom with animation and miglayout and show drawer on glassPane of jfram
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 |
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();
if (drawer.isShow()) {
drawer.hide();
} else {
drawer.show();
}