4

subtitle player applicationフルスクリーンでフラッシュビデオを再生している間でもトップに留まるUbuntu 12.04用のシンプルなものを書こうとしています。このアプリケーションは、Windows で素晴らしい動作をするGreenfish Subtitle Playerに似ています。

私の質問は、どうすればこれを行うことができますか? 私はJavaでスニペットを試していました(以下にリストされています。このリンクから取得し、含めるように変更しましたsetAlwaysOnTop())。これにより、JFrameが一番上に表示されますが、フラッシュビデオがフルスクリーンになったときは表示されません。私のコード:

import java.awt.*; //Graphics2D, LinearGradientPaint, Point, Window, Window.Type;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

/**
 * From JavaMagazine May/June 2012
 * @author josh
 */
public class ShapedAboutWindowDemo {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        //switch to the right thread
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrame frame = new JFrame("About box");
                //turn of window decorations
                frame.setUndecorated(true);
                frame.setAlwaysOnTop(true);
                //turn off the background
                frame.setBackground(new Color(0,0,0,0));
                frame.setContentPane(new AboutComponent());
                frame.pack();
                //size the window
                frame.setSize(500, 200);
                frame.setVisible(true);
                //center on screen
                frame.setLocationRelativeTo(null);
            }
        }
        );
    }

    private static class AboutComponent extends JComponent {
        public void paintComponent(Graphics graphics) {
            Graphics2D g = (Graphics2D) graphics;

            //create a translucent gradient
            Color[] colors = new Color[]{
                           new Color(0,0,0,0)
                            ,new Color(0.3f,0.3f,0.3f,1f)
                            ,new Color(0.3f,0.3f,0.3f,1f)
                            ,new Color(0,0,0,0)};
            float[] stops = new float[]{0,0.2f,0.8f,1f};
            LinearGradientPaint paint = new LinearGradientPaint(
                                        new Point(0,0), new Point(500,0),
                                        stops,colors);
            //fill a rect then paint with text
            g.setPaint(paint);
            g.fillRect(0, 0, 500, 200);
            g.setPaint(Color.WHITE);
            g.drawString("My Killer App", 200, 100);
        }
    }
}

これが Ubuntu/Linux で可能かどうか、可能であればその方法を教えてください。Java を使用できない場合は、他の言語に切り替えることができます。

4

0 に答える 0