Merge pull request #1102 from SiboVG/issue-1024

[fixes #1024] Rocket optimization window too small + others
This commit is contained in:
SiboVG 2022-02-11 18:26:13 +01:00 committed by GitHub
commit 2683b7a08e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 12 deletions

View File

@ -56,7 +56,7 @@ public class CustomExpressionPanel extends JPanel {
//expressionSelectorPanel.add(scroll); //expressionSelectorPanel.add(scroll);
//this.add(expressionSelectorPanel, "spany 1, height 10px, wmin 600lp, grow 100, gapright para"); //this.add(expressionSelectorPanel, "spany 1, height 10px, wmin 600lp, grow 100, gapright para");
this.add(scroll, "hmin 200lp, wmin 700lp, grow 100, wrap"); this.add(scroll, "hmin 200lp, wmin 700lp, grow, pushy, wrap");
//DescriptionArea desc = new DescriptionArea(trans.get("customExpressionPanel.lbl.UpdateNote")+"\n\n"+trans.get("customExpressionPanel.lbl.CalcNote"), 8, -2f); //DescriptionArea desc = new DescriptionArea(trans.get("customExpressionPanel.lbl.UpdateNote")+"\n\n"+trans.get("customExpressionPanel.lbl.CalcNote"), 8, -2f);
//desc.setViewportBorder(BorderFactory.createEmptyBorder()); //desc.setViewportBorder(BorderFactory.createEmptyBorder());

View File

@ -148,7 +148,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
JScrollPane scrollPane = new JScrollPane(warningList); JScrollPane scrollPane = new JScrollPane(warningList);
////Warnings: ////Warnings:
scrollPane.setBorder(BorderFactory.createTitledBorder(trans.get("componentanalysisdlg.TitledBorder.warnings"))); scrollPane.setBorder(BorderFactory.createTitledBorder(trans.get("componentanalysisdlg.TitledBorder.warnings")));
panel.add(scrollPane, "gap paragraph, spany 4, width 300lp!, growy 1, height :100lp:, wrap"); panel.add(scrollPane, "gap paragraph, spany 4, wmin 300lp, grow, height :100lp:, wrap");
////Angle of attack: ////Angle of attack:
panel.add(new JLabel(trans.get("componentanalysisdlg.lbl.angleofattack")), "width 120lp!"); panel.add(new JLabel(trans.get("componentanalysisdlg.lbl.angleofattack")), "width 120lp!");
@ -183,7 +183,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
// Tabbed pane // Tabbed pane
JTabbedPane tabbedPane = new JTabbedPane(); JTabbedPane tabbedPane = new JTabbedPane();
panel.add(tabbedPane, "spanx, growx, growy"); panel.add(tabbedPane, "spanx, growx, growy, pushy");
// Create the Longitudinal Stability (CM vs CP) data table // Create the Longitudinal Stability (CM vs CP) data table

View File

@ -1,6 +1,8 @@
package net.sf.openrocket.gui.dialogs.optimization; package net.sf.openrocket.gui.dialogs.optimization;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Window; import java.awt.Window;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -205,7 +207,7 @@ public class GeneralOptimizationDialog extends JDialog {
JScrollPane scroll; JScrollPane scroll;
String tip; String tip;
JPanel panel = new JPanel(new MigLayout("fill")); JPanel panel = new JPanel(new MigLayout("fill, w 1200"));
ChangeListener clearHistoryChangeListener = e -> clearHistory(); ChangeListener clearHistoryChangeListener = e -> clearHistory();
ActionListener clearHistoryActionListener = e -> clearHistory(); ActionListener clearHistoryActionListener = e -> clearHistory();
@ -251,10 +253,10 @@ public class GeneralOptimizationDialog extends JDialog {
label = new StyledLabel(trans.get("lbl.paramsToOptimize"), Style.BOLD); label = new StyledLabel(trans.get("lbl.paramsToOptimize"), Style.BOLD);
disableComponents.add(label); disableComponents.add(label);
panel.add(label, "split 3, flowy"); panel.add(label, "split 3, flowy");
panel.add(scroll, "wmin 300lp, height 200lp, grow"); panel.add(scroll, "wmin 300lp, height 150lp, grow");
selectedModifierDescription = new DescriptionArea(2, -3); selectedModifierDescription = new DescriptionArea(2, -3);
disableComponents.add(selectedModifierDescription); disableComponents.add(selectedModifierDescription);
panel.add(selectedModifierDescription, "growx"); panel.add(selectedModifierDescription, "hmin 20lp, growx");
// // Add/remove buttons // // Add/remove buttons
sub = new JPanel(new MigLayout("fill")); sub = new JPanel(new MigLayout("fill"));
@ -601,16 +603,16 @@ public class GeneralOptimizationDialog extends JDialog {
}); });
panel.add(closeButton, "right"); panel.add(closeButton, "right");
this.add(panel); this.add(new JScrollPane(panel));
clearHistory(); clearHistory();
updateComponents(); updateComponents();
GUIUtil.setDisposableDialogOptions(this, null); GUIUtil.setDisposableDialogOptions(this, null);
// seem like a reasonable defaults int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
this.setSize(1200, 600); this.setSize(new Dimension(this.getWidth(), Math.min(this.getHeight(), screenHeight - 150)));
// System.err.println("OptimizationDialog.size: " + this.getSize()); this.pack();
this.setLocation(100, 100);
// System.err.println("OptimizationDialog.location: " + this.getLocation()); this.setLocation((parent.getWidth() - 1200)/2, 100);
} }
private void startOptimization() { private void startOptimization() {