0

Working with GXT and Java trying to learn. Just testing it through eclipse takes me to a blank page no button, I have used the buttons sample from sencha and it shows like there, then when I take what I have so far learned to be necessary I still am unable to produce a single text button.

package com.custom.test.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.ContentPanel.ContentPanelAppearance;
import com.sencha.gxt.widget.core.client.FramedPanel.FramedPanelAppearance;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.button.CellButtonBase;

/**
 *  Entry point classes define <code>onModuleLoad()</code>.
 */
public class Test implements EntryPoint {
    @Override
    public void onModuleLoad() {
        VerticalPanel vp = new VerticalPanel();
        ContentPanel cp = new ContentPanel();
        vp.setSpacing(10);
        vp.setWidth("400px");
        HorizontalPanel hp = new HorizontalPanel();
        hp.setSpacing(5);
        Buttons b = new Buttons();
        CellButtonBase<?> small = b.createButton(Buttons.Category.NORMAL, Buttons.Type.TEXT);
        b.configureButton(small, Buttons.Type.TEXT, ButtonScale.SMALL);
        hp.add(small);
        vp.add(hp);
        cp = new ContentPanel(GWT.<ContentPanelAppearance> create(FramedPanelAppearance.class));
        cp.addStyleName("margin-10");
        cp.setPixelSize(500, 400);
        cp.getBody().getStyle().setBackgroundColor("white");
        cp.getBody().addClassName(ThemeStyles.getStyle().border());
        cp.add(vp);
        cp.show();
    }
}
Darin Kolev
  • 3,401
  • 13
  • 31
  • 46

1 Answers1

0

Not sure if this is needed, but try this

 cp.add(b);

? maybe ?

EDIT:

package com.custom.test.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.ContentPanel.ContentPanelAppearance;
import com.sencha.gxt.widget.core.client.FramedPanel.FramedPanelAppearance;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.button.CellButtonBase;

/**
 *  Entry point classes define <code>onModuleLoad()</code>.
 */
public class Test implements EntryPoint {
    @Override
    public void onModuleLoad() {
        VerticalPanel vp = new VerticalPanel();
        ContentPanel cp = new ContentPanel();
        vp.setSpacing(10);
        vp.setWidth("400px");
        HorizontalPanel hp = new HorizontalPanel();
        hp.setSpacing(5);
        Buttons b = new Buttons();
        CellButtonBase<?> small = b.createButton(Buttons.Category.NORMAL, Buttons.Type.TEXT);
        b.configureButton(small, Buttons.Type.TEXT, ButtonScale.SMALL);
        hp.add(small);
        vp.add(hp);
        vp.add(b); //you are adding everything except the actual button
        cp = new ContentPanel(GWT.<ContentPanelAppearance> create(FramedPanelAppearance.class));
        cp.addStyleName("margin-10");
        cp.setPixelSize(500, 400);
        cp.getBody().getStyle().setBackgroundColor("white");
        cp.getBody().addClassName(ThemeStyles.getStyle().border());
        cp.add(vp);
        cp.show();
    }
}
Savlon
  • 744
  • 2
  • 11
  • 18
  • so replace cp.add(vp); with cp.add(b); It did not work. Anything else? – Josh Stringer Jan 04 '13 at 18:52
  • No. basically you are adding panels to a content panel right? Well try adding the button to the vertical panel like i have done in my previous answer. Give that a go... If that doesn't work then try adding the button to the actual content panel on the line AFTER "cp. add(vp);" – Savlon Jan 04 '13 at 22:35