Hi
I setup my docking port based on the tutorial ColourDockable:
private void setupStation1()
{
mDockingStation = new SplitDockStation();
mModelTreeDockable = new ColourDockable( "Model Tree", Color.RED, 2.5f );
JPanel renderPanel2D = new RenderPanel2D();
mModel2DViewDockable = new ColourDockable(renderPanel2D, "Model 2D View", Color.YELLOW, 2.5f );
//mModel2DViewDockable = new ColourDockable( "Model 2D View", Color.YELLOW, 2.5f );
mModel3DViewDockable = new ColourDockable( "Model 3D View", Color.CYAN, 2.5f );
SplitDockGrid dockGrid = new SplitDockGrid();
dockGrid.addDockable( 0, 0, 20, 100, mModelTreeDockable );
dockGrid.setSelected( 0, 0, 20, 100, mModelTreeDockable );
dockGrid.addDockable( 20, 0, 80, 100, mModel2DViewDockable, mModel3DViewDockable );
dockGrid.setSelected( 20, 0, 80, 100, mModel2DViewDockable ); // note that (x,y,width,height) must match addDockable()
mDockingStation.dropTree( dockGrid.toTree() );
mDockingController.add( mDockingStation );
}
If I uncomment the line:
//mModel2DViewDockable = new ColourDockable( "Model 2D View", Color.YELLOW, 2.5f );
then I see the same as the tutorial and an entirely yellow panel.
However, instead I’ve been trying to assign my own rendering panel:
public class RenderPanel2D extends JPanel
{
public RenderPanel2D()
{
super(); // double buffering
}
public void paint(Graphics g)
{
//super.paint(g);
Graphics2D g2 = (Graphics2D)this.getGraphics();
clear();
Ellipse2D.Double circle = new Ellipse2D.Double(10, 10, 350, 350);
Rectangle2D.Double square = new Rectangle2D.Double(10, 10, 350, 350);
g2.setPaint(Color.BLACK);
g2.fill(circle);
g2.draw(square);
}
// super.paintComponent clears offscreen pixmap, since we're using double buffering by default.
protected void clear()
{
Graphics2D g2 = (Graphics2D)this.getGraphics();
this.paintComponent(g2);
}
When I run the application I don’t see the 2 shapes.
However, if I move the seperator between split planes then I see the shapes but when I release dragging the split pane then the shapes become invisible.
Has anyone else experienced this kind of problem?
Thanks
Graham