Who could resist piling on with yet another option?
public class ButtonX2 extends Composite {
public ButtonX2 {
FlowPanel panel = new FlowPanel();
panel.add(new Button("1"));
panel.add(new Button("2"));
initWidget(panel);
}
}
Pros:
- Extending Composite gives you more control over the new widget's API
- Using a FlowPanel for layout gives you a far simpler DOM structure
(one <div>, to be precise) and you can arrange and style the elements
within using CSS
On Fri, Aug 28, 2009 at 11:15 AM, ThomasWrobel<[email protected]> wrote:
>
> Why not just use a horizontalpanel with two buttons next to eachother?
>
> HorizontalPanel buttongroup = new HorizontalPanel();
> buttongroup.add(buttonOne);
> buttongroup.add(buttonTwo);
>
> If you want to make this into its own class, youd do;
>
> public class myButtonGroup extends HorizontalPanel {
>
> Button buttonOne = new Button("test 1");
> Button buttonTwo = new Button("test 2");
>
> public myButtonGroup() {
>
> this.add(buttonOne)
> this.add(buttonTwo)
>
> }
>
> }
>
>
> Preferably in its own file.
> Then you can use myButtonGroup whenever you want these two buttons.
> eg.
> myButtonGroup testgroup = new myButtonGroup()
>
>
>
> On Aug 28, 10:42 am, LinuxChata <[email protected]> wrote:
>> How to create own widget with two button??
>>
>> Thanks
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---