• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Borders

 
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How to make Borders in AWT?(NOT SWING)
Thanks,
Angela
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Angela,
Since AWT uses native OS to draw UI objects there is no concept of borders that java can control ...
Want borders, start the music ... Swing!
Regards,
Manfred.
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Manfred
Is there other solution with AWT through which I can make UI like Borders?
Thanks,
Angela
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

-Nate

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.
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Thanks again,
Angela
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"...

HTH,
-Nate
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic