diff --git a/src/main/java/net/tapaal/gui/petrinet/smartdraw/SmartDrawDialog.java b/src/main/java/net/tapaal/gui/petrinet/smartdraw/SmartDrawDialog.java index 172d8eb2e..0b86fd262 100644 --- a/src/main/java/net/tapaal/gui/petrinet/smartdraw/SmartDrawDialog.java +++ b/src/main/java/net/tapaal/gui/petrinet/smartdraw/SmartDrawDialog.java @@ -244,8 +244,6 @@ public void fireDone(boolean cancelled) { this.getRootPane().setDefaultButton(drawButton); drawButton.requestFocus(); - setContentPane(mainPanel); - int extraWidth = 100; Dimension preferredSize = mainPanel.getPreferredSize(); @@ -255,6 +253,13 @@ public void fireDone(boolean cancelled) { Dimension newPreferredSize = new Dimension(preferredWidth, preferredHeight); mainPanel.setPreferredSize(newPreferredSize); + + JScrollPane scrollPane = new JScrollPane(mainPanel); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setBorder(null); + + setContentPane(scrollPane); } private void initAdvancedOptionsPanel() {