Skip to content

Commit

Permalink
further improved responsive layout
Browse files Browse the repository at this point in the history
  • Loading branch information
aress31 committed Dec 24, 2023
1 parent 77fcbc4 commit f61a539
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions src/main/java/swurg/gui/views/ParametersPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import java.awt.Frame;
import java.awt.GridBagLayout;
import java.awt.event.ItemEvent;

import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -42,9 +45,11 @@
public class ParametersPanel extends JPanel
implements HttpHandler, ParametersPanelObserver {

private MontoyaApi montoyaApi;
private Frame suiteFrame;
private Logging logging;

private JScrollPane scrollPane;

private ParametersTableModel parametersTableModel;

private transient List<ToolType> toolsInScope = new ArrayList<>();
Expand All @@ -59,13 +64,30 @@ public class ParametersPanel extends JPanel
private List<MyHttpRequest> myHttpRequests;

public ParametersPanel(MontoyaApi montoyaApi, List<MyHttpRequest> myHttpRequests) {
this.montoyaApi = montoyaApi;
this.suiteFrame = montoyaApi.userInterface().swingUtils().suiteFrame();
this.logging = montoyaApi.logging();

this.myHttpRequests = myHttpRequests;

parametersTableModel = ParametersTableModel.fromRequestWithMetadataList(myHttpRequests);

initComponents();

this.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
scrollPane.setPreferredSize(
new Dimension((int) (suiteFrame.getWidth() * 0.25),
suiteFrame.getHeight() - 210));
}

@Override
public void componentShown(ComponentEvent e) {
scrollPane.setPreferredSize(
new Dimension((int) (suiteFrame.getWidth() * 0.25),
suiteFrame.getHeight() - 210));
}
});
}

@Override
Expand Down Expand Up @@ -123,15 +145,9 @@ private JPanel createEastPanel() {
panel.setBorder(BorderFactory.createTitledBorder("How To"));

JEditorPane editorPane = createEditorPane("howTo.html");
JScrollPane scrollPane = new JScrollPane(editorPane);
scrollPane.setBorder(null);

Frame suiteFrame = this.montoyaApi.userInterface().swingUtils().suiteFrame();

// Eyebolling the height offset
scrollPane.setPreferredSize(
new Dimension((int) (suiteFrame.getWidth() * 0.25),
suiteFrame.getHeight() - 210));
scrollPane = new JScrollPane(editorPane);
scrollPane.setBorder(null);

panel.add(scrollPane);

Expand Down

0 comments on commit f61a539

Please sign in to comment.