Olá Desenvolvedores.
por que não há como mudar a opacidade em uma janela decorada ?????? :cry: :cry: :cry:
[url]http://javafree.uol.com.br/topic-882662-Janelas-transparentes.html[/url]
gostaria de saber se há como deixar a tela transparente sem utilizar isso:
JFrame.setDefaultLookAndFeelDecorated(true);
pra que a borda da tela fique com uma aparência melhor, o único modo que encontrei pra fazer isso é usando o setUndecorated(true).
também não estou conseguindo usar este comando:
com.sun.awt.AWTUtilities.setWindowOpacity
minha versão é o jdk 7.
Valeu gente !
import static java.awt.GraphicsDevice.WindowTranslucency.TRANSLUCENT;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class test extends JFrame{
public test() {
super("Test");
setLayout(new GridBagLayout());
setSize(300,200);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
add(new JButton("Button"));
}
public static void main(String[] args) {
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) {
System.err.println(
"Translucency is not supported");
System.exit(0);
}
JFrame.setDefaultLookAndFeelDecorated(true);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
test ts = new test();
ts.setOpacity(0.55f);
ts.setVisible(true);
}
});
}
}