Sorry, should have specify that. Think its the lack of sleep...
But pulling a third day without sleep i finally sort it out.
when compiled, one should see a gradient transparent effect from right to left on a JPanel placed on a JForm, without effecting other components and the JFrame as Undecorated.
import java.awt.*;
import javax.swing.*;
public class Test extends JFrame{
private JPanel Panel1;
private JButton Button1;
Test() {
Panel1 = new JPanel() {
public void paintComponent(Graphics grh) {
int H = this.getHeight();
int W = this.getWidth();
Paint p = new GradientPaint(0.0f, 0.0f, new Color(240, 240, 240, 0),
0, H, new Color(0, 0, 240, 255));
Graphics2D g2d = (Graphics2D) grh;
g2d.setPaint(p);
g2d.fillRect(0, 0, W, H);
}
};
Button1 = new JButton("Click me");
Button1.setBounds(30, 30, 200, 200);
Panel1.setOpaque(false);
Panel1.setDoubleBuffered(false);
Panel1.setBackground(new Color(240, 240, 240, 128));
Panel1.add(Button1);
this.getContentPane().add(Panel1);
this.setUndecorated(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setSize(400, 400);
this.setLocationRelativeTo(null);
this.setVisible(true);
}
public static void main(String[] args) {
Test t = new Test();
com.sun.awt.AWTUtilities.setWindowOpaque(t, false);
}
}
Thanks for having a look and trying...
at least i can go sleep now...