• Post Reply Bookmark Topic Watch Topic
  • New Topic

AWT Applet  RSS feed

 
Luke Thomson
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created an applet using swing but I require an awt version. I can not understand how to create the container, the below line works as a Swing applet but not as awt. Can anyone please explain to me how to solve this and why it does not work?



Also I cannot understand how to create borders in awt:
southPanel.setBorder(BorderFactory.createMatteBorder(6, 0, 0, 0, bgColor));

Any help is appreciated,
Luke
 
Rob Spoor
Sheriff
Posts: 21050
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are no content panes in AWT, you just work on the applet itself. So just replace "container" with "this" (or omit "container." altogether).

As for borders, technically there is no support for borders in AWT - it's a Swing something. However, you could possibly mimic their behaviour.

Step 1 is overriding the getInsets method, to include the border's insets. Second is calling the border's paintBorder method with the component's bounds. Because the component will (should) not paint within its insets, the border should not be painted over.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!