Java JPanel Child wrapMacFancy(JPanel content)

Here you can find the source of wrapMacFancy(JPanel content)

Description

wrap Mac Fancy

License

LGPL

Declaration

public static JPanel wrapMacFancy(JPanel content) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.awt.BorderLayout;
import java.awt.Color;

import java.awt.Graphics;
import java.awt.Graphics2D;

import java.awt.RenderingHints;

import javax.swing.JPanel;

public class Main {
    public static JPanel wrapMacFancy(JPanel content) {
        JPanel panel = new JPanel(new BorderLayout()) {

            private static final long serialVersionUID = 941275105778632480L;

            @Override/*ww  w. j a  va2 s  .c  om*/
            public void paintComponent(Graphics g) {
                Color border = new Color(64, 64, 64, 64);
                Color bg = new Color(128, 128, 128, 64);

                Graphics2D g2 = (Graphics2D) g;
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                g2.setColor(bg);
                g2.fillRoundRect(1, 1, this.getWidth() - 2, this.getHeight() - 2, 10, 10);
                g2.setColor(border);
                g2.drawRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 10, 10);
            }
        };

        panel.setOpaque(false);
        content.setOpaque(false);
        panel.add(content, BorderLayout.CENTER);

        return panel;
    }
}

Related

  1. removePanel(JPanel parent, JPanel panel)
  2. resetControlsInAPanel(JPanel panel)
  3. resizeJPanel(JPanel p)
  4. unmaskContainer(JPanel pnl)
  5. wrapInMinimizer(JPanel panel)