It would be difficult to replicate all the functionality of the Borders provided by Swing, however, if you only want to implement a few types of Borders it is (relatively) easy, though a bit complicated, since you have to build the specialized components yourself ( basically, you would have to extend Panel to draw the border and hold your object in the center )... could you specify what kind of border you want?
P.S. - I notice that there are alot of posts on here about how to implement Swing-like functionality in AWT components. This is understandable, since Swing is not useable in unmodified browsers... However, what I do not understand is the people who always have the quick answer, "You cannot do that in AWT... use SWING!" Guess what... anything that can be done in Swing can be done in AWT, because Swing is based on the AWT... Sure, it would be easier to just use Swing... but if you only need a small part of the functionality of Swing, why include all the Swing libraries in a huge jar file for your applet or force your users to download the Java plug-in? I personally can't wait until Swing is usable "out of the box" in browsers, but until then the best solution is probably custom AWT components... and you can develop any component or functionality that exists in Swing ( or even ones that do not! *Gasp!* Creative potential! What an underdeveloped commodity! ) in the AWT.
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Nov 27, 2000
Thanks a bunch Nathan Right now I am developing some GUI functionality in my project.Now I want to make Tabel object with the use of AWT. So I was thinking to make labels with simple borders. But If you have solution or sample example which has table object, please let me know.
Hmmm.... you are going to try to use the borders to build a table... You could do that, but it would be very, very messy... you would have to have a Panel and another component ( Like a textfield ) for each element in the table... That would be alot of objects and would be really slow... Is this going to be an editable or a non-editable table (i.e. is the user actually going to need to enter data into it, or is information just going to be displayed as a table)?
If the table is used only for output, you could just use a Canvas to draw the table on, and draw the data inside the cells you have drawn. Throw this canvas inside a scrollpane and you have a table!
On the other hand, if the user needs to edit the data you will have to either have a textfield for every cell in the table (bad...) or come up with some scheme that uses a drawn canvas like I described above, and uses only one textbox... when the user clicks in a "cell" of the table this calls a mouse listener, that creates a textbox "over" the cell and lets the user enter data... when the textbox loses focus, the user is done, so remove the textbox and add the value the user entered to the table... Much more difficult, but still "do-able"...