Custom button layout

I am trying to create buttons like the following image: Powerpoint arrow buttons

This works very well by doing the following:

class ArrowButton extends Composite {
    ArrowButton(Composite parent, int style) {

addStuff(Composite parent) {
    ArrowButton b = new ArrowButton(parent, SWT.NONE);
    b.setBounds(x, y, width, height);


However, I want to use a layout manager to lay out these buttons. Ideally, buttons are styled to a standard size so they can paint outside of that region.

Is it possible? How can i do this?


source to share

1 answer

Layout managers have two functions: calculating the size of the composite to which they are applied, and setting the boundaries of compound children. Given the relative simplicity of your requirements (linear buttons horizontally), I would argue that you are better off doing the layout yourself (instead of trying to hack your existing implementation). You can always put your code in a delegate behind the Layout interface if that would be better.



All Articles