The Java Swing component used to visually separate components with a line (horizontal or vertical) - most commonly used as a divider between menu items.
Questions tagged [jseparator]
27 questions
12
votes
4 answers
What is the best way to put spaces between objects? Can a Swing JSeparator object be an invisible separator?
I'm trying to put two buttons inside a panel using Swing widgets. Inside the NetBeans IDE, my JSeparator border property is set to (No border) in the properties pane.
Nevertheless a line appears. This is not what I would expect from a separator…

Warren P
- 65,725
- 40
- 181
- 316
12
votes
4 answers
How do I add a separator to a JComboBox in Java?
I have a JComboBox and would like to have a separator in the list of elements. How do I do this in Java?
A sample scenario where this would come in handy is when making a combobox for font-family-selection; similar to the…

Alfred B. Thordarson
- 4,460
- 8
- 39
- 37
8
votes
2 answers
How to change the color of a JSeparator?
The question is in the title.
I'm currently doing something like:
jSperator = new JSeparator();
jSeparator1.setForeground(new java.awt.Color(255, 51, 51));
But the separator keep his default color, something like 212,212,212.

nathan
- 1,111
- 3
- 18
- 33
7
votes
2 answers
Adding a vertical separator in PopupMenu, in the task bar
How can I add a vertical separator in the pop up menu of the app in the task bar ?
tray = SystemTray.getSystemTray();
openMenuItem = new MenuItem("Open P");
stopKLMenuItem = new MenuItem("Stop");
exitMenuItem = new…

Suhail Gupta
- 22,386
- 64
- 200
- 328
6
votes
1 answer
I can't see Swing JSeparator
I have this code:
JPanel jpMainExample = new JPanel(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
jpMainExample.add(new JLabel("JLabel"));
jpMainExample.add(new JTextField("JTextField"));
jpMainExample.add(new…
user5113188
3
votes
2 answers
JSeperator in JToolBar moves the components to right end
I am looking at Oracle's JToolBar code and trying to add JLabels within that toolbar. I have simulated the button-like feel for them by overriding the mouse events.
It worked fine until I tried to add a JSeperator as I wanted a vertical line. I…

Dinesh
- 16,014
- 23
- 80
- 122
3
votes
1 answer
How to insert a vertical JSeperator in a page between two categories of data using designgridlayout?
For example, i want to insert data in to two categories in a page.
USER | PASSWORDS
user1 | ******
user2 | *******
user3 | *********
I have inserted the piping symbol…

Toms
- 239
- 1
- 5
- 15
3
votes
1 answer
How to add JSeparator between two JLabels in GridBagLayout
I want to have a JSeparator between each JLabel in a GridBagLayout. Currently it looks like this:
And now I want to add a JSeparator after each TESTSTEP Label in between the icon and the JLabel. The following constraint are only for the JLabel and…

marc3l
- 2,525
- 7
- 34
- 62
3
votes
1 answer
Java JMenuBar : Vertical JSeparator
I'm trying to add a vertical JSeparator in my menu. But it puts margins between my MenuItems.
I want my items to stay left instead of left - center - right.
How it looks:
What I want:
JMenu settings = new JMenu("Settings");
image =…

Reinard
- 3,624
- 10
- 43
- 61
2
votes
1 answer
How to increase height of JSeparator in Java Swing
I'm building an app to record orders and generate invoice for those orders. I use a jSeparator to separate the client info from the order info. But i want to increase the height of the Separator and change its colour also.
Any help would be…

Dro
- 21
- 1
- 3
2
votes
1 answer
jSeparator looks - Preview Design vs Run File (netbeans)
I have this little problem. I'm using Netbeans. When I click on Preview Design I see the jSeparators like this:
But when I run the project this is what it looks like:
How can I fix this problem? I want the project to look like the Preview…

user3896336
- 21
- 3
2
votes
2 answers
how to remove JMenu.addSeparator() after it is being called
Hello guys,
I just want to ask something if is it possible to remove JMenu.addSeparator() after it is being called? for example in my form there is a menu bar and inside the menu bar lets say there are three JmenuItems and each of it has…

user3135677
- 83
- 1
- 9
2
votes
1 answer
Java Swing JSeparator in Menu incorrectly placed
I have a problem when i want insert a separator with JSeparator for Java Swing application. In point of fact, I have this problem just when i run my program on Mac, i haven't it on windows or linux. The separator is incorrectly placed, the text is…

Tof
- 301
- 5
- 17
1
vote
1 answer
Unable to change background-foreground color of jseparator in my custom jdialog
I am using a JSeparator in my custom jdialog
This is my code:
public class CheckDialog extends javax.swing.JDialog {
private boolean setuju =false;
public CheckDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
…

yusuf muhammad
- 53
- 1
- 10
1
vote
1 answer
How to draw a separator across a panel (GridBagLayout)
I am trying to add a JSeparator across a Panel in GridBagLayout, but it's not showing up.
I tried options like
panel.add(new JSeparator());
and
panel.add(new JSeparator(SwingConstants.HORIZONTAL));
None of them are giving a visible separator.

Aksanth
- 269
- 2
- 13