Fix issue that was shrinking the drawing when redrawing.

This commit is contained in:
Holt59 2018-02-25 00:36:17 +01:00
parent 0236798ef5
commit 5ccdbc9417

View File

@ -222,7 +222,7 @@ public class MainWindow extends JFrame {
} }
private void updateDrawing(Class<? extends Drawing> newClass) { private void updateDrawing(Class<? extends Drawing> newClass) {
int oldLocation = mainPanel.getDividerLocation();
drawing.clear(); drawing.clear();
if (drawing == null || !newClass.isInstance(drawing)) { if (drawing == null || !newClass.isInstance(drawing)) {
try { try {
@ -232,8 +232,9 @@ public class MainWindow extends JFrame {
e.printStackTrace(); e.printStackTrace();
} }
addDrawingClickListeners(); addDrawingClickListeners();
}
mainPanel.setLeftComponent((Component) drawing); mainPanel.setLeftComponent((Component) drawing);
mainPanel.setDividerLocation(oldLocation);
}
} }
private JMenuBar createMenuBar() { private JMenuBar createMenuBar() {