Please help me look into my simple test case:
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.Menu;
import com.smartgwt.client.widgets.menu.MenuItem;
public class Test1 implements EntryPoint {
private static final int MENU_ICON_SIZE = 50;
public void onModuleLoad() {
// HLayout buttonLayout = new HLayout();
//
// IconButton printButton = new IconButton("");
// printButton.setIcon("icons/16/print.png");
// printButton.setIconSize(MENU_ICON_SIZE);
Menu menu = new Menu();
menu.setShowShadow(true);
menu.setShadowDepth(10);
MenuItem csvExport = new MenuItem("Export as CSV",
"icons/16/csv_file.png");
MenuItem pdfExport = new MenuItem("Export as PDF",
"icons/16/pdf_file.png");
MenuItem xmlExport = new MenuItem("Export as XML",
"icons/16/xml_file.png");
MenuItem jsonExport = new MenuItem("Export as JSON",
"icons/16/json_file.png");
csvExport.setIconWidth(MENU_ICON_SIZE);
pdfExport.setIconWidth(MENU_ICON_SIZE);
xmlExport.setIconWidth(MENU_ICON_SIZE);
jsonExport.setIconWidth(MENU_ICON_SIZE);
csvExport.setIconHeight(MENU_ICON_SIZE);
pdfExport.setIconHeight(MENU_ICON_SIZE);
xmlExport.setIconHeight(MENU_ICON_SIZE);
jsonExport.setIconHeight(MENU_ICON_SIZE);
menu.setItems(csvExport, pdfExport, xmlExport, jsonExport);
IMenuButton exportButton = new IMenuButton("", menu);
exportButton.setIcon("icons/16/download.png");
exportButton.setIconSize(MENU_ICON_SIZE);
// buttonLayout.setMembers(printButton, exportButton);
//
// RootPanel.get().add(buttonLayout);
RootPanel.get().add(exportButton);
}
}
The icon is not showing, what I can see is only the little triangular for menu dropdown. The same problem is for MenuButton
as well.
However, if I switch from IMenuButton
to IconMenuButton
, the icon can be showing correctly, but the problem is the user have to click the little triangular to view the menu, instead of the entire button, which is not quite user-friendly to me.
Anyone have ideas about this?
Any comment or suggestion will be appreciated.