本文整理匯總了Java中com.google.gwt.i18n.client.NumberFormat.getDecimalFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java NumberFormat.getDecimalFormat方法的具體用法?Java NumberFormat.getDecimalFormat怎麽用?Java NumberFormat.getDecimalFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.i18n.client.NumberFormat
的用法示例。
在下文中一共展示了NumberFormat.getDecimalFormat方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createNumberField
import com.google.gwt.i18n.client.NumberFormat; //導入方法依賴的package包/類
/**
* Create a number field to represent a default flexible element.
*
* @param allowBlank If the field allow blank value.
* @return The number field.
*/
protected NumberField createNumberField(final boolean allowBlank) {
final NumberField numberField = new NumberField();
numberField.setAllowDecimals(true);
numberField.setAllowNegative(false);
numberField.setAllowBlank(allowBlank);
preferredWidth = FlexibleElementDTO.NUMBER_FIELD_WIDTH;
// Decimal format
final NumberFormat format = NumberFormat.getDecimalFormat();
numberField.setFormat(format);
// Sets the min value.
final Number minValue = 0.0;
numberField.setMinValue(minValue);
return numberField;
}
示例2: setHighScore
import com.google.gwt.i18n.client.NumberFormat; //導入方法依賴的package包/類
public void setHighScore(int scoreIndex, String playerName, int highScore) {
int maxLength = SCORE_PAGE.texttspan5634().length();
NumberFormat decimalFormat = NumberFormat.getDecimalFormat();
String formattedScore = decimalFormat.format(highScore);
playerName += " ";
String labelText = playerName.substring(0, maxLength - 1 - formattedScore.length()).concat(" ").concat(formattedScore);
// labelText = labelText.replace(" ", " ");
// String.format("%1$" + n + "s", playerName);
switch (scoreIndex) {
case 0:
scorePageBuilder.setLabel(SvgTextElements.tspan4348, labelText);
break;
case 1:
scorePageBuilder.setLabel(SvgTextElements.tspan5630, labelText);
break;
case 2:
scorePageBuilder.setLabel(SvgTextElements.tspan4379, labelText);
break;
case 3:
scorePageBuilder.setLabel(SvgTextElements.tspan5632, labelText);
break;
case 4:
scorePageBuilder.setLabel(SvgTextElements.tspan5634, labelText);
break;
}
}
示例3: printMessage
import com.google.gwt.i18n.client.NumberFormat; //導入方法依賴的package包/類
public void printMessage(String eventName, int code, boolean modifier, boolean control) {
final NumberFormat formatter = NumberFormat.getDecimalFormat();
String message = eventName + " - Char Code: " + formatter.format(code) + ". ";
if(code == KeyCodes.KEY_ENTER) {
message += "Key is ENTER. ";
}
if(modifier)
message += "Modifier is down. ";
if(control)
message += "CTRL is down. ";
logger.info("message"+message);
}
示例4: NumberRenderer
import com.google.gwt.i18n.client.NumberFormat; //導入方法依賴的package包/類
public NumberRenderer(String format) {
if (format == null) {
this.formater = NumberFormat.getDecimalFormat();
} else {
this.formater = NumberFormat.getFormat(format);
}
}
示例5: showResult
import com.google.gwt.i18n.client.NumberFormat; //導入方法依賴的package包/類
private void showResult() {
answerShowing = true;
matchLanguageBuilder.hideGroup(SvgGroupStates.TargetButtonPlay);
matchLanguageBuilder.hideGroup(SvgGroupStates.SampleButtonPlay1);
matchLanguageBuilder.hideGroup(SvgGroupStates.SampleButtonPlay2);
matchLanguageBuilder.hideGroup(SvgGroupStates.SampleButtonPlay3);
matchLanguageBuilder.hideGroup(SvgGroupStates.SampleButtonPlay4);
matchLanguageBuilder.hideGroup(SvgGroupStates.SampleButtonPlay5);
matchLanguageBuilder.hideGroup(SvgGroupStates.ChoiceArrow1);
matchLanguageBuilder.hideGroup(SvgGroupStates.ChoiceArrow2);
matchLanguageBuilder.hideGroup(SvgGroupStates.ChoiceArrow3);
matchLanguageBuilder.hideGroup(SvgGroupStates.ChoiceArrow4);
matchLanguageBuilder.hideGroup(SvgGroupStates.ChoiceArrow5);
// matchLanguageBuilder.hideGroup(SvgGroupStates.ChoiceArrow4);
matchLanguageBuilder.showGroup(SvgGroupStates.LanguageInfoBox);
if (roundData.getCorrectSample().getLanguageSample().isDobes()) {
matchLanguageBuilder.showGroup(SvgGroupStates.DobesSymbol);
} else {
matchLanguageBuilder.hideGroup(SvgGroupStates.DobesSymbol);
}
matchLanguageBuilder.showGroup(SvgGroupStates.Map);
showSingleChildOfGroup(SvgGroupStates.Pins, roundData.getCorrectSample().getLanguageSample().getIsoCode());
// matchLanguageBuilder.showGroup(SvgGroupStates.g4704);
// matchLanguageBuilder.showGroup(SvgGroupStates.IncorrectButton);
matchLanguageBuilder.showGroup(SvgGroupStates.NextRoundButton);
audioPlayer.stopAll();
matchLanguageBuilder.setLabel(SvgTextElements.tspan4319, roundData.getCorrectSample().getLanguageSample().getLanguageName());
NumberFormat decimalFormat = NumberFormat.getDecimalFormat();
String formattedPopulation = decimalFormat.format(roundData.getCorrectSample().getLanguageSample().getPopulation());
matchLanguageBuilder.setLabel(SvgTextElements.tspan4326, messages.languagePopulation(formattedPopulation));
}
示例6: updatePattern
import com.google.gwt.i18n.client.NumberFormat; //導入方法依賴的package包/類
/**
* Update the selected pattern based on the pattern in the list.
*/
@ShowcaseSource
private void updatePattern() {
switch (patternList.getSelectedIndex()) {
case 0:
activeFormat = NumberFormat.getDecimalFormat();
patternBox.setText(activeFormat.getPattern());
patternBox.setEnabled(false);
break;
case 1:
activeFormat = NumberFormat.getCurrencyFormat();
patternBox.setText(activeFormat.getPattern());
patternBox.setEnabled(false);
break;
case 2:
activeFormat = NumberFormat.getScientificFormat();
patternBox.setText(activeFormat.getPattern());
patternBox.setEnabled(false);
break;
case 3:
activeFormat = NumberFormat.getPercentFormat();
patternBox.setText(activeFormat.getPattern());
patternBox.setEnabled(false);
break;
case 4:
patternBox.setEnabled(true);
String pattern = patternBox.getText();
try {
activeFormat = NumberFormat.getFormat(pattern);
} catch (IllegalArgumentException e) {
showErrorMessage(constants.cwNumberFormatInvalidPattern());
return;
}
break;
}
// Update the formatted value
updateFormattedValue();
}
示例7: setUserScore
import com.google.gwt.i18n.client.NumberFormat; //導入方法依賴的package包/類
public void setUserScore(int userScore) {
NumberFormat decimalFormat = NumberFormat.getDecimalFormat();
String formattedScore = decimalFormat.format(userScore);
scorePageBuilder.setLabel(SvgTextElements.tspan3303, formattedScore);
}
示例8: setEndangeredCount
import com.google.gwt.i18n.client.NumberFormat; //導入方法依賴的package包/類
public void setEndangeredCount(int endangeredCount) {
NumberFormat decimalFormat = NumberFormat.getDecimalFormat();
String formattedChoiceCount = decimalFormat.format(endangeredCount);
scorePageBuilder.setLabel(SvgTextElements.tspan4192, formattedChoiceCount);
}