/**
     * Instructs the layout manager to perform the layout for the specified container.
     *
     * @param the Container for which this layout manager is being used
     */
    public void layoutContainer(Container parent) {
      JRootPane root = (JRootPane) parent;
      Rectangle b = root.getBounds();
      Insets i = root.getInsets();
      int nextY = 0;
      int w = b.width - i.right - i.left;
      int h = b.height - i.top - i.bottom;

      if (root.getLayeredPane() != null) {
        root.getLayeredPane().setBounds(i.left, i.top, w, h);
      }
      if (root.getGlassPane() != null) {
        root.getGlassPane().setBounds(i.left, i.top, w, h);
      }
      // Note: This is laying out the children in the layeredPane,
      // technically, these are not our children.
      if (root.getWindowDecorationStyle() != JRootPane.NONE
          && (root.getUI() instanceof HokageRootPaneUI)) {
        JComponent titlePane = ((HokageRootPaneUI) root.getUI()).getTitlePane();
        if (titlePane != null) {
          Dimension tpd = titlePane.getPreferredSize();
          if (tpd != null) {
            int tpHeight = tpd.height;
            titlePane.setBounds(0, 0, w, tpHeight);
            nextY += tpHeight;
          }
        }
      }
      if (root.getMenuBar() != null) {
        Dimension mbd = root.getMenuBar().getPreferredSize();
        root.getMenuBar().setBounds(0, nextY, w, mbd.height);
        nextY += mbd.height;
      }
      if (root.getContentPane() != null) {
        Dimension cpd = root.getContentPane().getPreferredSize();
        root.getContentPane().setBounds(0, nextY, w, h < nextY ? 0 : h - nextY);
      }
    }
 /**
  * Reshape the receiver. The offscreen Image is destroyed, the component is laid out and
  * repainted.
  *
  * @see java.awt.Component
  * @see layoutComponent
  */
 public void setBounds(int x, int y, int width, int height) {
   super.setBounds(x, y, width, height);
   layoutComponent();
   repaint();
 }
  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));
  }