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


Java TextComponent类代码示例

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


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

示例1: focusLost

import java.awt.TextComponent; //导入依赖的package包/类
@Override
public void focusLost(FocusEvent e) {
    Component source = (Component) e.getSource();
    String text = "";
    if (source instanceof JTextComponent) {
        text = ((JTextComponent) source).getText();
    } else if (source instanceof TextComponent) {
        text = ((TextComponent) source).getText();
    }
    try {
        Integer.parseInt(text);
    } catch (NumberFormatException nfe) {
        JOptionPane.showMessageDialog(source,
                JMeterUtils.getResString("you_must_enter_a_valid_number"), //$NON-NLS-1$
                JMeterUtils.getResString("invalid_data"),  //$NON-NLS-1$
                JOptionPane.WARNING_MESSAGE);
        FocusRequester.requestFocus(source);
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:20,代码来源:NumberFieldErrorListener.java

示例2: _clear

import java.awt.TextComponent; //导入依赖的package包/类
public void _clear() {
    verifyCanInteractWithElement();
    final Component active = Device.getActiveComponent(component);
    if (active instanceof JTextComponent) {
        ((JTextComponent) active).setText("");
    } else if (active instanceof TextComponent) {
        ((TextComponent) active).setText("");
    } else {
        throw new UnsupportedCommandException("Clear not supported on " + active.getClass().getName(), null);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:12,代码来源:AbstractJavaElement.java

示例3: addTextListener

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.addTextListener(TextListener)} through queue
 */
public void addTextListener(final TextListener textListener) {
    runMapping(new MapVoidAction("addTextListener") {
        @Override
        public void map() {
            ((TextComponent) getSource()).addTextListener(textListener);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例4: getCaretPosition

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.getCaretPosition()} through queue
 */
public int getCaretPosition() {
    return (runMapping(new MapIntegerAction("getCaretPosition") {
        @Override
        public int map() {
            return ((TextComponent) getSource()).getCaretPosition();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例5: getSelectedText

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.getSelectedText()} through queue
 */
public String getSelectedText() {
    return (runMapping(new MapAction<String>("getSelectedText") {
        @Override
        public String map() {
            return ((TextComponent) getSource()).getSelectedText();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例6: getSelectionEnd

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.getSelectionEnd()} through queue
 */
public int getSelectionEnd() {
    return (runMapping(new MapIntegerAction("getSelectionEnd") {
        @Override
        public int map() {
            return ((TextComponent) getSource()).getSelectionEnd();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例7: getSelectionStart

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.getSelectionStart()} through queue
 */
public int getSelectionStart() {
    return (runMapping(new MapIntegerAction("getSelectionStart") {
        @Override
        public int map() {
            return ((TextComponent) getSource()).getSelectionStart();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例8: getText

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.getText()} through queue
 */
public String getText() {
    return (runMapping(new MapAction<String>("getText") {
        @Override
        public String map() {
            return ((TextComponent) getSource()).getText();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例9: isEditable

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.isEditable()} through queue
 */
public boolean isEditable() {
    return (runMapping(new MapBooleanAction("isEditable") {
        @Override
        public boolean map() {
            return ((TextComponent) getSource()).isEditable();
        }
    }));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例10: removeTextListener

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.removeTextListener(TextListener)} through queue
 */
public void removeTextListener(final TextListener textListener) {
    runMapping(new MapVoidAction("removeTextListener") {
        @Override
        public void map() {
            ((TextComponent) getSource()).removeTextListener(textListener);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例11: select

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.select(int, int)} through queue
 */
public void select(final int i, final int i1) {
    runMapping(new MapVoidAction("select") {
        @Override
        public void map() {
            ((TextComponent) getSource()).select(i, i1);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例12: selectAll

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.selectAll()} through queue
 */
public void selectAll() {
    runMapping(new MapVoidAction("selectAll") {
        @Override
        public void map() {
            ((TextComponent) getSource()).selectAll();
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例13: setCaretPosition

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.setCaretPosition(int)} through queue
 */
public void setCaretPosition(final int i) {
    runMapping(new MapVoidAction("setCaretPosition") {
        @Override
        public void map() {
            ((TextComponent) getSource()).setCaretPosition(i);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例14: setEditable

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.setEditable(boolean)} through queue
 */
public void setEditable(final boolean b) {
    runMapping(new MapVoidAction("setEditable") {
        @Override
        public void map() {
            ((TextComponent) getSource()).setEditable(b);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例15: setSelectionEnd

import java.awt.TextComponent; //导入依赖的package包/类
/**
 * Maps {@code TextComponent.setSelectionEnd(int)} through queue
 */
public void setSelectionEnd(final int i) {
    runMapping(new MapVoidAction("setSelectionEnd") {
        @Override
        public void map() {
            ((TextComponent) getSource()).setSelectionEnd(i);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java


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