Skip to content

Latest commit

 

History

History
10 lines (8 loc) · 705 Bytes

File metadata and controls

10 lines (8 loc) · 705 Bytes

Overlapping JFrame components

How to overlapp a JFrame component over Graphics ( Java ) https://github.com/jotaaloud

I was having trouble trying to paint a JLabel/JButton(Java.awt.*) over a Rect(java.awt.Graphics), to change the color of the Rect or to add new Polygons.
This is a repo to explain with a few words how to fix it.

  1. Add the JFrame elements
  2. Add the Graphics g function and its components
  3. Write the 'setBounds' and add the JFrame components AFTER the graphics. You have to do this step INSIDE the Graphics function