An open API service indexing awesome lists of open source software.

https://github.com/jotaaloud/overlappingjframecomponents

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

color components java jframe tutorial

Last synced: 11 months ago
JSON representation

How to overlapp a JFrame component over Graphics ( Java )

Awesome Lists containing this project

README

          

## Overlapping JFrame components
How to overlapp a JFrame component over Graphics ( Java )
![https://github.com/jotaaloud](https://github.com/jotaaloud/overlappingJFrameComponents/blob/9b623ce9ca659ee2496e5790059856479427ca08/src/files/beforeAfter.jpg)

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