Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

AWT Panels with Borders  RSS feed

 
Dave Matthews
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to display an AWT Panel with a simple line border, I dont want to use swing and have seen a couple of custom examples on the web, do I have to use one of those or am I missing something simple?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Borders were added in Swing, so an AWT Panel has no idea what a Border is... you'll either have to use a JPanel, or use or create a custom Panel implementation... it's pretty simple actually, just draw a rectangle slightly smaller than the Panel in the Panel's paint() method...
 
Bill Liteplo
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave,
I'm curious as to why to don't want to use Swing. Too buggy? Slow?
Bill
P.S. Nice work on "Under The Table And Dreaming"
 
Dave Matthews
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the answers, I kind of guessed that I'd have to manually do it. The reason that I dont want to use swing is because its for an applet so I dont want to force users to download and use the Sun VM as 90% will just be using their default IE Microsoft VM which from what I can see doesnt support swing. If there is a way round this then I'd really appreciate hearing about it
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i think IE do supports swings or JApplets, only difference is that we have to use Object tag.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
IE can use the Object tag to support Swing in applets, but the user still has to download the Java 2 Plugin...

Here's some simple code illustrating an AWT Panel with a border...

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!