本文整理汇总了Java中java.awt.peer.TextComponentPeer.getSelectionEnd方法的典型用法代码示例。如果您正苦于以下问题:Java TextComponentPeer.getSelectionEnd方法的具体用法?Java TextComponentPeer.getSelectionEnd怎么用?Java TextComponentPeer.getSelectionEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.TextComponentPeer
的用法示例。
在下文中一共展示了TextComponentPeer.getSelectionEnd方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeObject
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Writes default serializable fields to stream. Writes
* a list of serializable TextListener(s) as optional data.
* The non-serializable TextListener(s) are detected and
* no attempt is made to serialize them.
*
* @serialData Null terminated sequence of zero or more pairs.
* A pair consists of a String and Object.
* The String indicates the type of object and
* is one of the following :
* textListenerK indicating and TextListener object.
*
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
* @see java.awt.Component#textListenerK
*/
private void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
// Serialization support. Since the value of the fields
// selectionStart, selectionEnd, and text aren't necessarily
// up to date, we sync them up with the peer before serializing.
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
s.defaultWriteObject();
AWTEventMulticaster.save(s, textListenerK, textListener);
s.writeObject(null);
}
示例2: writeObject
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Writes default serializable fields to stream. Writes
* a list of serializable TextListener(s) as optional data.
* The non-serializable TextListener(s) are detected and
* no attempt is made to serialize them.
*
* @serialData Null terminated sequence of zero or more pairs.
* A pair consists of a String and Object.
* The String indicates the type of object and
* is one of the following :
* textListenerK indicating and TextListener object.
*
* @see AWTEventMulticaster#save(ObjectOutputStream, String, EventListener)
* @see java.awt.Component#textListenerK
*/
private void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
// Serialization support. Since the value of the fields
// selectionStart, selectionEnd, and text aren't necessarily
// up to date, we sync them up with the peer before serializing.
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
s.defaultWriteObject();
AWTEventMulticaster.save(s, textListenerK, textListener);
s.writeObject(null);
}
示例3: removeNotify
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Removes the <code>TextComponent</code>'s peer.
* The peer allows us to modify the appearance of the
* <code>TextComponent</code> without changing its
* functionality.
*/
public void removeNotify() {
synchronized (getTreeLock()) {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
super.removeNotify();
}
}
示例4: getSelectionEnd
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Gets the end position of the selected text in
* this text component.
* @return the end position of the selected text
* @see java.awt.TextComponent#setSelectionEnd
* @see java.awt.TextComponent#getSelectionStart
*/
public synchronized int getSelectionEnd() {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
selectionEnd = peer.getSelectionEnd();
}
return selectionEnd;
}
示例5: removeNotify
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Removes the {@code TextComponent}'s peer.
* The peer allows us to modify the appearance of the
* {@code TextComponent} without changing its
* functionality.
*/
public void removeNotify() {
synchronized (getTreeLock()) {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
super.removeNotify();
}
}
示例6: getSelectionEnd
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Returns the ending position of the selected text region.
* If the text is not selected, then caret position is returned
*
* @return The ending position of the selected text region.
*/
public synchronized int getSelectionEnd()
{
TextComponentPeer tcp = (TextComponentPeer) getPeer();
if (tcp != null)
selectionEnd = tcp.getSelectionEnd();
return(selectionEnd);
}
示例7: getSelectionEnd
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Returns the ending position of the selected text region.
* If the text is not selected, then caret position is returned
*
* @return The ending position of the selected text region.
*/
public synchronized int getSelectionEnd()
{
TextComponentPeer tcp = (TextComponentPeer) getPeer();
if (tcp != null)
selectionEnd = tcp.getSelectionEnd();
return(selectionEnd);
}
示例8: removeNotify
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Removes the <code>TextComponent</code>'s peer.
* The peer allows us to modify the appearance of the
* <code>TextComponent</code> without changing its
* functionality.
*/
public void removeNotify() {
synchronized (getTreeLock()) {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
text = peer.getText();
selectionStart = peer.getSelectionStart();
selectionEnd = peer.getSelectionEnd();
}
super.removeNotify();
}
}
示例9: getSelectionEnd
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Gets the end position of the selected text in
* this text component.
* @return the end position of the selected text
* @see java.awt.TextComponent#setSelectionEnd
* @see java.awt.TextComponent#getSelectionStart
*/
public synchronized int getSelectionEnd() {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
selectionEnd = peer.getSelectionEnd();
}
return selectionEnd;
}