Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 561
  • Last Modified:

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?
0
mte01
Asked:
mte01
  • 10
  • 8
  • 5
2 Solutions
 
CEHJCommented:
>>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
 
CEHJCommented:
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
 
CEHJCommented:
>>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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
mte01Author Commented:
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
 
CEHJCommented:
>>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
 
mte01Author Commented:
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
 
CEHJCommented:
testPanel.setLayout(null);
testPanel.add(testButton);
testButton.setLocation(10, 25);
0
 
mte01Author Commented:
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
 
CEHJCommented:
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
 
mte01Author Commented:
Ok...I'll leave this question open for a few hours, and then give the proper credit. Thank you.
0
 
CEHJCommented:
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
 
CEHJCommented:
Actually i'm not sure if JBCL is the (gui) package in question, but that's the general idea
0
 
mte01Author Commented:
>> 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
 
CEHJCommented:
>>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
 
doronbCommented:
@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
 
mte01Author Commented:
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
 
doronbCommented:
>> ...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
 
mte01Author Commented:
>> 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
 
doronbCommented:
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
 
doronbCommented:
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
 
mte01Author Commented:
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
 
doronbCommented:
You're most welcome and look at my answer to your 2nd question.
0
 
CEHJCommented:
8-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

  • 10
  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now