Created
December 12, 2013 23:08
-
-
Save resarahadian/7937195 to your computer and use it in GitHub Desktop.
Membuat Minimize, Maximize, dan Close Frame dengan JButton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JPanel; | |
import java.awt.Color; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
@SuppressWarnings("serial") | |
public class ClPanelTransparant extends JPanel | |
{ | |
private Color clr; | |
public ClPanelTransparant() | |
{ | |
setOpaque(false); | |
clr = new Color(getBackground().getRed(), getBackground().getRed(), getBackground().getGreen(),90); | |
} | |
public void setBackground(Color bg) | |
{ | |
super.setBackground(bg); | |
clr = new Color(getBackground().getRed(), getBackground().getRed(), getBackground().getGreen(),90); | |
repaint(); | |
} | |
protected void paintComponent(Graphics graph) | |
{ | |
super.paintComponent(graph); | |
Graphics2D g2d = (Graphics2D) graph.create(); | |
g2d.setColor(clr); | |
g2d.fillRect(0, 0, getWidth(), getHeight()); | |
g2d.dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment