Solved

Vertical bar separator in Toolbar

Posted on 2001-07-24
11
1,604 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 99
SHA2 certs for IIS AND Java? 2 122
Chrome and Firefox Java 5 67
add projects t working set in maven 2 42
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

749 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