當前位置: 首頁>>代碼示例>>Java>>正文


Java NumberFormatter.stringToValue方法代碼示例

本文整理匯總了Java中javax.swing.text.NumberFormatter.stringToValue方法的典型用法代碼示例。如果您正苦於以下問題:Java NumberFormatter.stringToValue方法的具體用法?Java NumberFormatter.stringToValue怎麽用?Java NumberFormatter.stringToValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.text.NumberFormatter的用法示例。


在下文中一共展示了NumberFormatter.stringToValue方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testNumberFormatter

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testNumberFormatter() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setMaximum(Integer.MAX_VALUE - 1);
    formatter.setMinimum(Integer.MIN_VALUE + 1);
    formatter.stringToValue(TOO_BIG_INTEGER);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:NumberEditorExtTest.java

示例2: testStrictNumberFormatterMinMax

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testStrictNumberFormatterMinMax() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new StrictNumberFormatter(format);
    formatter.setMaximum(Integer.MAX_VALUE);
    formatter.setMinimum(Integer.MIN_VALUE);
    formatter.stringToValue(TOO_BIG_INTEGER);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:NumberEditorExtTest.java

示例3: testStrictNumberFormatterAutoRangeInteger

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testStrictNumberFormatterAutoRangeInteger() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new StrictNumberFormatter(format);
    formatter.setValueClass(Integer.class);
    formatter.stringToValue(TOO_BIG_INTEGER);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:8,代碼來源:NumberEditorExtTest.java

示例4: testStrictNumberFormatterAutoRangeLong

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testStrictNumberFormatterAutoRangeLong() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new StrictNumberFormatter(format);
    formatter.setValueClass(Long.class);
    String text = new Long(Long.MAX_VALUE).toString() + "9";
    formatter.stringToValue(text);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:NumberEditorExtTest.java

示例5: testStrictNumberFormatterAutoRangeFloat

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testStrictNumberFormatterAutoRangeFloat() throws ParseException {
    NumberFormat format = NumberFormat.getInstance();
    NumberFormatter formatter = new StrictNumberFormatter(format);
    formatter.setValueClass(Float.class);
    String text = "9" + new Float(Float.MAX_VALUE).toString();
    formatter.stringToValue(text);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:NumberEditorExtTest.java

示例6: testStrictNumberFormatterAutoRangeFloatMin

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testStrictNumberFormatterAutoRangeFloatMin() throws ParseException {
    NumberFormat format = NumberFormat.getInstance();
    NumberFormatter formatter = new StrictNumberFormatter(format);
    formatter.setValueClass(Float.class);
    String text = "-9" + new Float(Float.MAX_VALUE).toString();
    formatter.stringToValue(text);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:NumberEditorExtTest.java

示例7: testStrictNumberFormatterAutoRangeByte

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testStrictNumberFormatterAutoRangeByte() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new StrictNumberFormatter(format);
    formatter.setValueClass(Byte.class);
    formatter.stringToValue(TOO_BIG_INTEGER);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:8,代碼來源:NumberEditorExtTest.java

示例8: testStrictNumberFormatterAutoRangeShort

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testStrictNumberFormatterAutoRangeShort() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new StrictNumberFormatter(format);
    formatter.setValueClass(Short.class);
    formatter.stringToValue(TOO_BIG_INTEGER);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:8,代碼來源:NumberEditorExtTest.java

示例9: testStrictNumberFormatterSmallExceedInteger

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testStrictNumberFormatterSmallExceedInteger() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new StrictNumberFormatter(format);
    formatter.setValueClass(Integer.class);
    String text = new Integer(Integer.MAX_VALUE).toString() + "1";
    formatter.stringToValue(text);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:NumberEditorExtTest.java

示例10: testNumberFormatterDouble

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
/**
 * This is not really an issue: Double values exceeding the bounds are Infinity.
 */
@Test (expected = ParseException.class)
public void testNumberFormatterDouble() throws ParseException {
    NumberFormat format = NumberFormat.getInstance();
    // no need to do anything special - parsing of doubles fails if out-off range?
    NumberFormatter formatter = new NumberFormatter(format);
    String text = "9" + new Double(Double.MAX_VALUE).toString();
    Number number = (Number) formatter.stringToValue(text);
    LOG.info("number: " + number);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:13,代碼來源:NumberEditorExtIssues.java

示例11: testNumberFormatterEmptyStringValue

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
/**
 * NumberFormatter parsing can't handle null.
 * 
 * @throws ParseException
 */
@Test
public void testNumberFormatterEmptyStringValue() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.stringToValue("");
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:12,代碼來源:NumberEditorExtIssues.java

示例12: testNumberFormatterNullValue

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
/**
 * NumberFormatter parsing can't handle null.
 * @throws ParseException
 */
@Test
public void testNumberFormatterNullValue() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.stringToValue(null);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:11,代碼來源:NumberEditorExtIssues.java

示例13: testNumberFormatterMinMax

import javax.swing.text.NumberFormatter; //導入方法依賴的package包/類
@Test (expected = ParseException.class)
public void testNumberFormatterMinMax() throws ParseException {
    NumberFormat format = NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new NumberFormatter(format);
    formatter.setMaximum(Integer.MAX_VALUE);
    formatter.setMinimum(Integer.MIN_VALUE);
    formatter.stringToValue(TOO_BIG_INTEGER);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:NumberEditorExtIssues.java


注:本文中的javax.swing.text.NumberFormatter.stringToValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。