本文整理汇总了Java中java.awt.peer.TextComponentPeer.getSelectionStart方法的典型用法代码示例。如果您正苦于以下问题:Java TextComponentPeer.getSelectionStart方法的具体用法?Java TextComponentPeer.getSelectionStart怎么用?Java TextComponentPeer.getSelectionStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.peer.TextComponentPeer
的用法示例。
在下文中一共展示了TextComponentPeer.getSelectionStart方法的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: getSelectionStart
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Gets the start position of the selected text in
* this text component.
* @return the start position of the selected text
* @see java.awt.TextComponent#setSelectionStart
* @see java.awt.TextComponent#getSelectionEnd
*/
public synchronized int getSelectionStart() {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
selectionStart = peer.getSelectionStart();
}
return selectionStart;
}
示例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: getSelectionStart
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Returns the starting position of the selected text region.
* If the text is not selected then caret position is returned.
*
* @return The starting position of the selected text region.
*/
public synchronized int getSelectionStart()
{
TextComponentPeer tcp = (TextComponentPeer) getPeer();
if (tcp != null)
selectionStart = tcp.getSelectionStart();
return(selectionStart);
}
示例7: getSelectionStart
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Returns the starting position of the selected text region.
* If the text is not selected then caret position is returned.
*
* @return The starting position of the selected text region.
*/
public synchronized int getSelectionStart()
{
TextComponentPeer tcp = (TextComponentPeer) getPeer();
if (tcp != null)
selectionStart = tcp.getSelectionStart();
return(selectionStart);
}
示例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: getSelectionStart
import java.awt.peer.TextComponentPeer; //导入方法依赖的package包/类
/**
* Gets the start position of the selected text in
* this text component.
* @return the start position of the selected text
* @see java.awt.TextComponent#setSelectionStart
* @see java.awt.TextComponent#getSelectionEnd
*/
public synchronized int getSelectionStart() {
TextComponentPeer peer = (TextComponentPeer)this.peer;
if (peer != null) {
selectionStart = peer.getSelectionStart();
}
return selectionStart;
}