本文整理了Java中com.google.gwt.user.client.ui.Panel.add()
方法的一些代码示例,展示了Panel.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Panel.add()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.Panel
类名称:Panel
方法名:add
[英]Adds a child widget.
How to Override this Method
There are several important things that must take place in the correct order to properly add or insert a Widget to a Panel. Not all of these steps will be relevant to every Panel, but all of the steps must be considered.
代码示例来源:origin: libgdx/libgdx
public PreloaderCallback getPreloaderCallback () {
final Panel preloaderPanel = new VerticalPanel();
preloaderPanel.setStyleName("gdx-preloader");
final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png");
logo.setStyleName("logo");
preloaderPanel.add(logo);
final Panel meterPanel = new SimplePanel();
meterPanel.setStyleName("gdx-meter");
meterPanel.addStyleName("red");
final InlineHTML meter = new InlineHTML();
final Style meterStyle = meter.getElement().getStyle();
meterStyle.setWidth(0, Unit.PCT);
meterPanel.add(meter);
preloaderPanel.add(meterPanel);
getRootPanel().add(preloaderPanel);
return new PreloaderCallback() {
@Override
public void error (String file) {
System.out.println("error: " + file);
}
@Override
public void update (PreloaderState state) {
meterStyle.setWidth(100f * state.getProgress(), Unit.PCT);
}
};
}
代码示例来源:origin: libgdx/libgdx
private void checkLogLabel () {
if (log == null) {
((GwtApplication)Gdx.app).log = log = new TextArea();
// It's possible that log functions are called
// before the app is initialized. E.g. SoundManager can call log functions before the app is initialized.
// Since graphics is null, we're getting errors. The log size will be updated later, in case graphics was null
if (Gdx.graphics != null) {
log.setSize(Gdx.graphics.getWidth() + "px", "200px");
} else {
log.setSize("400px", "200px"); // Dummy value
}
log.setReadOnly(true);
((GwtApplication)Gdx.app).getRootPanel().add(log);
}
}
代码示例来源:origin: libgdx/libgdx
private void checkLogLabel () {
if (log == null) {
((GwtApplication)Gdx.app).log = log = new TextArea();
// It's possible that log functions are called
// before the app is initialized. E.g. SoundManager can call log functions before the app is initialized.
// Since graphics is null, we're getting errors. The log size will be updated later, in case graphics was null
if (Gdx.graphics != null) {
log.setSize(Gdx.graphics.getWidth() + "px", "200px");
} else {
log.setSize("400px", "200px"); // Dummy value
}
log.setReadOnly(true);
((GwtApplication)Gdx.app).getRootPanel().add(log);
}
}
代码示例来源:origin: libgdx/libgdx
public PreloaderCallback getPreloaderCallback () {
final Panel preloaderPanel = new VerticalPanel();
preloaderPanel.setStyleName("gdx-preloader");
final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png");
logo.setStyleName("logo");
preloaderPanel.add(logo);
final Panel meterPanel = new SimplePanel();
meterPanel.setStyleName("gdx-meter");
meterPanel.addStyleName("red");
final InlineHTML meter = new InlineHTML();
final Style meterStyle = meter.getElement().getStyle();
meterStyle.setWidth(0, Unit.PCT);
meterPanel.add(meter);
preloaderPanel.add(meterPanel);
getRootPanel().add(preloaderPanel);
return new PreloaderCallback() {
@Override
public void error (String file) {
System.out.println("error: " + file);
}
@Override
public void update (PreloaderState state) {
meterStyle.setWidth(100f * state.getProgress(), Unit.PCT);
}
};
}
代码示例来源:origin: libgdx/libgdx
} catch (Throwable e) {
root.clear();
root.add(getNoWebGLSupportWidget());
return;
代码示例来源:origin: libgdx/libgdx
} catch (Throwable e) {
root.clear();
root.add(getNoWebGLSupportWidget());
return;
代码示例来源:origin: libgdx/libgdx
public GwtGraphics (Panel root, GwtApplicationConfiguration config) {
Canvas canvasWidget = Canvas.createIfSupported();
if (canvasWidget == null) throw new GdxRuntimeException("Canvas not supported");
canvas = canvasWidget.getCanvasElement();
root.add(canvasWidget);
canvas.setWidth(config.width);
canvas.setHeight(config.height);
this.config = config;
WebGLContextAttributes attributes = WebGLContextAttributes.create();
attributes.setAntialias(config.antialiasing);
attributes.setStencil(config.stencil);
attributes.setAlpha(config.alpha);
attributes.setPremultipliedAlpha(config.premultipliedAlpha);
attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer);
context = WebGLRenderingContext.getContext(canvas, attributes);
context.viewport(0, 0, config.width, config.height);
this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGL20(context);
String versionString = gl.glGetString(GL20.GL_VERSION);
String vendorString = gl.glGetString(GL20.GL_VENDOR);
String rendererString = gl.glGetString(GL20.GL_RENDERER);
glVersion = new GLVersion(Application.ApplicationType.WebGL, versionString, vendorString, rendererString);
}
代码示例来源:origin: libgdx/libgdx
public GwtGraphics (Panel root, GwtApplicationConfiguration config) {
Canvas canvasWidget = Canvas.createIfSupported();
if (canvasWidget == null) throw new GdxRuntimeException("Canvas not supported");
canvas = canvasWidget.getCanvasElement();
root.add(canvasWidget);
canvas.setWidth(config.width);
canvas.setHeight(config.height);
this.config = config;
WebGLContextAttributes attributes = WebGLContextAttributes.create();
attributes.setAntialias(config.antialiasing);
attributes.setStencil(config.stencil);
attributes.setAlpha(config.alpha);
attributes.setPremultipliedAlpha(config.premultipliedAlpha);
attributes.setPreserveDrawingBuffer(config.preserveDrawingBuffer);
context = WebGLRenderingContext.getContext(canvas, attributes);
context.viewport(0, 0, config.width, config.height);
this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGL20(context);
String versionString = gl.glGetString(GL20.GL_VERSION);
String vendorString = gl.glGetString(GL20.GL_VENDOR);
String rendererString = gl.glGetString(GL20.GL_RENDERER);
glVersion = new GLVersion(Application.ApplicationType.WebGL, versionString, vendorString, rendererString);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void add(IsWidget child) {
this.add(asWidgetOrNull(child));
}
代码示例来源:origin: org.jboss.errai/errai-bus
public void addError(final String message, final String additionalDetails, final Throwable e) {
if (!showErrors)
return;
contentPanel.add(new HTML("<strong style='background:red;color:white;'>" + message + "</strong>"));
final StringBuilder buildTrace = new StringBuilder("<tt style=\"font-size:11px;\"><pre>");
if (e != null) {
e.printStackTrace();
buildTrace.append(e.getClass().getName()).append(": ").append(e.getMessage()).append("<br/>");
for (final StackTraceElement ste : e.getStackTrace()) {
buildTrace.append(" ").append(ste.toString()).append("<br/>");
}
}
buildTrace.append("</pre>");
contentPanel.add(new HTML(buildTrace.toString() + "<br/><strong>Additional Details:</strong>" + additionalDetails
+ "</tt>"));
if (!isShowing()) {
resize();
show();
center();
}
}
代码示例来源:origin: com.googlecode.gwtupload/gwtupload
protected void addElementsToPanel() {
panel.add(cancelLabel);
panel.add(fileNameLabel);
panel.add(statusLabel);
}
代码示例来源:origin: org.dashbuilder/dashbuilder-displayer-client
@Override
public void addFilterConfigWidget(IsWidget widget) {
filterDetailsPanel.add(widget);
filterExpandIcon.setVisible(true);
}
代码示例来源:origin: net.sf.advanced-gwt/advanced-gwt
/**
* This method initializes a toolbar with common values.
*
* @param toolbar is a toolbar to be initialized.
* @param panel is a top or bottom panel.
* @return an initialized toolbar.
*/
protected GridToolbar prepareToolbar(GridToolbar toolbar, Panel panel) {
toolbar.setGridPanel(this);
panel.add(toolbar);
return toolbar;
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets
protected void setWidgetForPanel(final Panel panel,
final IsWidget widget) {
panel.clear();
panel.add(widget);
}
代码示例来源:origin: org.codehaus.sonar/sonar-gwt-api
protected void addBigCell(Panel panel, String html) {
HTML htmlDiv = new HTML(html);
htmlDiv.setStyleName("big");
panel.add(htmlDiv);
}
}
代码示例来源:origin: com.vaadin/mpr-core
private void attachWidget(Widget widget, String appId, int nodeId) {
Element wrapperElement = getWrapperElement(appId, nodeId);
Panel wrapper = new AbsolutePanel(wrapperElement) {
{
onAttach();
}
};
wrapper.add(widget);
}
代码示例来源:origin: org.kie.guvnor/guvnor-test-scenario-editor-client
private void addFieldSelectorWidget() {
helper.setParentIsAList(true);
valueEditorWidget = new FieldSelectorWidget(field,
helper,
this);
panel.add(valueEditorWidget);
}
代码示例来源:origin: org.dashbuilder/dashbuilder-renderer-lienzo
@Override
public void addFilterReset() {
Anchor anchor = new Anchor(LienzoDisplayerConstants.INSTANCE.resetAnchor());
filterPanel.add(anchor);
anchor.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
getPresenter().onFilterResetClicked();
}
});
}
代码示例来源:origin: org.metawidget.modules/metawidget-all
public void startContainerLayout( Panel container, GwtMetawidget metawidget ) {
State state = getState( container, metawidget );
FlexTable flexTable = new FlexTable();
flexTable.setStyleName( mTableStyleName );
container.add( flexTable );
state.formatter = flexTable.getFlexCellFormatter();
}
代码示例来源:origin: org.uberfire/uberfire-runtime-plugins-client
@Override
public void onOpen() {
LayoutInstance layoutInstance = layoutGenerator.build(layoutTemplate);
mainPanel.clear();
mainPanel.getElement().addClassName("uf-perspective-component");
mainPanel.add(ElementWrapperWidget.getWidget(layoutInstance.getElement()));
}
内容来源于网络,如有侵权,请联系作者删除!