Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: "Validate" button disappears after app font-size change #1255

Merged
merged 3 commits into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ public class GtfsValidatorApp extends JFrame {
private static final Dimension VERTICAL_GAP = new Dimension(0, 40);
private static final Dimension TEXT_GAP = new Dimension(0, 10);

private static final int TEXT_FIELD_COLUMN_WIDTH = 40;

private static final Font BOLD_FONT = createBoldFont();

private final JTextField gtfsInputField = new JTextField();
private final JTextField outputDirectoryField = new JTextField();
private final JTextField gtfsInputField = new JTextField(TEXT_FIELD_COLUMN_WIDTH);
private final JTextField outputDirectoryField = new JTextField(TEXT_FIELD_COLUMN_WIDTH);

private final JPanel newVersionAvailablePanel = new JPanel();

Expand Down Expand Up @@ -206,6 +208,10 @@ private void showGtfsInputFileChooser() {
File selectedFile = chooser.getSelectedFile();
gtfsInputField.setText(selectedFile.toString());
}
// Per issue #1244, we've seen behavior where the JFileChooser causes the app's font size to
// increase, causing app ui elements to move beyond the edge of the current window. We re-pack
// the UI to counteract.
pack();
}

private class GtfsZipsAndDirectoriesFileFilter extends FileFilter {
Expand Down Expand Up @@ -246,6 +252,10 @@ private void showOutputDirectoryChooser() {
File selectedFile = chooser.getSelectedFile();
outputDirectoryField.setText(selectedFile.toString());
}
// Per issue #1244, we've seen behavior where the JFileChooser causes the app's font size to
// increase, causing app ui elements to move beyond the edge of the current window. We re-pack
// the UI to counteract.
pack();
}

private void constructAdvancedOptionsPanel(JPanel parent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ private static void createAndShowGUI(String[] args) {
}

app.pack();
app.setMinimumSize(app.getSize());

// This causes the application window to center in the screen.
app.setLocationRelativeTo(null);
app.setVisible(true);
Expand Down