public void paintComponent(Graphics g) {
      super.paintComponent(g);

      Graphics2D g2 = (Graphics2D) g;

      if (!text.equals("")) {
        g2.translate(0, getSize().getHeight());
        g2.rotate(-Math.PI / 2);
        g2.setColor(Color.black);
        g2.drawString(text, 20, 14);

        g2.translate(0, -getSize().getHeight());
        g2.transform(AffineTransform.getQuadrantRotateInstance(1));
      }
    }
    public void setText(String txt) {
      text = txt;
      textlabel.repaint();
      if (!text.equals("")) {
        if (!isVisible()) {
          // Only setVisible if its needed
          // or the focus window will change
          toFront();
          setVisible(true);
        }

        // Give focus to capture window if its there
        if (cw.isVisible()) cw.requestFocus();
      } else {
        // Hide window
        setVisible(false);
      }
    }
  protected void layout1024() {

    // 640x480, Creative camera for layout1024
    size_x = 1024;
    size_y = 768;
    sizeCaptureWindow_x = 680;
    sizeCaptureWindow_y = 480;
    cwLocation_x = cwLocation_y = 0;

    // Borders in relation to a normal screen (not the rotated)
    int border_top, border_left, border_right, border_bottom;
    border_top = border_bottom = border_left = 50 * 2; // Top, left, right when rotated
    border_right = 80 * 2; // Bottom when rotated

    txt_location_x = border_left;
    txt_location_y = border_top;
    txt_size_x = 18;
    txt_size_y = size_y - border_bottom - txt_location_y;

    imagepanels = new WebcamCaptureAndFadeImagePanel[1];
    imagepanels[0] =
        new WebcamCaptureAndFadeImagePanel(
            1,
            1,
            // Size of each image frame in x direction
            size_x - border_left - border_right,
            // Size of each image frame in y direction
            size_y - border_top - border_bottom);

    // setSize(size_x, size_y);

    setLayout(null);

    JComponent jcomp =
        new JComponent() {

          /** */
          private static final long serialVersionUID = 1L;

          @Override
          protected void paintComponent(Graphics g) {

            Graphics2D g2 = (Graphics2D) g;

            g2.setColor(Color.white);
            g2.fillRect(0, 0, size_x, size_y);

            super.paintComponent(g);
          }
        };
    datetext = new rotatedText2("");

    add(datetext);
    datetext.setBounds(size_x - 35, 10, 40, 100);

    add(jcomp);
    jcomp.setBounds(0, 0, size_x, size_y);

    add(imagepanels[0]);
    imagepanels[0].setBounds(
        border_top,
        border_left,
        size_x - border_right - border_left,
        size_y - border_top - border_bottom);

    enable_datetext = true;
    enable_forceNewImage = true;
    captureWindow = true;
    number_of_frames_redborder = -1;

    // Set capture window at center of the screen
    cwLocation_x = (size_x / 2) - (sizeCaptureWindow_x / 2);
    cwLocation_y = (size_y / 2) - (sizeCaptureWindow_y / 2);

    setSize(size_x, size_y);
    setBounds(0, 0, 200, 200);
    setPreferredSize(new Dimension(size_x, size_y));
  }