diff --git a/swing/src/net/sf/openrocket/gui/dialogs/optimization/GeneralOptimizationDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/optimization/GeneralOptimizationDialog.java index c963ae877..5485c60b1 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/optimization/GeneralOptimizationDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/optimization/GeneralOptimizationDialog.java @@ -51,6 +51,7 @@ import javax.swing.table.TableColumnModel; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; +import net.sf.openrocket.arch.SystemInfo; import net.sf.openrocket.rocketcomponent.FlightConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1157,6 +1158,14 @@ public class GeneralOptimizationDialog extends JDialog { chooser.setFileFilter(FileHelper.CSV_FILTER); chooser.setCurrentDirectory(((SwingPreferences) Application.getPreferences()).getDefaultDirectory()); chooser.setAccessory(csvOptions); + + // TODO: update this dynamically instead of hard-coded values + // The macOS file chooser has an issue where it does not update its size when the accessory is added. + if (SystemInfo.getPlatform() == SystemInfo.Platform.MAC_OS) { + Dimension currentSize = chooser.getPreferredSize(); + Dimension newSize = new Dimension((int) (1.5 * currentSize.width), (int) (1.3 * currentSize.height)); + chooser.setPreferredSize(newSize); + } if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) return; diff --git a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java index cb35c3eaa..5cc7ca8ce 100644 --- a/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/SimulationPanel.java @@ -39,6 +39,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableCellRenderer; +import net.sf.openrocket.arch.SystemInfo; import net.sf.openrocket.gui.components.CsvOptionPanel; import net.sf.openrocket.gui.util.FileHelper; import net.sf.openrocket.gui.util.SwingPreferences; @@ -687,11 +688,15 @@ public class SimulationPanel extends JPanel { // Add CSV options to FileChooser CsvOptionPanel CSVOptions = new CsvOptionPanel(SimulationTableCSVExport.class); fch.setAccessory(CSVOptions); + fch.revalidate(); - // TODO: update the file chooser dimensions dynamically, this is very crude... - Dimension currentSize = fch.getPreferredSize(); - Dimension newSize = new Dimension((int) (1.5 * currentSize.width), (int) (1.3 * currentSize.height)); - fch.setPreferredSize(newSize); + // TODO: update this dynamically instead of hard-coded values + // The macOS file chooser has an issue where it does not update its size when the accessory is added. + if (SystemInfo.getPlatform() == SystemInfo.Platform.MAC_OS) { + Dimension currentSize = fch.getPreferredSize(); + Dimension newSize = new Dimension((int) (1.5 * currentSize.width), (int) (1.3 * currentSize.height)); + fch.setPreferredSize(newSize); + } return fch; }