protected void layout1280() { // Resolution of the camera pictures divided by 2 // 320x240, Creative camera for layout1280 size_x = 320 / 2; size_y = 240 / 2; sizeCaptureWindow_x = size_x * 2; sizeCaptureWindow_y = size_y * 2; imagepanels = new WebcamCaptureAndFadeImagePanel[4]; imagepanels[0] = new WebcamCaptureAndFadeImagePanel(3, 8, size_x, size_y); imagepanels[1] = new WebcamCaptureAndFadeImagePanel(2, 3, size_x, size_y); imagepanels[2] = new WebcamCaptureAndFadeImagePanel(2, 3, size_x, size_y); imagepanels[3] = new WebcamCaptureAndFadeImagePanel(3, 8, size_x, size_y); setLayout(new BorderLayout()); setSize((4 + 2 + 4) * size_x, (6) * size_y); add(imagepanels[0], BorderLayout.WEST); JPanel middle = new JPanel(new BorderLayout()); middle.add(imagepanels[1], BorderLayout.NORTH); if ((comp = player.getVisualComponent()) != null) { middle.add(comp, BorderLayout.CENTER); } middle.add(imagepanels[2], BorderLayout.SOUTH); middle.setSize(new Dimension(4 * size_x, 2 * size_y)); add(middle, BorderLayout.CENTER); add(imagepanels[3], BorderLayout.EAST); enable_datetext = false; enable_forceNewImage = false; captureWindow = false; txt_location_x = txt_location_y = 0; txt_size_x = 18; txt_size_y = size_y; }
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; AlphaComposite ac, ac2 = null; ac2 = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f); for (int i = 0; i < imagenum_now.length; i++) { for (int j = 0; j < imagenum_now[i].length; j++) { // System.out.println("x: " + i + ", y: " + j); g2.setComposite(ac2); if (imagenum_now[i][j] != -1) { g2.drawImage( // images.get(imagenum_now[i][j]) // getImage(images.get(imagenum_now[i][j])), imagenum_now2[i][j], i * size_x, j * size_y, size_x, size_y, this); } else { // No picture found, ignoring // System.out.println("imagenum_now["+i+"]["+j+"] = -1"); } try { ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, fade[i][j]); } catch (IllegalArgumentException e) { ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f); } g2.setComposite(ac); if (imagenum_next[i][j] != -1) { g2.drawImage( // images.get(imagenum_next[i][j]), // getImage(images.get(imagenum_next[i][j])), imagenum_next2[i][j], i * size_x, j * size_y, size_x, size_y, this); } else { // No picture found, ignoring // System.out.println("imagenum_now["+i+"]["+j+"] = -1"); } /* if(i == 0 && j == 0) System.out.println("" + imagenum_now[i][j] + " => " + imagenum_next[i][j] + ", fade: "+fade[i][j]);; */ // Red border if the image is new if (number_of_frames_redborder != -1 && (images_nevershown.contains((Integer) imagenum_next[i][j]) || images_nevershown.contains((Integer) imagenum_now[i][j]))) { g2.setComposite(ac2); g2.setColor(color_redborder); int bordertime = redborder[i][j]; if (bordertime > 0) { // Draw border g2.drawRect(i * size_x, j * size_y, size_x - 1, size_y - 1); if (bordertime > number_of_frames_redborder) { // No more border redborder[i][j] = -number_of_frames_redborder; } } redborder[i][j]++; } } } }