Skip to content

Commit

Permalink
Fixed window close button on some FPGA windows
Browse files Browse the repository at this point in the history
  • Loading branch information
aplq committed Dec 17, 2023
1 parent aae12f5 commit 9ec9a15
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.ArrayList;
import java.util.HashMap;
import javax.swing.BorderFactory;
Expand Down Expand Up @@ -712,11 +714,17 @@ else if (cnt < nrOfPins.get(INPUT_ID) + nrOfPins.get(OUTPUT_ID))
CancelButton.addActionListener(actionListener);
gbc.gridx = 0;
contents.add(CancelButton, gbc);
// FIXME: Find better solution to handle window close button
selWindow.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
CancelButton.doClick();
}
});
selWindow.add(new JScrollPane(contents));
selWindow.pack();
selWindow.setLocationRelativeTo(IOcomps.getParentFrame());
selWindow.setModal(true);
selWindow.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
selWindow.setAlwaysOnTop(true);
abort = false;
while (!abort) {
Expand Down Expand Up @@ -1087,6 +1095,13 @@ public static void getFpgaInformation(Frame panel, BoardInformation TheBoard) {
gbc.gridy = 2;
gbc.fill = GridBagConstraints.HORIZONTAL;
selWindow.add(cancelButton, gbc);
// FIXME: Find better solution to handle window close button
selWindow.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
cancelButton.doClick();
}
});

final var saveButton = new JButton(S.get("FpgaBoardDone"));
saveButton.addActionListener(actionListener);
Expand Down

0 comments on commit 9ec9a15

Please sign in to comment.