透明なウィンドウ ( AWTUtilities.setWindowOpaque(window, false) ) のテキストは正しくアンチエイリアス処理されず、不透明なウィンドウとは異なって見えます。
JDK 7.40 を使用しています。
それを回避する方法はありますか?
以下のプログラムでは、ボタンのテキストは (正しく) アンチエイリアス処理されていません。setWindowOpaque() を削除すると、アンチエイリアシングが修正されます。
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import com.sun.awt.AWTUtilities;
public class TransparentFrame extends JFrame
{
public TransparentFrame()
{
setUndecorated(true);
AWTUtilities.setWindowOpaque(this, false);
add(new JButton(new ExitAction()));
}
public static void main(String[] args)
{
JFrame frame = new TransparentFrame();
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
private class ExitAction extends AbstractAction
{
public ExitAction()
{
super("Exit");
}
@Override
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
}
}