Stay organized with collections Save and categorize content based on your preferences.

public static final class LineBreaker.Builder
extends Object



Helper class for creating a LineBreaker.

Summary

Public constructors

Builder()

Public methods

LineBreaker build()

Build a new LineBreaker with given parameters.

LineBreaker.Builder setBreakStrategy(int breakStrategy)

Set break strategy.

LineBreaker.Builder setHyphenationFrequency(int hyphenationFrequency)

Set hyphenation frequency.

LineBreaker.Builder setIndents(int[] indents)

Set indents.

LineBreaker.Builder setJustificationMode(int justificationMode)

Set whether the text is justified.

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

Builder

public Builder ()

Public methods

build

public LineBreaker build ()

Build a new LineBreaker with given parameters. You can reuse the Builder instance even after calling this method.

Returns
LineBreaker This value cannot be null.

setBreakStrategy

public LineBreaker.Builder setBreakStrategy (int breakStrategy)

Set break strategy. You can change the line breaking behavior by setting break strategy. The default value is LineBreaker.BREAK_STRATEGY_SIMPLE.

Parameters
breakStrategy int: Value is LineBreaker.BREAK_STRATEGY_SIMPLE, LineBreaker.BREAK_STRATEGY_HIGH_QUALITY, or LineBreaker.BREAK_STRATEGY_BALANCED
Returns
LineBreaker.Builder This value cannot be null.

setHyphenationFrequency

public LineBreaker.Builder setHyphenationFrequency (int hyphenationFrequency)

Set hyphenation frequency. You can change the amount of automatic hyphenation used. The default value is LineBreaker.HYPHENATION_FREQUENCY_NONE.

Parameters
hyphenationFrequency int: Value is LineBreaker.HYPHENATION_FREQUENCY_NORMAL, LineBreaker.HYPHENATION_FREQUENCY_FULL, or LineBreaker.HYPHENATION_FREQUENCY_NONE
Returns
LineBreaker.Builder This value cannot be null.

setIndents

public LineBreaker.Builder setIndents (int[] indents)

Set indents. The supplied array provides the total amount of indentation per line, in pixel. This amount is the sum of both left and right indentations. For lines past the last element in the array, the indentation amount of the last element is used.

Parameters
indents int: This value may be null.
Returns
LineBreaker.Builder This value cannot be null.

setJustificationMode

public LineBreaker.Builder setJustificationMode (int justificationMode)

Set whether the text is justified. By setting LineBreaker.JUSTIFICATION_MODE_INTER_WORD, the line breaker will change the internal parameters for justification. The default value is LineBreaker.JUSTIFICATION_MODE_NONE

Parameters
justificationMode int: Value is LineBreaker.JUSTIFICATION_MODE_NONE, or LineBreaker.JUSTIFICATION_MODE_INTER_WORD
Returns
LineBreaker.Builder This value cannot be null.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2023-02-08 UTC.