Wednesday, January 6, 2010

GXT: How to add a custom button in the toolbar header

No need to alter tool-sprites.gif, instead I would create an additional image tr-print.png and use the following CSS rules in your custom CSS file:

.x-tool-print{background:transparent url(../images/custom/tr-print.png) no-repeat 0 0;}
.x-tool-print-over{background-position:-1px 0;}

then call:

//Print
panel.getHeader().addTool(new ToolButton("x-tool-print" ,new SelectionListener() {
@Override
public void componentSelected(IconButtonEvent ce) {
final Window w = new Window();
PrintContainer printContainer = new PrintContainer();
printContainer.refresh();
w.add(printContainer);
w.show();
w.maximize();
}
}));


1 comment:

  1. Can you tell me more about the PrintContainer class you are using? Is this something you've created to help you print GXT components?

    ReplyDelete