This demo features JButton configuration options and new QButtonUI implementations.
Use the "Configuration" panel to control the buttons in the "Example" panel.
The 5 QButtonUIs
can be installed by calling:
button.setUI(new BevelButtonUI()); button.setUI(new GradientButtonUI()); button.setUI(new RecessedButtonUI()); button.setUI(new RoundRectButtonUI()); button.setUI(new SquareButtonUI());
All configuration controls have specific tooltips that describe what property they define.
If you're viewing this on Mac: the default ButtonUI is the AquaButtonUI. This demo shows off 3 special features of the AquaButtonUI:
This demo also includes five new UIs: BevelButtonUI, GradientButtonUI, RecessedButtonUI, RoundRectButtonUI, SquareButtonUI. These are all subclasses of the abstract QButtonUI class. QButtonUI subclasses include the following options:
Graphics2D.fill(shape)
and a separate call to Graphics2D.draw(shape)
. This client property toggles off the Graphics2D.draw(..)
instruction. (The AbstractButton.isContentAreaFilled()
method is used to toggle the Graphics2D.fill(..)
instruction.)AbstractButton.setFocusPainted(..)
toggles the presence of a painted focus entirely.)There is no "size variant" option, but you can manually change the corner radius size and font size of buttons tweak the size.
QButtonUIs are vector-based, so if you render them on high-resolution monitors or otherwise change their size they should scale well.