If I have only one component, is it safe to use AWT in JFrame?

I have heard quite a few times so as not to mix the components Swingand AWT(heavy and light).

But what if I say only one component showing on JFrameat a time. So far, what I saw, the main thing is that the AWTcomponents are always on top, but, as I said, if I only have one component at a JFrametime, what is important?

EDIT : all I need to do is draw with AWT Canvas. I use this for the game, so I will need it BufferStrategy.

So, I think, my question is: is there still a good reason not to mix components AWTand Swingeven if you only display one component at a JFrametime?

Also , I’ve only worked with him since Canvasin JFrame, so what are the benefits of switching to Swing?

in advance :-)

+3
source share
3 answers
  • you need to use AWT components for high-performance painting, multimedia or vector graphics Graphics from OpenGL, CAD / CAM ei

  • You can use AWT components with Swing JComponents only if you have a really important reason, for example, a point or event from Swing / buggy or a regular bug in BugParade

  • I would suggest not mixing AWT with Swing and vice versa

  • AWT , , Native OS

  • dis_advantage AWT,

  • Swing AWT-

+4

.. JPanel Swing Canvas?

, paintComponent(Graphics), paint(Graphics)

+3

, , . AWT Swing , , . , , , , .

Swing AWT, , , , , , AWT.

The real question here should be if there is a way to do what you need to do without using AWT? Give us some guidance on what you need to do, maybe there is a way to do this with Swing.

+2
source

All Articles