javax.swing.text.Segment.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中javax.swing.text.Segment.<init>()方法的一些代码示例,展示了Segment.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Segment.<init>()方法的具体详情如下:
包路径:javax.swing.text.Segment
类名称:Segment
方法名:<init>

Segment.<init>介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public char[] getPassword() {
  Document doc = getDocument();
  Segment txt = new Segment();
  try {
    doc.getText(0, doc.getLength(), txt); // use the non-String API
  } catch (BadLocationException e) {
    return null;
  }
  char[] retValue = new char[txt.count];
  System.arraycopy(txt.array, txt.offset, retValue, 0, txt.count);
  return retValue;
}

代码示例来源:origin: stackoverflow.com

final Segment segment = new Segment();
try {

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Constructor.
 *
 * @param document The document we're 'reading'.
 */
public DocumentReader(Document document) {
  position = 0;
  mark = -1;
  this.document = document;
  this.segment = new Segment();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

public DecreaseIndentAction(String name) {
  super(name);
  s = new Segment();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

public NextWordAction(String nm, boolean select) {
  super(nm, select);
  seg = new Segment();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

public CloseCurlyBraceAction() {
  super(rstaCloseCurlyBraceAction);
  seg = new Segment();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

protected BeginWordAction(String name, boolean select) {
  super(name, select);
  seg = new Segment();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

protected EndWordAction(String name, boolean select) {
  super(name, select);
  seg = new Segment();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

public PreviousWordAction(String nm, boolean select) {
  super(nm, select);
  seg = new Segment();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Constructor.
 */
public CodeTemplateManager() {
  s = new Segment();
  comparator = new TemplateComparator();
  templates = new ArrayList<CodeTemplate>();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Creates a new WrappedSyntaxView.  Lines will be wrapped
 * on character boundaries.
 *
 * @param elem the element underlying the view
 */
public WrappedSyntaxView(Element elem) {
  super(elem, Y_AXIS);
  tempToken = new TokenImpl();
  s = new Segment();
  drawSeg = new Segment();
  tempRect = new Rectangle();
  lineCountTempToken = new TokenImpl();
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Creates a <code>Segment</code> from a <code>String</code>.
 *
 * @param code The string representing some code.
 * @return The code, as a <code>Segment</code>.
 */
protected Segment createSegment(String code) {
  return new Segment(code.toCharArray(), 0, code.length());
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Constructs a new <code>ConfigurableCaret</code>.
 *
 * @param style The style to use when painting the caret.  If this is
 *        invalid, then {@link CaretStyle#THICK_VERTICAL_LINE_STYLE} is
 *        used.
 */
public ConfigurableCaret(CaretStyle style) {
  seg = new Segment();
  setStyle(style);
  selectionPainter = new ChangeableHighlightPainter();
  pasteOnMiddleMouseClick = true;
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Removes any spaces or tabs from the end of the segment.
 *
 * @param segment The segment from which to remove tailing whitespace.
 * @return <code>segment</code> with trailing whitespace removed.
 */
private static Segment removeEndingWhitespace(Segment segment) {
  int toTrim = 0;
  char currentChar = segment.setIndex(segment.getEndIndex()-1);
  while ((currentChar==' ' || currentChar=='\t') && currentChar!=Segment.DONE) {
    toTrim++;
    currentChar = segment.previous();
  }
  String stringVal = segment.toString();
  String newStringVal = stringVal.substring(0,stringVal.length()-toTrim);
  return new Segment(newStringVal.toCharArray(), 0, newStringVal.length());
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Constructs a plain text document.  A default root element is created,
 * and the tab size set to 5.
 *
 * @param tmf The <code>TokenMakerFactory</code> for this document.  If
 *        this is <code>null</code>, a default factory is used.
 * @param syntaxStyle The syntax highlighting scheme to use.
 */
public RSyntaxDocument(TokenMakerFactory tmf, String syntaxStyle) {
  putProperty(tabSizeAttribute, Integer.valueOf(5));
  lastTokensOnLines = new DynamicIntArray(400);
  lastTokensOnLines.add(Token.NULL); // Initial (empty) line.
  s = new Segment();
  setTokenMakerFactory(tmf);
  setSyntaxStyle(syntaxStyle);
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

/**
 * Deserializes a document.
 *
 * @param in The stream to read from.
 * @throws ClassNotFoundException
 * @throws IOException
 */
private void readObject(ObjectInputStream in)
          throws ClassNotFoundException, IOException {
  in.defaultReadObject();
  // Install default TokenMakerFactory.  To support custom TokenMakers,
  // both JVM's should install default TokenMakerFactories that support
  // the language they want to use beforehand.
  setTokenMakerFactory(null);
  // Handle other transient stuff
  this.s = new Segment();
  int lineCount = getDefaultRootElement().getElementCount();
  lastTokensOnLines = new DynamicIntArray(lineCount);
  setSyntaxStyle(syntaxStyle); // Actually install (transient) TokenMaker
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

while (currentDocLineNumber<numDocLines) {
  Segment currentLineSeg = new Segment();

代码示例来源:origin: bobbylight/RSyntaxTextArea

TokenImpl token = this;
FontMetrics fm = null;
Segment s = new Segment();

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

/**
 * Constructor.
 */
public CodeTemplateManager() {
  s = new Segment();
  comparator = new TemplateComparator();
  templates = new ArrayList<CodeTemplate>();
}

代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea

/**
 * Constructor.
 */
public CodeTemplateManager() {
  // Default insert trigger is a space.
  // FIXME:  See notes in RSyntaxTextAreaDefaultInputMap.
  setInsertTrigger(TEMPLATE_KEYSTROKE);
  s = new Segment();
  comparator = new TemplateComparator();
  templates = new ArrayList();
}

相关文章