当前位置: 首页>>代码示例>>Java>>正文


Java TextField.getText方法代码示例

本文整理汇总了Java中java.awt.TextField.getText方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.getText方法的具体用法?Java TextField.getText怎么用?Java TextField.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.TextField的用法示例。


在下文中一共展示了TextField.getText方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fixtext

import java.awt.TextField; //导入方法依赖的package包/类
private void fixtext(final TextField textfield) {
    String string = textfield.getText();
    string = string.replace('\"', '#');
    final String string330 = "\\";
    String string331 = "";
    int i = 0;
    int i332 = -1;
    rd.setFont(new Font("Arial", 1, 12));
    ftm = rd.getFontMetrics();
    for (/**/; i < string.length(); i++) {
        final String string333 = "" + string.charAt(i);
        if (string333.equals("|") || string333.equals(",") || string333.equals("(") || string333.equals(")") || string333.equals("#") || string333.equals(string330) || string333.equals("!") || string333.equals("?") || string333.equals("~") || string333.equals(".") || string333.equals("@") || string333.equals("$") || string333.equals("%") || string333.equals("^") || string333.equals("&") || string333.equals("*") || string333.equals("+") || string333.equals("=") || string333.equals(">") || string333.equals("<") || string333.equals("/") || string333.equals(";") || string333.equals(":") || ftm.stringWidth(string331) > 274) {
            i332 = i;
        } else {
            string331 = "" + string331 + string333;
        }
    }
    if (i332 != -1) {
        textfield.setText(string331);
        textfield.select(i332, i332);
    }
}
 
开发者ID:uwx,项目名称:OpenNFMM,代码行数:23,代码来源:StageMaker.java

示例2: fixtext

import java.awt.TextField; //导入方法依赖的package包/类
private void fixtext(final TextField textfield) {
    String string = textfield.getText();
    string = string.replace('\"', '#');
    final String string64 = "\\";
    String string65 = "";
    int i = 0;
    int i66 = -1;
    for (/**/ ; i < string.length(); i++) {
        final String string67 = "" + string.charAt(i);
        if (string67.equals("|") || string67.equals(",") || string67.equals("(") || string67.equals(")") || string67.equals("#") || string67.equals(string64) || string67.equals("!") || string67.equals("?") || string67.equals(" ") || string67.equals("~") || string67.equals("$") || string67.equals("%") || string67.equals("^") || string67.equals("&") || string67.equals("*") || string67.equals("+") || string67.equals("=") || string67.equals(">") || string67.equals("<") || string67.equals("/") || string67.equals("'") || string67.equals(";") || string67.equals(":") || string67.equals("\u00a0")) {
            i66 = i;
        } else {
            string65 = "" + string65 + string67;
        }
    }
    if (i66 != -1) {
        textfield.setText(string65);
        textfield.select(i66, i66);
    }
}
 
开发者ID:uwx,项目名称:OpenNFMM,代码行数:21,代码来源:Login.java

示例3: fixtext

import java.awt.TextField; //导入方法依赖的package包/类
private void fixtext(final TextField textfield) {
    String string = textfield.getText();
    string = string.replace('\"', '#');
    final String string360 = "\\";
    String string361 = "";
    int i = 0;
    int i362 = -1;
    for (/**/; i < string.length(); i++) {
        final String string363 = "" + string.charAt(i);
        if (string363.equals("|") || string363.equals(",") || string363.equals("(") || string363.equals(")") || string363.equals("#") || string363.equals(string360) || string363.equals("!") || string363.equals("?") || string363.equals("~") || string363.equals(".") || string363.equals("@") || string363.equals("$") || string363.equals("%") || string363.equals("^") || string363.equals("&") || string363.equals("*") || string363.equals("+") || string363.equals("=") || string363.equals(">") || string363.equals("<") || string363.equals("/") || string363.equals("'") || string363.equals(";") || string363.equals(":") || i > 15) {
            i362 = i;
        } else {
            string361 = "" + string361 + string363;
        }
    }
    if (i362 != -1) {
        textfield.setText(string361);
        textfield.select(i362, i362);
    }
}
 
开发者ID:uwx,项目名称:OpenNFMM,代码行数:21,代码来源:CarMaker.java

示例4: mouseClicked

import java.awt.TextField; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e)
{
	if (e.getClickCount() > 1 && e.getSource() instanceof TextField) // Double-click
	{
		TextField tf = (TextField) e.getSource();
		String path = tf.getText();
		boolean recording = Recorder.record;
		Recorder.record = false;
		if (tf == textParamFile)
		{
			path = Utils.getFilename("Choose_a_parameter_file", path);
		}
		else
		{
			path = Utils.getDirectory("Choose_a_directory", path);
		}
		Recorder.record = recording;
		if (path != null)
			tf.setText(path);
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:22,代码来源:FindFoci.java

示例5: validateFloatEdit

import java.awt.TextField; //导入方法依赖的package包/类
private static boolean validateFloatEdit(
            TextField   theField,
            double      minValue,
            double      maxValue) {
    StringTokenizer fieldTokenizer                    
        = new StringTokenizer(theField.getText());
    if (!fieldTokenizer.hasMoreElements()) {
        theField.setText("Error--No Data");
        return false;
    }                    
    else {
        String fieldString = 
                fieldTokenizer.nextToken();             
        try {
            double fieldValue = 
                new Double(fieldString)
                    .doubleValue();  
            if (fieldValue < minValue ) {
                theField.setText("Value Too Low");
                return false;
            }                                                          
            else if (fieldValue < minValue ) {
                theField.setText("Value Too High");
                return false;
            }                                                          
        }                            
        catch (Throwable e ) {
            theField.setText("Data Error");
            return false;
        }                            
    }            
    if (fieldTokenizer.hasMoreElements()) {
        theField.setText("Data Error");
        return false;
    }   
    else {
        return true;                
    }                             
}
 
开发者ID:Impro-Visor,项目名称:Impro-Visor,代码行数:40,代码来源:NoteEditor.java

示例6: getFieldDouble

import java.awt.TextField; //导入方法依赖的package包/类
private static double getFieldDouble(
            TextField   theField
        ) {
    StringTokenizer fieldTokenizer                    
        = new StringTokenizer(theField.getText());
    String fieldString = 
                fieldTokenizer.nextToken();             
    return (new Double(fieldString)).doubleValue();  
}
 
开发者ID:Impro-Visor,项目名称:Impro-Visor,代码行数:10,代码来源:NoteEditor.java

示例7: validateIntegerEdit

import java.awt.TextField; //导入方法依赖的package包/类
private static boolean validateIntegerEdit(
            TextField   theField,
            int         minValue,
            int         maxValue) {
    StringTokenizer fieldTokenizer                    
        = new StringTokenizer(theField.getText());
    if (!fieldTokenizer.hasMoreElements()) {
        theField.setText("Error--No Data");
        return false;
    }                    
    else {
        String fieldString = 
                fieldTokenizer.nextToken();             
        try {
            int fieldValue = 
                new Integer(fieldString)
                    .intValue();  
            if (fieldValue < minValue ) {
                theField.setText("Value Too Low");
                return false;
            }                                                          
            else if (fieldValue > maxValue ) {
                theField.setText("Value Too High");
                return false;
            }                                                          
        }                            
        catch (Throwable e ) {
            theField.setText("Data Error");
            return false;
        }                            
    }            
    if (fieldTokenizer.hasMoreElements()) {
        theField.setText("Data Error");
        return false;
    }   
    else {
        return true;                
    }                             
}
 
开发者ID:Impro-Visor,项目名称:Impro-Visor,代码行数:40,代码来源:NoteEditor.java

示例8: getFieldInt

import java.awt.TextField; //导入方法依赖的package包/类
private static int getFieldInt(
            TextField   theField
        ) {
    StringTokenizer fieldTokenizer                    
        = new StringTokenizer(theField.getText());
    String fieldString = 
                fieldTokenizer.nextToken();             
    return (new Integer(fieldString)).intValue();  
}
 
开发者ID:Impro-Visor,项目名称:Impro-Visor,代码行数:10,代码来源:NoteEditor.java

示例9: FIREDialogListener

import java.awt.TextField; //导入方法依赖的package包/类
FIREDialogListener(ExtendedGenericDialog gd, PrecisionHistogram histogram, QPlot qplot,
		Workflow<WorkSettings, Object> workflow)
{
	time = System.currentTimeMillis() + 1000;
	this.workflow = workflow;
	this.defaultMean = histogram.mean;
	this.defaultSigma = histogram.sigma;
	this.defaultQValue = qplot.qValue;
	isMacro = Utils.isMacro();
	// For the reset
	tf1 = (TextField) gd.getNumericFields().get(0);
	tf2 = (TextField) gd.getNumericFields().get(1);
	tf3 = (TextField) gd.getNumericFields().get(2);
	cb = (Checkbox) (gd.getCheckboxes().get(0));
	// Sliders
	sl1 = (Scrollbar) gd.getSliders().get(0);
	sl2 = (Scrollbar) gd.getSliders().get(1);
	sl3 = (Scrollbar) gd.getSliders().get(2);
	sl1.addMouseListener(this);
	sl2.addMouseListener(this);
	sl3.addMouseListener(this);
	m = tf1.getText();
	s = tf2.getText();
	q = tf3.getText();

	// Implement a delay to allow typing.
	// This is also applied to the sliders which we do not want. 
	// Ideally we would have no delay for sliders (since they are in the correct place already
	// but a delay for typing in the text field). Unfortunately the AWTEvent raised by ImageJ
	// for the slider is actually from the TextField so we cannot tell the difference.
	// For now just have no delay.
	//if (!isMacro)
	//	workflow.startPreview();
}
 
开发者ID:aherbert,项目名称:GDSC-SMLM,代码行数:35,代码来源:FIRE.java

示例10: mouseClicked

import java.awt.TextField; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e)
{
	// Show the result that was double clicked in the result table
	if (e.getClickCount() > 1)
	{
		// Double-click on the multi-mode dialog text fields
		if (e.getSource() instanceof TextField)
		{
			TextField tf = (TextField) e.getSource();
			String path = tf.getText();
			final boolean recording = Recorder.record;
			Recorder.record = false;
			path = Utils.getDirectory("Choose_a_directory", path);
			Recorder.record = recording;
			if (path != null)
				tf.setText(path);
		}
		// Double-click on the result table
		else if (lastImp != null && lastImp.isVisible())
		{
			// An extra line is added at the end of the results so remove this 
			int rank = resultsWindow.getTextPanel().getLineCount() -
					resultsWindow.getTextPanel().getSelectionStart() - 1;

			// Show the result that was double clicked. Results are stored in reverse order.
			if (rank > 0 && rank <= lastResults.size())
			{
				showResult(lastImp, lastMask, lastResults.get(rank - 1).options);
			}
		}
	}
}
 
开发者ID:aherbert,项目名称:GDSC,代码行数:33,代码来源:FindFociOptimiser.java

示例11: intFieldError

import java.awt.TextField; //导入方法依赖的package包/类
private static boolean intFieldError( 
                    TextField theField,
                    double minValue,
                    double maxValue ) {
    StringTokenizer fieldTokenizer                    
        = new StringTokenizer(theField.getText());
    if (!fieldTokenizer.hasMoreElements()) {
        theField.setText("Error");
        return true;
    }                    
    else {
        String fieldString = 
                fieldTokenizer.nextToken();             
        try {
            int fieldValue = 
                new Integer(fieldString)
                    .intValue();  
            if (fieldValue < minValue ) {
                theField.setText("Error");
                return true;
            }                                                          
            else if (fieldValue > maxValue ) {
                theField.setText("Error");
                return true;
            }                                                          
        }                            
        catch (Throwable e ) {
            theField.setText("Error");
            return true;
        }                            
    }            
    if (fieldTokenizer.hasMoreElements()) {
        theField.setText("Error");
        return true;
    }   
    else {
        return false;                
    }            
}
 
开发者ID:Armaxis,项目名称:jmg,代码行数:40,代码来源:CpnZoomScreen.java

示例12: getIntegerValue

import java.awt.TextField; //导入方法依赖的package包/类
private static int getIntegerValue( 
                    TextField theField ) {
    StringTokenizer fieldTokenizer                    
        = new StringTokenizer(theField.getText());
    String fieldString = 
               fieldTokenizer.nextToken();             
    return new Integer(fieldString).intValue();  
}
 
开发者ID:Armaxis,项目名称:jmg,代码行数:9,代码来源:CpnZoomScreen.java

示例13: loadNumber

import java.awt.TextField; //导入方法依赖的package包/类
private int loadNumber(TextField tf) {
	String text = tf.getText();
	int number = 0;
	try {
		number = Integer.parseInt(text);
		if (number > 4095)
			number = 4095;
	} catch (NumberFormatException e) {
		System.out.println("Not a correct number");
	}
	return number;
}
 
开发者ID:simon-heinen,项目名称:droidar,代码行数:13,代码来源:GeneratorWindow.java

示例14: format

import java.awt.TextField; //导入方法依赖的package包/类
protected void format(String tag, TextField pane) {// TODO

		final int start = pane.getSelectionStart();
		final int end = pane.getSelectionEnd();

		final String text = pane.getText();

		pane.setText(selectionInTag(text, start, end, tag));

	}
 
开发者ID:oerlenka,项目名称:BibTeX-Converter,代码行数:11,代码来源:tabbedPanel.java


注:本文中的java.awt.TextField.getText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。