Insertion area sometimes not painted

Hi Beni,

I found a bug that results in the insertion area not being painted sometimes.
To reproduce I ran the code below in 1.1.1 p7d.
If you try to drop “Work 1” in the center of “Work 2”
the insertion area is painted correctly - the whole “Work 2” is shaded red.
If you do it the other way around - try to drop Work2 on the center of Work1,
the red area is not painted at all.
It seems to happen when dragging from “right to left” or “down to up”
and only when you drop on center.
The drop action is performed correctly in all cases.

kind regards,
Maciej Modelski

package test;

import java.awt.Color;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CGrid;
import bibliothek.gui.dock.common.CWorkingArea;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.theme.ThemeMap;
import bibliothek.gui.dock.util.Priority;
import bibliothek.gui.dock.util.color.ColorManager;

public class TabTest2
{
  public static void main(String[] args)
  {

    JFrame frame = new JFrame("Test");
    CControl control = new CControl(frame);
    control.setTheme(ThemeMap.KEY_FLAT_THEME);

    frame.add(control.getContentArea());

    CWorkingArea work = control.createWorkingArea("work");
    work.setVisible(true);
    work.setMaximizingArea(true);
    work.getStation().setContinousDisplay(true);

    ColorManager colors = control.getController().getColors();
    colors.put(Priority.CLIENT, "paint.insertion.area", Color.RED);
    
    CGrid grid = new CGrid(control);
    DefaultSingleCDockable d1 = new DefaultSingleCDockable("work 1", "Work 1", new JScrollPane(new JTextArea()));
    DefaultSingleCDockable d2 = new DefaultSingleCDockable("work 2", "Work 2", new JScrollPane(new JTextArea()));
    d1.setCloseable(true);
    d2.setCloseable(true);
    grid.add(0, 0, 1, 1, d1);
    grid.add(1, 0, 1, 1, d2);
    work.deploy(grid);

    frame.setBounds(20, 20, 600, 600);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
  }
}

Thanks for the info. I don’t yet know what exactly goes wrong, but it cannot be something serious.

Will be fixed in the next release. It really was only one wrong “if” statement.