Flamingo component suite 3.0 – command buttons

December 3rd, 2007 | 2 Comments »

One of the basic building blocks in the Flamingo component suite is the command button component. Extending the existing core push button, it adds significant functionality, such as support for split and menu button modes, resizable icons, flexible dynamic layout, custom popup panels and more. The official documentation has the detailed walkthrough, and here i will give a short overview of some of the main features.

As noted earlier, all Flamingo components are written to look consistent under existing core and third-party look-and-feels. While the screenshots in this post show the command button under the default Ocean look-and-feel, you can use this component under any other look-and-feel that your application is using.

The first screenshot shows a command button under different states. Note how the icon size, the layout and the text presence change – this allows the application and the layout manager to make effective decisions on how to best utilize the available screen estate:

In addition to the usual “action area” (which is the entire button area under the default kind – the same as the core JButton component), the command button can have the “popup area”:

The actual division between the action area and popup area depends on the button kind – in the screenshots below notice the difference in the second row. The Cut button is defined to treat the text as part of the action area, while the Copy button is defined to treat the text as part of the popup area:

There are two ways to configure what happens when the popup area is activated. The first way is the simple one – configure a listener that gets called when a popup menu is about to be shown. The application code doesn’t need to worry about the menu creation, location or lifecycle.

The second, and much more powerful method is to attach a popup panel to the command button. The popup panel allows showing any Swing component / container in a popup window:

As with the simpler core popup menus, the popup panels can be cascaded, dismissed with ESC key or mouse events and are accessible via a global manager (API + registering listeners).

You’re welcome to play with the latest 3.0dev drop of Flamingo and read the detailed documentation.


Related posts:

  1. Flamingo component suite 3.0 – command button panel Flamingo component suite comes with a flexible and powerful component that hosts command buttons, providing...
  2. Flamingo ribbon component: rich tooltips on command buttons The latest addition in the Flamingo component suite is support for rich tooltips on command...
  3. Extending the Flamingo command buttons The command button component is a central building block for the Flamingo component suite. It...
  4. Flamingo component suite 3.0 – ribbon The ribbon component is one of the major parts of the Flamingo component suite. It...


2 Comments on “Flamingo component suite 3.0 – command buttons”

  1. 1 Jesper Berglund said at 1:16 pm on December 4th, 2007:

    I tried to launch the svg viewer but it failed due to exception:
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.sun.javaws.Launcher.executeApplication(Unknown Source)
    at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: org/jdesktop/swingworker/SwingWorker
    at org.jvnet.flamingo.svg.SvgViewer.(SvgViewer.java:85)
    at org.jvnet.flamingo.svg.SvgViewer.main(SvgViewer.java:194)
    … 9 more

    Any way to help me out ? :-)

    /Jesper

  2. 2 Kirill Grouchnikov said at 1:43 pm on December 4th, 2007:

    Jesper,

    With the move of Flamingo 3.0 to JDK 6.0 and other significant internal rewrites, the WebStart applications have not been yet updated. I will get to that, and in the meantime you can download the project bundle and run the test applications locally.

    Thanks for pointing my attention to this issue.
    Kirill