Solved

Vertical bar separator in Toolbar

Posted on 2001-07-24
11
1,596 Views
Last Modified: 2007-11-27
I've seen vertical bar separators in a few Java applications (JBuilder, TogetherJ). How do you create these? Is this a graphic? The .addSeparator only give me blank separation between buttons.

TIA,
Joel
0
Comment
Question by:joeltt
11 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6315985
Have a look at JSplitPane.
Sounds like this maybe what you are after.

JSplitPane pane = new JSplitPane(JPlitPane.VERTICAL_SPLIT, panel1, panel2);

Or if you just want a visual separator then use JSeperator.

new JSeperator(SwingConstants.VERTICAL);

0
 
LVL 1

Expert Comment

by:chris_kabuki
ID: 6316337
You need to use a JToolBar.Separator()
Check the API but it's really no more that creating an instance of it and then adding it to your toolbar:

.add(new JToolBar.Separator());

Note there is a 'setSeparatorSize()' method to change the size of it if you like. What the separator looks like is goverened by the current L&F.

0
 
LVL 92

Expert Comment

by:objects
ID: 6316375
chris> Isn't that what joeltt is already doing ?

joeltt> I think u can ignore my comment, I misunderstood your question.


0
 
LVL 92

Expert Comment

by:objects
ID: 6316389
On closer investigation I'll reinstate my JSeparator suggestion :-)
Haven't tested it, but it looks like it'll do what u require.
0
 
LVL 3

Author Comment

by:joeltt
ID: 6317558

Chris, I want to open this back up to other suggestions. I think I was doing what you say already, and didn't see a bar (vertical "3Dish" bar).

When I get back to my code (tonight), Ill check it out to make sure (and award points if you are indeed correct).
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 92

Accepted Solution

by:
objects earned 75 total points
ID: 6320153
addSeparator() simply adds a JToolbar.Separator which is an invisible separator.
The JSeparator on the other hand displays a bar (you've probably seen the horizontal version in menus).

In fact JToolbar.Separator is an extension of JSeparator with an empty paint().
0
 
LVL 3

Author Comment

by:joeltt
ID: 6320549
Well, Chris it works and it doesn't work for me. I do get the vertical bar, but for the life of me can't figure out why any following toolbar buttons are pushed to the far right of the toolbar (up to the next JSeparator).

Any ideas?

Joel
0
 
LVL 92

Expert Comment

by:objects
ID: 6324523
JToolbar.Separator works??? And u get a visual bar?
What JDK version?

0
 
LVL 3

Author Comment

by:joeltt
ID: 6324789

JDK 1.3.1, actually maybe I confused your two answers. Ill have to check again...

Anyway, why would the visual separator push everything after it to the far right?

J
0
 
LVL 92

Expert Comment

by:objects
ID: 6324943
Sounds like a layout issue, I'll see wot I can find out.
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9017765
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


[points to objects]


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now