当前位置: 首页>>代码示例>>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;未经允许,请勿转载。