Home » Java JSeparator

Java JSeparator

The object of JSeparator class is used to provide a general purpose component for implementing divider lines. It is used to draw a line to separate widgets in a Layout. It inherits JComponent class.


JSeparator class declaration

Commonly used Constructors of JSeparator

Constructor Description
JSeparator() Creates a new horizontal separator.
JSeparator(int orientation) Creates a new separator with the specified horizontal or vertical orientation.

Commonly used Methods of JSeparator

Method Description
void setOrientation(int orientation) It is used to set the orientation of the separator.
int getOrientation() It is used to return the orientation of the separator.

Java JSeparator Example 1

Output:

Java Jseparator 1


Java JSeparator Example 2

Output:

Java Jseparator 2

Next TopicJava JProgressBar

You may also like