Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Vertical bar separator in Toolbar

Posted on 2001-07-24
11
Medium Priority
?
1,619 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

604 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