Example #1
0
  // Ordnet die TermPanels manuell ohne LayoutManager untereinander an.
  // Besser nicht anfassen, fragil!
  private void addTerminals(JPanel panel) {

    // Wir geben dem Panel einen schmalen Rand. Sieht besser aus
    panel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    // Kein LayoutManager
    panel.setLayout(null);

    // TermPanels zu Panel hinzufügen - ggf. Fokus entfernen.
    panel.add(topTerm.panel());
    topTerm.panel().setFocusable(false);

    panel.add(mainTerm.panel());

    panel.add(bottomTerm.panel());
    bottomTerm.panel().setFocusable(false);

    // Insets des Panels
    Insets insets = panel.getInsets();

    // Positionierung TopZeile
    Dimension sizeTop = topTerm.panel().getPreferredSize();
    topTerm
        .panel()
        .setBounds(
            insets.left, insets.top,
            sizeTop.width, sizeTop.height);

    // Positionierung Karte
    Dimension sizeMain = mainTerm.panel().getPreferredSize();
    mainTerm
        .panel()
        .setBounds(insets.left, insets.top + sizeTop.height, sizeMain.width, sizeMain.height);

    // Positionierung BottomZeile
    Dimension sizeBottom = bottomTerm.panel().getPreferredSize();
    bottomTerm
        .panel()
        .setBounds(
            insets.left,
            insets.top + sizeTop.height + sizeMain.height,
            sizeBottom.width,
            sizeBottom.height);

    // Setzen der Panelgröße.
    panel.setPreferredSize(
        new Dimension(
            sizeMain.width + insets.left + insets.right,
            sizeTop.height + sizeMain.height + sizeBottom.height + insets.top + insets.bottom));
  }
Example #2
0
  protected void layoutItems() {
    Insets insets = main.getInsets();
    Dimension size = new Dimension();

    int xOff = 12 + insets.left;
    int yOff = 57;

    xOff += layoutXOffAdjustment;
    yOff += layoutYOffAdjustment;

    int x = 0;
    int y = yOff;

    Rectangle b = main.getBounds();

    for (T item : itemList) {
      size = item.getPreferredSize();
      lc.itemsPerRow = (b.height - yOff) / (size.height + layoutItemHeightAdjustment);

      item.setBounds(xOff + x, y + insets.top, size.width, size.height);

      y += size.height + layoutItemHeightAdjustment;

      if (!layoutHeightOnly) {
        if (y + size.height > b.height) {
          x += size.width + xOff;
          y = yOff;
        }
      }
    }

    Dimension d = main.getPreferredSize();
    d.width = x + size.width + xOff * 2;
    if (layoutHeightOnly) {
      d.height = y + size.height + yOff;
    }
    main.setPreferredSize(d);

    main.repaint();
  }
Example #3
0
  // --------------------------------initGUI------------------------------------
  public void initGUI() {
    bDeployed = bOpponentDeployed = false;
    listAT = new LinkedList();

    frame.setJMenuBar(new GameMenuBar(this));
    panParty = new PartyPanel(200, 480);
    panStatus = new JPanel(null);
    oMap = new Map(600, 350);
    panChat = new ChatPanel(600, 200);

    Container contentPane = frame.getContentPane();

    panParty.setOpaque(true);
    panStatus.setOpaque(true);
    panChat.setOpaque(true);

    panStatus.setPreferredSize(new Dimension(200, 70));

    contentPane.add(panStatus);
    contentPane.add(panParty);
    contentPane.add(oMap);
    contentPane.add(panChat);

    SpringLayout oLayout = new SpringLayout();
    contentPane.setLayout(oLayout);

    oLayout.putConstraint(SpringLayout.WEST, panParty, 0, SpringLayout.WEST, contentPane);
    oLayout.putConstraint(SpringLayout.NORTH, panParty, 0, SpringLayout.NORTH, contentPane);
    oLayout.putConstraint(SpringLayout.WEST, panStatus, 0, SpringLayout.WEST, contentPane);
    oLayout.putConstraint(SpringLayout.SOUTH, panStatus, 0, SpringLayout.SOUTH, contentPane);
    oLayout.putConstraint(SpringLayout.EAST, oMap, 0, SpringLayout.EAST, contentPane);
    oLayout.putConstraint(SpringLayout.NORTH, oMap, 0, SpringLayout.NORTH, contentPane);
    oLayout.putConstraint(SpringLayout.WEST, panChat, 0, SpringLayout.EAST, panStatus);
    oLayout.putConstraint(SpringLayout.NORTH, panChat, 0, SpringLayout.SOUTH, oMap);
    oLayout.putConstraint(SpringLayout.EAST, contentPane, 0, SpringLayout.EAST, panChat);
    oLayout.putConstraint(SpringLayout.SOUTH, contentPane, 0, SpringLayout.SOUTH, panChat);

    panChat.validate();
    panChat.setVisible(true);

    Insets oInsets = panStatus.getInsets();
    int nX = oInsets.left + 5;
    int nY = oInsets.top + 5;

    lblStatus1 = new JLabel("Not Connected...");
    lblStatus2 = new JLabel("No Party Formed...");
    lblStatus3 = new JLabel();

    Dimension oSize = lblStatus1.getPreferredSize();

    lblStatus1.setBounds(nX, nY, 180, oSize.height);
    nY += oSize.height + 7;
    lblStatus2.setBounds(nX, nY, 180, oSize.height);
    nY += oSize.height + 7;
    lblStatus3.setBounds(nX, nY, 180, oSize.height);

    panStatus.add(lblStatus1);
    panStatus.add(lblStatus2);
    panStatus.add(lblStatus3);

    frame.pack();
    frame.setResizable(false);
    frame.setLocation(
        ((scrBounds.x + scrBounds.width - frame.getWidth()) / 2),
        ((scrBounds.y + scrBounds.height - frame.getHeight()) / 2));

    oMap.addKeyListener(oMap);
    oMap.setButtonEvents(this);
  }
  /**
   * Creates a new instance of CategoryPropertyRenderer
   *
   * @param property an instance of XmlCategory
   * @param ignoreCategory true if it must only render the sub items of the given category
   */
  public CategoryPropertyRenderer(XmlCategory category, boolean ignoreCategory) {
    super(new GridBagLayout());

    this.category = category;

    this.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    this.setAlignmentX(0.0f);
    this.setAlignmentY(0.0f);

    int y = 1;
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.anchor = gbc.LINE_START;

    if (!ignoreCategory) {
      gbc.gridx = 1;
      gbc.gridy = y;
      gbc.gridheight = 1;
      gbc.gridwidth = 1;
      gbc.anchor = gbc.WEST;
      //            gbc.anchor = gbc.FIRST_LINE_START;
      //            gbc.weightx = 1;
      //            gbc.weighty = 0;
      gbc.insets = new Insets(0, 0, 3, 0);

      JLabel title =
          new JLabel(
              "<html><u><font color=\"#FF0000\">" + category.getLabel() + "</font></u></html>");

      if (DEBUG) {
        title.setBackground(Color.PINK);
        title.setOpaque(true);
      }

      title.setHorizontalTextPosition(SwingConstants.RIGHT);
      title.setAlignmentX(0.0f);

      if (category.getIcon() != null) {
        if (category.getIcon().trim().length() > 0) {
          try {
            title.setIcon(ResourceLoader.getInstance().getIconNamed(category.getIcon()));
          } catch (ResourceException e) {
            e.printStackTrace();
          }
        }
      }

      this.add(title, gbc);

      y += 2;
    }

    int separatorStart = y;

    /* add elements recursively */
    if (this.category != null) {
      if (this.category.getItems() != null) {
        Iterator<XmlPropertyContainer> it = this.category.getItems().iterator();

        while (it.hasNext()) {
          Object current = it.next();

          boolean added = false;

          if (current instanceof XmlProperty) {
            XmlProperty property = (XmlProperty) current;

            PropertyEditor editor = EditorPropertiesComponentFactory.editProperty(property);

            if (editor != null) {
              /* create property label */
              JLabel label = EditorPropertiesComponentFactory.createLabel(property);
              editor.setLabel(label);

              JComponent[] components = new JComponent[2];
              components[0] = label;
              components[1] = editor.getComponent();

              for (int i = 0; i < components.length; i++) {
                JComponent component = components[i];
                if (component != null) {
                  if (!added) added = true;

                  gbc = new GridBagConstraints();

                  gbc.gridx = i + 1;
                  gbc.gridy = y;
                  gbc.gridheight = 1;
                  gbc.gridwidth = 1;
                  //                                    gbc.weightx = 1;
                  //                                    gbc.weighty = 0;
                  gbc.anchor = gbc.FIRST_LINE_START;

                  gbc.anchor = gbc.WEST;

                  gbc.insets = new Insets(0, LEFT_BORDER, 0, 0);
                  component.setAlignmentX(0.0f);
                  component.setAlignmentY(0.0f);
                  this.add(component, gbc);
                }
              }
            }
          } else if (current instanceof XmlCategory) {
            gbc = new GridBagConstraints();

            gbc.gridx = 1;
            gbc.gridy = y;
            gbc.gridheight = 1;
            gbc.gridwidth = 10;
            gbc.insets = new Insets(0, LEFT_BORDER, 0, 0);
            gbc.anchor = gbc.WEST;
            //                        gbc.weightx = 1;
            //                        gbc.weighty = 0;
            added = true;
            JPanel panel = EditorPropertiesComponentFactory.renderCategory((XmlCategory) current);
            //                        JPanel panel =
            // EditorPropertiesComponentFactory.renderCategoryItems( (XmlCategory)current );

            panel.setAlignmentX(0.0f);
            panel.setAlignmentY(0.0f);

            if (DEBUG) {
              panel.setBackground(Color.GREEN);

              System.out.println("sub category : " + ((XmlCategory) current).getLabel());

              System.out.println("ajout avec contrainte : ");
              System.out.println("\tgridx : " + gbc.gridx);
              System.out.println("\tgridy : " + gbc.gridy);
              System.out.println("\tanchor : " + gbc.anchor);
              System.out.println("\tfill : " + gbc.fill);
              System.out.println("\tgridheight : " + gbc.gridheight);
              System.out.println("\tgridwidth : " + gbc.gridwidth);
              System.out.println("\tinsets : " + gbc.insets);
              System.out.println("\tipadx : " + gbc.ipadx);
              System.out.println("\tipady : " + gbc.ipady);
              System.out.println("\tweightx : " + gbc.weightx);
              System.out.println("\tweighty : " + gbc.weighty);

              System.out.println("panel properties : ");
              System.out.println("\tpanel align x : " + panel.getAlignmentX());
              System.out.println("\tpanel align y : " + panel.getAlignmentY());
              System.out.println("\tborder : " + panel.getBorder());
              System.out.println("\tinsets : " + panel.getInsets());
            }

            this.add(panel, gbc);
          }

          if (added) {
            y += 2;
            gbc = new GridBagConstraints();
            gbc.gridy = y;
            this.add(new JToolBar.Separator(new Dimension(2, 2)), gbc);

            y += 1;

            if (current instanceof XmlCategory) {
              gbc = new GridBagConstraints();
              gbc.gridy = y;
              this.add(new JToolBar.Separator(new Dimension(2, 2)), gbc);

              y += 1;
            }
          }
        }

        /* add a JSeparator to group elements of this category */
        //                gbc.gridx      = 1;
        //                gbc.gridy      = separatorStart;
        //                gbc.gridwidth  = 1;
        //                gbc.gridheight = y - separatorStart;
        //                gbc.insets     = new Insets(0, 0, 0, 0);
        //
        //                System.out.println("height : " + (y - separatorStart));
        //                this.add(new JSeparator(SwingConstants.VERTICAL), gbc);
      }
    }

    /** add a virtual label with weight at 1 to disable space distribution to previous items */
    gbc = new GridBagConstraints();

    gbc.gridx = 999;
    gbc.gridy = 999;
    gbc.weightx = 1.0f;
    gbc.weighty = 1.0f;
    this.add(new JLabel(""), gbc);
  }
Example #5
0
  public void initializeMainView(
      final SuperAdapter superAdapter,
      Container contentPane,
      Dimension bigPanelDim,
      Dimension panelDim) {
    contentPane.setLayout(new BorderLayout());

    final JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    contentPane.add(mainPanel, BorderLayout.CENTER);
    mainPanel.setBackground(Color.white);

    final JPanel toolbarPanel = new JPanel();
    toolbarPanel.setBorder(null);

    toolbarPanel.setLayout(new GridBagLayout());
    mainPanel.add(toolbarPanel, BorderLayout.NORTH);

    JPanel bigPanel = new JPanel();
    bigPanel.setLayout(new BorderLayout());
    bigPanel.setBackground(Color.white);

    bigPanel.setPreferredSize(new Dimension(bigPanelDim));
    bigPanel.setMaximumSize(new Dimension(bigPanelDim));
    bigPanel.setMinimumSize(new Dimension(bigPanelDim));

    JPanel bottomPanel = new JPanel();
    bottomPanel.setBackground(Color.white);

    JMenuBar menuBar = null;
    try {
      menuBar = superAdapter.createMenuBar();
    } catch (Exception e) {
      e.printStackTrace();
    }
    assert menuBar != null;
    contentPane.add(menuBar, BorderLayout.NORTH);

    GridBagConstraints toolbarConstraints = new GridBagConstraints();
    toolbarConstraints.anchor = GridBagConstraints.LINE_START;
    toolbarConstraints.fill = GridBagConstraints.HORIZONTAL;
    toolbarConstraints.gridx = 0;
    toolbarConstraints.gridy = 0;
    toolbarConstraints.weightx = 0.1;

    // --- Chromosome panel ---
    JPanel chrSelectionPanel = new JPanel();
    toolbarPanel.add(chrSelectionPanel, toolbarConstraints);

    chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder());

    chrSelectionPanel.setLayout(new BorderLayout());

    JPanel chrLabelPanel = new JPanel();
    JLabel chrLabel = new JLabel("Chromosomes");
    chrLabel.setHorizontalAlignment(SwingConstants.CENTER);
    chrLabelPanel.setBackground(HiCGlobals.backgroundColor);
    chrLabelPanel.setLayout(new BorderLayout());
    chrLabelPanel.add(chrLabel, BorderLayout.CENTER);
    chrSelectionPanel.add(chrLabelPanel, BorderLayout.PAGE_START);

    JPanel chrButtonPanel = new JPanel();
    chrButtonPanel.setBackground(new Color(238, 238, 238));
    chrButtonPanel.setLayout(new BoxLayout(chrButtonPanel, BoxLayout.X_AXIS));

    // ---- chrBox1 ----
    chrBox1 = new JComboBox<Chromosome>();
    chrBox1.setModel(
        new DefaultComboBoxModel<Chromosome>(new Chromosome[] {new Chromosome(0, "All", 0)}));
    chrBox1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            chrBox1ActionPerformed(e);
          }
        });
    chrBox1.setPreferredSize(new Dimension(95, 70));
    chrButtonPanel.add(chrBox1);

    // ---- chrBox2 ----
    chrBox2 = new JComboBox<Chromosome>();
    chrBox2.setModel(
        new DefaultComboBoxModel<Chromosome>(new Chromosome[] {new Chromosome(0, "All", 0)}));
    chrBox2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            chrBox2ActionPerformed(e);
          }
        });
    chrBox2.setPreferredSize(new Dimension(95, 70));
    chrButtonPanel.add(chrBox2);

    // ---- refreshButton ----
    refreshButton = new JideButton();
    refreshButton.setIcon(
        new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif")));
    refreshButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            superAdapter.safeRefreshButtonActionPerformed();
          }
        });
    refreshButton.setPreferredSize(new Dimension(24, 24));
    chrButtonPanel.add(refreshButton);

    chrBox1.setEnabled(false);
    chrBox2.setEnabled(false);
    refreshButton.setEnabled(false);
    chrSelectionPanel.add(chrButtonPanel, BorderLayout.CENTER);

    chrSelectionPanel.setMinimumSize(new Dimension(200, 70));
    chrSelectionPanel.setPreferredSize(new Dimension(210, 70));

    // ======== Display Option Panel ========
    JPanel displayOptionPanel = new JPanel();
    displayOptionPanel.setBackground(new Color(238, 238, 238));
    displayOptionPanel.setBorder(LineBorder.createGrayLineBorder());
    displayOptionPanel.setLayout(new BorderLayout());
    JPanel displayOptionLabelPanel = new JPanel();
    displayOptionLabelPanel.setBackground(HiCGlobals.backgroundColor);
    displayOptionLabelPanel.setLayout(new BorderLayout());

    JLabel displayOptionLabel = new JLabel("Show");
    displayOptionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    displayOptionLabelPanel.add(displayOptionLabel, BorderLayout.CENTER);
    displayOptionPanel.add(displayOptionLabelPanel, BorderLayout.PAGE_START);
    JPanel displayOptionButtonPanel = new JPanel();
    displayOptionButtonPanel.setBorder(new EmptyBorder(0, 10, 0, 10));
    displayOptionButtonPanel.setLayout(new GridLayout(1, 0, 20, 0));
    displayOptionComboBox = new JComboBox<MatrixType>();
    displayOptionComboBox.setModel(
        new DefaultComboBoxModel<MatrixType>(new MatrixType[] {MatrixType.OBSERVED}));
    displayOptionComboBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            superAdapter.safeDisplayOptionComboBoxActionPerformed();
            normalizationComboBox.setEnabled(!isWholeGenome());
          }
        });
    displayOptionButtonPanel.add(displayOptionComboBox);
    displayOptionPanel.add(displayOptionButtonPanel, BorderLayout.CENTER);
    displayOptionPanel.setMinimumSize(new Dimension(140, 70));
    displayOptionPanel.setPreferredSize(new Dimension(140, 70));
    displayOptionPanel.setMaximumSize(new Dimension(140, 70));

    toolbarConstraints.gridx = 1;
    toolbarConstraints.weightx = 0.1;
    toolbarPanel.add(displayOptionPanel, toolbarConstraints);
    displayOptionComboBox.setEnabled(false);

    // ======== Normalization Panel ========
    JPanel normalizationPanel = new JPanel();
    normalizationPanel.setBackground(new Color(238, 238, 238));
    normalizationPanel.setBorder(LineBorder.createGrayLineBorder());
    normalizationPanel.setLayout(new BorderLayout());

    JPanel normalizationLabelPanel = new JPanel();
    normalizationLabelPanel.setBackground(HiCGlobals.backgroundColor);
    normalizationLabelPanel.setLayout(new BorderLayout());

    JLabel normalizationLabel = new JLabel("Normalization");
    normalizationLabel.setHorizontalAlignment(SwingConstants.CENTER);
    normalizationLabelPanel.add(normalizationLabel, BorderLayout.CENTER);
    normalizationPanel.add(normalizationLabelPanel, BorderLayout.PAGE_START);

    JPanel normalizationButtonPanel = new JPanel();
    normalizationButtonPanel.setBorder(new EmptyBorder(0, 10, 0, 10));
    normalizationButtonPanel.setLayout(new GridLayout(1, 0, 20, 0));
    normalizationComboBox = new JComboBox<String>();
    normalizationComboBox.setModel(
        new DefaultComboBoxModel<String>(new String[] {NormalizationType.NONE.getLabel()}));
    normalizationComboBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            superAdapter.safeNormalizationComboBoxActionPerformed(e);
          }
        });
    normalizationButtonPanel.add(normalizationComboBox);
    normalizationPanel.add(normalizationButtonPanel, BorderLayout.CENTER);
    normalizationPanel.setPreferredSize(new Dimension(180, 70));
    normalizationPanel.setMinimumSize(new Dimension(140, 70));

    toolbarConstraints.gridx = 2;
    toolbarConstraints.weightx = 0.1;
    toolbarPanel.add(normalizationPanel, toolbarConstraints);
    normalizationComboBox.setEnabled(false);

    // ======== Resolution Panel ========
    hiCPanel = new JPanel();
    hiCPanel.setBackground(Color.white);
    hiCPanel.setLayout(new HiCLayout());
    bigPanel.add(hiCPanel, BorderLayout.CENTER);

    JPanel wrapGapPanel = new JPanel();
    wrapGapPanel.setBackground(Color.white);
    wrapGapPanel.setMaximumSize(new Dimension(5, 5));
    wrapGapPanel.setMinimumSize(new Dimension(5, 5));
    wrapGapPanel.setPreferredSize(new Dimension(5, 5));
    wrapGapPanel.setBorder(LineBorder.createBlackLineBorder());
    bigPanel.add(wrapGapPanel, BorderLayout.EAST);

    // splitPanel.insertPane(hiCPanel, 0);
    // splitPanel.setBackground(Color.white);

    // ---- rulerPanel2 ----
    JPanel topPanel = new JPanel();
    topPanel.setBackground(Color.green);
    topPanel.setLayout(new BorderLayout());
    hiCPanel.add(topPanel, BorderLayout.NORTH);
    trackLabelPanel = new TrackLabelPanel(superAdapter.getHiC());
    trackLabelPanel.setBackground(Color.white);
    hiCPanel.add(trackLabelPanel, HiCLayout.NORTH_WEST);

    trackPanelX = new TrackPanel(superAdapter, superAdapter.getHiC(), TrackPanel.Orientation.X);
    trackPanelX.setMaximumSize(new Dimension(4000, 50));
    trackPanelX.setPreferredSize(new Dimension(1, 50));
    trackPanelX.setMinimumSize(new Dimension(1, 50));
    trackPanelX.setVisible(false);
    topPanel.add(trackPanelX, BorderLayout.NORTH);

    rulerPanelX = new HiCRulerPanel(superAdapter.getHiC());
    rulerPanelX.setMaximumSize(new Dimension(4000, 50));
    rulerPanelX.setMinimumSize(new Dimension(1, 50));
    rulerPanelX.setPreferredSize(new Dimension(1, 50));
    rulerPanelX.setBorder(null);
    topPanel.add(rulerPanelX, BorderLayout.SOUTH);

    // ---- rulerPanel1 ----
    JPanel leftPanel = new JPanel();
    leftPanel.setBackground(Color.white);
    leftPanel.setLayout(new BorderLayout());
    hiCPanel.add(leftPanel, BorderLayout.WEST);

    trackPanelY = new TrackPanel(superAdapter, superAdapter.getHiC(), TrackPanel.Orientation.Y);
    trackPanelY.setMaximumSize(new Dimension(50, 4000));
    trackPanelY.setPreferredSize(new Dimension(50, 1));
    trackPanelY.setMinimumSize(new Dimension(50, 1));
    trackPanelY.setVisible(false);
    leftPanel.add(trackPanelY, BorderLayout.WEST);

    rulerPanelY = new HiCRulerPanel(superAdapter.getHiC());
    rulerPanelY.setMaximumSize(new Dimension(50, 4000));
    rulerPanelY.setPreferredSize(new Dimension(50, 800));
    rulerPanelY.setBorder(null);
    rulerPanelY.setMinimumSize(new Dimension(50, 1));
    leftPanel.add(rulerPanelY, BorderLayout.EAST);

    // ---- heatmapPanel ----
    // Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
    // int panelSize = screenDimension.height - 210;

    int panelWidth = (int) panelDim.getWidth();
    int panelHeight = (int) panelDim.getHeight();
    System.err.println("Window W: " + panelWidth + " H" + panelHeight);

    JPanel wrapHeatmapPanel = new JPanel(new BorderLayout());
    wrapHeatmapPanel.setMaximumSize(new Dimension(panelDim));
    wrapHeatmapPanel.setMinimumSize(new Dimension(panelDim));
    wrapHeatmapPanel.setPreferredSize(new Dimension(panelDim));
    wrapHeatmapPanel.setBackground(Color.BLUE);
    wrapHeatmapPanel.setVisible(true);

    heatmapPanel = new HeatmapPanel(superAdapter);
    heatmapPanel.setMaximumSize(new Dimension(panelWidth - 5, panelHeight - 5));
    heatmapPanel.setMinimumSize(new Dimension(panelWidth - 5, panelHeight - 5));
    heatmapPanel.setPreferredSize(new Dimension(panelWidth - 5, panelHeight - 5));
    heatmapPanel.setBackground(Color.white);

    wrapHeatmapPanel.add(heatmapPanel, BorderLayout.CENTER);

    // hiCPanel.setMaximumSize(new Dimension(panelWidth, panelHeight));
    // hiCPanel.setMinimumSize(new Dimension(panelWidth, panelHeight));
    // hiCPanel.setPreferredSize(new Dimension(panelWidth, panelHeight));

    hiCPanel.add(wrapHeatmapPanel, BorderLayout.CENTER);

    // ======== Resolution Slider Panel ========

    // Resolution  panel
    resolutionSlider = new ResolutionControl(superAdapter);
    resolutionSlider.setPreferredSize(new Dimension(200, 70));
    resolutionSlider.setMinimumSize(new Dimension(150, 70));

    toolbarConstraints.gridx = 3;
    toolbarConstraints.weightx = 0.1;
    toolbarPanel.add(resolutionSlider, toolbarConstraints);

    // ======== Color Range Panel ========
    colorRangePanel = new JColorRangePanel(superAdapter, heatmapPanel, preDefMapColor);

    toolbarConstraints.gridx = 4;
    toolbarConstraints.weightx = 0.5;
    toolbarPanel.add(colorRangePanel, toolbarConstraints);

    goPanel = new GoToPanel(superAdapter);
    toolbarConstraints.gridx = 5;
    toolbarConstraints.weightx = 0.25;
    toolbarPanel.add(goPanel, toolbarConstraints);
    // not sure this is working
    // toolbarPanel.setPreferredSize(new Dimension(panelHeight,100));
    toolbarPanel.setEnabled(false);

    // ======== Right side panel ========

    JPanel rightSidePanel = new JPanel(new BorderLayout()); // (new BorderLayout());
    rightSidePanel.setBackground(Color.white);
    rightSidePanel.setPreferredSize(new Dimension(210, 1000));
    rightSidePanel.setMaximumSize(new Dimension(10000, 10000));

    // ======== Bird's view mini map ========

    JPanel thumbPanel = new JPanel();
    thumbPanel.setLayout(new BorderLayout());

    // ---- thumbnailPanel ----
    thumbnailPanel = new ThumbnailPanel(superAdapter);
    thumbnailPanel.setBackground(Color.white);
    thumbnailPanel.setMaximumSize(new Dimension(210, 210));
    thumbnailPanel.setMinimumSize(new Dimension(210, 210));
    thumbnailPanel.setPreferredSize(new Dimension(210, 210));

    //        JPanel gapPanel = new JPanel();
    //        gapPanel.setMaximumSize(new Dimension(1, 1));
    //        rightSidePanel.add(gapPanel,BorderLayout.WEST);
    thumbPanel.add(thumbnailPanel, BorderLayout.CENTER);
    thumbPanel.setBackground(Color.white);
    rightSidePanel.add(thumbPanel, BorderLayout.NORTH);

    // ========= mouse hover text ======
    JPanel tooltipPanel = new JPanel(new BorderLayout());
    tooltipPanel.setBackground(Color.white);
    tooltipPanel.setPreferredSize(new Dimension(210, 490));
    mouseHoverTextPanel = new JEditorPane();
    mouseHoverTextPanel.setEditable(false);
    mouseHoverTextPanel.setContentType("text/html");
    mouseHoverTextPanel.setFont(new Font("sans-serif", 0, 20));
    mouseHoverTextPanel.setBackground(Color.white);
    mouseHoverTextPanel.setBorder(null);
    int mouseTextY = rightSidePanel.getBounds().y + rightSidePanel.getBounds().height;

    // *Dimension prefSize = new Dimension(210, 490);
    Dimension prefSize = new Dimension(210, 390);
    mouseHoverTextPanel.setPreferredSize(prefSize);

    JScrollPane tooltipScroller = new JScrollPane(mouseHoverTextPanel);
    tooltipScroller.setBackground(Color.white);
    tooltipScroller.setBorder(null);

    tooltipPanel.setPreferredSize(new Dimension(210, 500));
    tooltipPanel.add(tooltipScroller);
    tooltipPanel.setBounds(new Rectangle(new Point(0, mouseTextY), prefSize));
    tooltipPanel.setBackground(Color.white);
    tooltipPanel.setBorder(null);

    rightSidePanel.add(tooltipPanel, BorderLayout.CENTER);

    // compute preferred size
    Dimension preferredSize = new Dimension();
    for (int i = 0; i < rightSidePanel.getComponentCount(); i++) {
      Rectangle bounds = rightSidePanel.getComponent(i).getBounds();
      preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
      preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
    }
    Insets insets = rightSidePanel.getInsets();
    preferredSize.width += insets.right + 20;
    preferredSize.height += insets.bottom;
    rightSidePanel.setMinimumSize(preferredSize);
    rightSidePanel.setPreferredSize(preferredSize);
    mainPanel.add(bigPanel, BorderLayout.CENTER);
    mainPanel.add(rightSidePanel, BorderLayout.EAST);
  }