本文整理汇总了Java中com.google.gwt.user.client.DOM.getStyleAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java DOM.getStyleAttribute方法的具体用法?Java DOM.getStyleAttribute怎么用?Java DOM.getStyleAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.DOM
的用法示例。
在下文中一共展示了DOM.getStyleAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearSizeStyle
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
static String[] clearSizeStyle(Widget w) {
Element element = w.getElement();
String widthStyle = DOM.getStyleAttribute(element, "width");
String heightStyle = DOM.getStyleAttribute(element, "height");
if (widthStyle != null) {
DOM.setStyleAttribute(element, "width", null);
}
if (heightStyle != null) {
DOM.setStyleAttribute(element, "height", null);
}
return new String[] { widthStyle, heightStyle };
}
示例2: setShapeProperty
import com.google.gwt.user.client.DOM; //导入方法依赖的package包/类
private void setShapeProperty(String text) {
shape = Integer.parseInt(text);
// Android Buttons with images take the shape of the image and do not
// use one of the defined Shapes.
if (hasImage) {
return;
}
switch(shape) {
case 0:
// Default Button
DOM.setStyleAttribute(buttonWidget.getElement(), "borderRadius", "0px");
break;
case 1:
// Rounded Button.
// The corners of the Button are rounded by 10 px.
// The value 10 px was chosen strictly for style.
// 10 px is the same as ROUNDED_CORNERS_RADIUS defined in
// com.google.appinventor.components.runtime.ButtonBase.
DOM.setStyleAttribute(buttonWidget.getElement(), "borderRadius", "10px");
break;
case 2:
// Rectangular Button
DOM.setStyleAttribute(buttonWidget.getElement(), "borderRadius", "0px");
break;
case 3:
// Oval Button
String height = DOM.getStyleAttribute(buttonWidget.getElement(), "height");
DOM.setStyleAttribute(buttonWidget.getElement(), "borderRadius", height);
break;
default:
// This should never happen
throw new IllegalArgumentException("shape:" + shape);
}
}