java.awt.Canvas.setBackground()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中java.awt.Canvas.setBackground()方法的一些代码示例,展示了Canvas.setBackground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Canvas.setBackground()方法的具体详情如下:
包路径:java.awt.Canvas
类名称:Canvas
方法名:setBackground

Canvas.setBackground介绍

暂无

代码示例

代码示例来源:origin: uk.co.caprica/vlcj

  1. public MainFrame() {
  2. setTitle("MediaListPlayer Test");
  3. setBounds(100, 100, 800, 600);
  4. JPanel contentPane = new JPanel();
  5. contentPane.setLayout(new BorderLayout());
  6. canvas.setBackground(Color.black);
  7. contentPane.add(canvas, BorderLayout.CENTER);
  8. setContentPane(contentPane);
  9. }

代码示例来源:origin: com.b3dgs.lionengine/lionengine-core-awt

  1. /**
  2. * Prepare windowed mode.
  3. *
  4. * @param output The output resolution
  5. * @throws LionEngineException If unable to initialize windowed mode.
  6. */
  7. private void initWindowed(Resolution output)
  8. {
  9. final Canvas canvas = new Canvas(conf);
  10. canvas.setBackground(Color.BLACK);
  11. canvas.setEnabled(true);
  12. canvas.setVisible(true);
  13. canvas.setIgnoreRepaint(true);
  14. frame.add(canvas);
  15. canvas.setPreferredSize(new Dimension(output.getWidth(), output.getHeight()));
  16. frame.pack();
  17. frame.setLocationRelativeTo(null);
  18. ToolsAwt.createBufferStrategy(canvas, conf);
  19. buf = canvas.getBufferStrategy();
  20. // Set input listeners
  21. componentForKeyboard = canvas;
  22. componentForMouse = canvas;
  23. componentForCursor = frame;
  24. frame.validate();
  25. }

代码示例来源:origin: uk.co.caprica/vlcj

  1. public CaptureTest() {
  2. canvas = new Canvas();
  3. canvas.setBackground(Color.black);
  4. contentPane = new JPanel();
  5. contentPane.setBackground(Color.black);
  6. contentPane.setLayout(new BorderLayout());
  7. contentPane.add(canvas, BorderLayout.CENTER);
  8. frame = new JFrame("Capture");
  9. frame.setIconImage(new ImageIcon(getClass().getResource("/icons/vlcj-logo.png")).getImage());
  10. frame.setContentPane(contentPane);
  11. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  12. frame.setLocation(50, 50);
  13. frame.setSize(800, 600);
  14. factory = new MediaPlayerFactory();
  15. mediaPlayer = factory.mediaPlayers().newEmbeddedMediaPlayer();
  16. videoSurface = factory.videoSurfaces().newVideoSurface(canvas);
  17. mediaPlayer.videoSurface().set(videoSurface);
  18. }

代码示例来源:origin: uk.co.caprica/vlcj

  1. public ScreenTestPlayer() {
  2. canvas = new Canvas();
  3. canvas.setBackground(Color.black);
  4. canvas.setSize(550, 300);
  5. contentPane = new JPanel();
  6. contentPane.setBackground(Color.black);
  7. contentPane.setLayout(new BorderLayout());
  8. contentPane.add(canvas, BorderLayout.CENTER);
  9. frame = new JFrame("vlcj desktop capture");
  10. frame.setIconImage(new ImageIcon(getClass().getResource("/icons/vlcj-logo.png")).getImage());
  11. frame.setContentPane(contentPane);
  12. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  13. frame.pack();
  14. factory = new MediaPlayerFactory();
  15. mediaPlayer = factory.mediaPlayers().newEmbeddedMediaPlayer();
  16. videoSurface = factory.videoSurfaces().newVideoSurface(canvas);
  17. mediaPlayer.videoSurface().set(videoSurface);
  18. }

代码示例来源:origin: de.fosd.typechef/javabdd_repackaged

  1. canvas.setBackground(Color.lightGray);

代码示例来源:origin: uk.co.caprica/vlcj

  1. public PlayerInstance(EmbeddedMediaPlayer mediaPlayer) {
  2. this.mediaPlayer = mediaPlayer;
  3. this.videoSurface = new Canvas();
  4. this.videoSurface.setBackground(Color.black);
  5. mediaPlayer.events().addMediaPlayerEventListener(this);
  6. }

代码示例来源:origin: stackoverflow.com

  1. canvas.setBackground(display.getSystemColor(SWT.COLOR_DARK_GRAY));
  2. canvas.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

代码示例来源:origin: uk.co.caprica/vlcj

  1. canvas.setBackground(Color.black);

代码示例来源:origin: uk.co.caprica/vlcj

  1. @SuppressWarnings("serial")
  2. public ExclusiveFullScreenTest(String[] args) {
  3. Canvas c = new Canvas();
  4. c.setBackground(Color.red);

代码示例来源:origin: uk.co.caprica/vlcj

  1. videoCanvas.setBackground(Color.red);
  2. videoCanvas.setSize(720, 350);

代码示例来源:origin: uk.co.caprica/vlcj

  1. public static void main(String[] args) throws Exception {
  2. if(args.length != 1) {
  3. System.out.println("Specify a single MRL to stream");
  4. System.exit(1);
  5. }
  6. String media = args[0];
  7. String options = formatRtpStream("230.0.0.1", 5555);
  8. System.out.println("Streaming '" + media + "' to '" + options + "'");
  9. MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(args);
  10. EmbeddedMediaPlayer mediaPlayer = mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer();
  11. Canvas canvas = new Canvas();
  12. canvas.setBackground(Color.black);
  13. VideoSurface videoSurface = mediaPlayerFactory.videoSurfaces().newVideoSurface(canvas);
  14. mediaPlayer.videoSurface().set(videoSurface);
  15. JFrame f = new JFrame("vlcj duplicate output test");
  16. f.setIconImage(new ImageIcon(StreamRtpDuplicate.class.getResource("/icons/vlcj-logo.png")).getImage());
  17. f.add(canvas);
  18. f.setSize(800, 600);
  19. f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  20. f.setVisible(true);
  21. mediaPlayer.media().play(media,
  22. options,
  23. ":no-sout-rtp-sap",
  24. ":no-sout-standard-sap",
  25. ":sout-all",
  26. ":sout-keep"
  27. );
  28. // Don't exit
  29. Thread.currentThread().join();
  30. }

代码示例来源:origin: uk.co.caprica/vlcj

  1. public FullScreenMultiMediaTest(String[] args) {
  2. Canvas c = new Canvas();
  3. c.setBackground(Color.black);

代码示例来源:origin: stackoverflow.com

  1. canvas.setBackground(display.getSystemColor(SWT.COLOR_WHITE));

代码示例来源:origin: uk.co.caprica/vlcj

  1. vs.setBackground(Color.black);
  2. cp.add(vs, BorderLayout.CENTER);

代码示例来源:origin: uk.co.caprica/vlcj

  1. canvas.setBackground(Color.black);

代码示例来源:origin: uk.co.caprica/vlcj

  1. public FullScreenTest(String[] args) {
  2. Canvas c = new Canvas();
  3. c.setBackground(Color.black);

代码示例来源:origin: uk.co.caprica/vlcj

  1. canvas.setBackground(Color.black);

代码示例来源:origin: uk.co.caprica/vlcj

  1. canvas.setBackground(Color.black);

代码示例来源:origin: uk.co.caprica/vlcj

  1. canvas.setBackground(Color.black);
  2. VideoSurface videoSurface = mediaPlayerFactory.videoSurfaces().newVideoSurface(canvas);

代码示例来源:origin: uk.co.caprica/vlcj

  1. c.setBackground(Color.black);
  2. c.setBounds(0, 0, 1000, 900);
  3. o1.setBackground(Color.green);
  4. o1.setBounds(100, 60, 200, 300);
  5. o2.setBackground(Color.red);
  6. o2.setBounds(400, 200, 150, 150);
  7. o3.setBackground(Color.blue);
  8. o3.setBounds(50, 500, 200, 200);

相关文章