![JAR search and dependency download from the Maven repository](/logo.png)
gov.nih.nlm.nls.lvg.Tools.GuiTool.GuiLib.IntTextDocument Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lvg2010dist Show documentation
Show all versions of lvg2010dist Show documentation
LVG tools is used by Apache cTAKES.
The newest version!
package GuiTool.GuiLib;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
public class IntTextDocument extends PlainDocument
{
public void insertString(int offs, String str, AttributeSet a)
throws BadLocationException
{
if(str == null)
{
return;
}
String oldString = getText(0, getLength());
String newString = oldString.substring(0, offs) + str
+ oldString.substring(offs);
try
{
Integer.parseInt(newString + "0");
super.insertString(offs, str, a);
}
catch(NumberFormatException e)
{
}
}
private final static long serialVersionUID = 5L;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy