Solved

Using Borland Libraries

Posted on 2004-09-08
23
401 Views
Last Modified: 2012-06-27
Hey experts!

I want to use a borland library - specifically com.borland.jbcl.layout.*(which has an XYLayout class to specify the XYConstraints of JComponents). When I am starting a new project, and when I go to Design mode in JBuilder 6.0, and drop a JComponent and modify its layout to XYLayout, the XYLayout code would be added to the code page and the library would be automatically imported, but if I didn't use design mode, and only opened a new project and used the import statement to import the library, and tried to use the XYLayout class, the compiler would not recognize the bolrand library (and if I browsed the classes avialable to the project, any of the com.borland libraries would not be available)

Any help on this problem?
0
Comment
Question by:mte01
  • 10
  • 8
  • 5
23 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 12009999
>>I want to use a borland library

Don't ;-). They are proprietary, so unless you package those classes into your app (don't know what the licensing implications are) other people won't be able to use it
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12010030
You should use to learn layout managers. An XYLayout is really nothing more than a kludge effectively. Do you know how to make one that *isn't* proprietary?

getContentPane().setLayout(null); // voila, you've got one!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12010050
>>You should use to learn layout managers.

LOL. That should have been

You should learn to use layout managers.

http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html
0
 
LVL 3

Author Comment

by:mte01
ID: 12010074
Don't worry CEHJ I am using a JAR for my applet and I am packaging them together.

>>An XYLayout is really nothing more than a kludge effectively

I didn't exactly understand what you meant, but I need the XYLayout class inorder to be able to organize the layout in the panel using XYConstraints. It's very useful believe me - especially when you want to build dynamic forms that have their JComponents' positions change based on the data from the table(s) that you are retrieving.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12010102
>>It's very useful believe me - especially when you want to build dynamic forms

That would certainly be a good reason for adopting that approach, but the single line of code i posted provides you with the ability to place your components wherever you want *without* proprietary classes
0
 
LVL 3

Author Comment

by:mte01
ID: 12010157
Place a component without using these proprietary classes that places a JButton 10 pixels to the right and 25 pixels from the top of a JPanel.

I would use the following:

testpanel = new JPanel(new XYLayout());
testpanel.add(testbutton,new XYConstraints(10,25,-1,-1));
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 130 total points
ID: 12010215
testPanel.setLayout(null);
testPanel.add(testButton);
testButton.setLocation(10, 25);
0
 
LVL 3

Author Comment

by:mte01
ID: 12010266
Ahaa I understand now...

You see what happened is that my supervisor in the company that I'm doing software development at is the one who started with the project, and he used XYLayout (I'll surely inform him about your method), so I continued according to what he started.

Now before giving you the credit, can we please go back to my original question, and see if you can find a solution for it.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12010299
Well i'm not a JBuilder user, but i'm surprised that their *own* classes are not always available, whatever mode your editor is in. You should determine how to set libraries on a global basis, as opposed to per-project
0
 
LVL 3

Author Comment

by:mte01
ID: 12010330
Ok...I'll leave this question open for a few hours, and then give the proper credit. Thank you.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12010383
Look at 'Default Project Properties' here:

http://www.devdaily.com/java/edu/jb/jb010007/index.shtml

Note they've got  JBCL in there - have you?
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 86

Expert Comment

by:CEHJ
ID: 12010397
Actually i'm not sure if JBCL is the (gui) package in question, but that's the general idea
0
 
LVL 3

Author Comment

by:mte01
ID: 12010545
>> http://www.devdaily.com/java/edu/jb/jb010007/index.shtml

This was for JBuilder 2.0 (They have the borland components and you have to configure the Java SDK libraries), in JBuilder 6.0 it's the complete opposite !! (you have the java, and you have to configure the borland). The problem is that I can't seem to locate them  (and the layout is different, so you cannot browse your PC drives and/or set full paths).
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12010600
>>in JBuilder 6.0 it's the complete opposite !!

Well that's a bit better ;-) You'll get a JBuilder user coming along soon
0
 
LVL 9

Expert Comment

by:doronb
ID: 12010873
@CEHJ, I'm a JBuilder User, so please be nice ;)

Anyway, JBuilder's a great tool, IDE and what-not, however, I give JBuilder the benefit of the doubt as much as I gave Visual J++, meaning, I won't use their specialized classes and they won't cause me compatability problems ;)

But, having said that, and kidding aside:

About GUI:
~~~~~~~
>> I didn't exactly understand what you meant, but I need the XYLayout class inorder to be able to organize the layout in the panel using XYConstraints. It's very
>> useful believe me - especially when you want to build dynamic forms that have their JComponents' positions change based on the data from the table(s) that
>> you are retrieving

I have found GridBagLayout to be the best to use, and believe me, I say this with a heavy heart be cause I know how complex GridBagLayout can be, however the results speak for themselves and it has never let me down once I got things right :)

About JBCL:
~~~~~~~~
Borland are known for their Component Libraries.  Delphi's VCL is an awesome foundation to base your application on, and so is JBCL I'm sure.  However, as a Java Developer and even as a Team Leader (still working with Java, have no fear) I always found the people above (i.e. R&D managers, or Team Leaders) have a problem with libraries they aren't familiar with.  There's always this: "Are you sure its compatible?"  and no, even when I told them its in 100% pure Java and there are no JNI calls in any of the source (by the way, Borland Enterprise products usually contain the Source Code to almost everything you need!), they're still not 100% convinced.

Currently I'm using JBuilder 9, and its great, but I still don't use JBCL stuff, force of habbit I guess ;)

If you'd like to know about how things are done in JB9, I'll be happy to help.

Good luck,
Doron
0
 
LVL 3

Author Comment

by:mte01
ID: 12010995
Thanks Doron for your extended comment...

About GUI:
~~~~~~~
First of all, yes I used GridBagLayout in some situations, and although it's complex it showed good results. Second, what I mean by dynamic forms is that for example you read certain data from the database (that you know nothing about, it's all dynamic based on the user's choice), and it's organized into rows and columns (and the rows don't have equal number of columns), so you need to organize the layout (sometimes by taking the size of the component, sometimes not); therefore, i found that using the coordinates of the panel (x & y), and incrementing them upon adding data very useful.

About JBCL:
~~~~~~~~

Yes please do post how do you include a borland libarary in JB 9.0 (for example com.borland.jbcl.layout.*) in a certain project (or in general)


Also , please view this question: Library Settings in JAR files:
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21123594.html

Thanks
0
 
LVL 9

Expert Comment

by:doronb
ID: 12011051
>> ...that you know nothing about, it's all dynamic based on the user's choice...

This is the type of projects I usually did :) and yes, there's a LOT of measuring done pre-rendering.

>> ...therefore, i found that using the coordinates of the panel (x & y), and incrementing them upon adding data very useful.

Yes, it is to some degree, but when the form is resized, don't you have to do some more work to maintain the layout?

About JBCL, let me fire up my JB and look into it...
0
 
LVL 3

Author Comment

by:mte01
ID: 12011081
>> when the form is resized, don't you have to do some more work to maintain the layout?

It's in an applet and it's accessed using a browser, so I control its size (and the users are so naive to the extent that they won't even change the size of the browser)
0
 
LVL 9

Expert Comment

by:doronb
ID: 12011084
Ahhhhhhhhhhhhhhhh that exaplains it all.. sorry :)
Its just that I had to deal with lots of stuff moving around cause there were not only applets but also applications involved.
0
 
LVL 9

Accepted Solution

by:
doronb earned 370 total points
ID: 12011130
Now, about the JBCL layout, first of all, the easiest way:

1) Click on any panel in the GUI Designer view.
2) Select the panel's layout to be XYLayout.
3) Next thing you know, JB9 automatically imports com.borland.jbcl.layout.*; and adds the JBCL library to your Project's properties under the "Required Libraries" tab.

Next, the more difficult way:

1) Open the "Project Properties" dialog, select the "Required Libraries" tab and add the JBCL library yourself.

Now, in your run-time configuration, you should include a jar file called "jbcl.jar" which you will probably find under "C:\JBuilder9\lib\"
0
 
LVL 3

Author Comment

by:mte01
ID: 12011180
Finally!!! in JB 6, there is a "required libraries" tab inside the main tab "Paths"...I never seemed to see it :). Thank you doronb & CEHJ ;)
0
 
LVL 9

Expert Comment

by:doronb
ID: 12011191
You're most welcome and look at my answer to your 2nd question.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12011213
8-)
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

747 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

9 Experts available now in Live!

Get 1:1 Help Now