Freeform Swing Button Panel
If you have ever wanted to create a panel in java with buttons that can be any shape, then here is your answer
implemented methods:
- setDefaultTextFont(Font a)
- setDefaultTextColor(Color a)
- setDefaultTextPosition(Point a)
- setButtonToolTip(int a,String b)
- setButtonActionCommand(int a,String b)
- setButtonText(int a,String b)
- setButtonTextPosition(int a,Point b)
- setButtonTextColor(int a,Color b)
- setButtonTextFont(Font a)
- setButtonEnable(int a,boolean b)
- setButtonSelected(int a,boolean b)
How it works
the pannel is laoded with 5 images:
- normal image
- highlight image
- pressed down image
- disabled image
- image map
these 5 images are all that is needed to be able to have a working panel. the way the panel works if by looking at the last "image map" image, and if u tell the pannel u have 5 buttons, it will find all the areas on that image with color equal to (0,0,0) to (4,4,4) and identify that area as the button, (ids 0-4)
This example is based on a windows media player skin I once made, you can download it here.
copyright (c) 2022 yura.net