本文整理汇总了Java中java.awt.Component.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Component.toString方法的具体用法?Java Component.toString怎么用?Java Component.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: capturarAlvoGritoDeGuerra
import java.awt.Component; //导入方法依赖的package包/类
/**
* Captura o alvo clicado logo após um evento grito de guerra ter sido
* gerado
*
* @param component alvo clicado
* @param evt evento do mouse
*/
private void capturarAlvoGritoDeGuerra(Component component, MouseEvent evt) {
if (evt.getButton() == MouseEvent.BUTTON1) {
String name = component != null ? component.toString() : "";
if (name.contains(Values.TO_STRING_HEROI) || name.contains(Values.TO_STRING_LACAIO)) {
setAlvoSelecionado(Partida.getIdLong(name));
}
} else {
setAlvoSelecionado(ALVO_CANCEL);
}
}
示例2: getColumnIdentifier
import java.awt.Component; //导入方法依赖的package包/类
final private int getColumnIdentifier(int intPcolumnIndex) {
int intLidentifier = Constants.bytS_UNCLASS_NO_VALUE;
final String strLidentifierToken = ",text=";
final Component objLcomponent =
this.getTableHeader()
.getDefaultRenderer()
.getTableCellRendererComponent( this,
this.getColumnModel().getColumn(intPcolumnIndex).getIdentifier(),
this.getSelectedColumn() == intPcolumnIndex,
false,
Constants.bytS_UNCLASS_NO_VALUE,
intPcolumnIndex);
final String strLcomponent = objLcomponent.toString();
int intLidentifierIndex = strLcomponent.indexOf(strLidentifierToken);
if (intLidentifierIndex >= 0) {
intLidentifierIndex += strLidentifierToken.length();
int intLnextCommaIndex = strLcomponent.substring(intLidentifierIndex).indexOf(',');
if (intLnextCommaIndex == Constants.bytS_UNCLASS_NO_VALUE) {
intLnextCommaIndex = strLcomponent.length() - intLidentifierIndex;
}
try {
intLidentifier = new Integer(strLcomponent.substring(intLidentifierIndex, intLidentifierIndex + intLnextCommaIndex));
if (intLidentifier >= 0 && intLidentifier < this.getColumnCount()) {
return intLidentifier;
}
} catch (final Throwable objPthrowable) {}
}
return Constants.bytS_UNCLASS_NO_VALUE;
}
示例3: ComponentNode
import java.awt.Component; //导入方法依赖的package包/类
public ComponentNode(Component comp) {
super(comp.getClass());
try {
props = Operator.createOperator(comp).getDump();
} catch (Exception e) {
props = new Hashtable<>();
}
clss = comp.getClass().getName();
compToString = comp.toString();
this.comp = comp;
x = comp.getLocationOnScreen().x;
y = comp.getLocationOnScreen().y;
w = comp.getWidth();
h = comp.getHeight();
}