本文整理匯總了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);
}
}