Link to home
Start Free TrialLog in
Avatar of mte01
mte01Flag for Lebanon

asked on

Using Borland Libraries

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?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

>>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
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!
>>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
Avatar of mte01

ASKER

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.
>>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
Avatar of mte01

ASKER

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));
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mte01

ASKER

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.
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
Avatar of mte01

ASKER

Ok...I'll leave this question open for a few hours, and then give the proper credit. Thank you.
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?
Actually i'm not sure if JBCL is the (gui) package in question, but that's the general idea
Avatar of mte01

ASKER

>> 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).
>>in JBuilder 6.0 it's the complete opposite !!

Well that's a bit better ;-) You'll get a JBuilder user coming along soon
Avatar of doronb
doronb

@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
Avatar of mte01

ASKER

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:
https://www.experts-exchange.com/questions/21123594/Libaray-Settings-in-JAR-files.html

Thanks
>> ...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...
Avatar of mte01

ASKER

>> 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)
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.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mte01

ASKER

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 ;)
You're most welcome and look at my answer to your 2nd question.
8-)