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 persistent JCheckboxMenuItemUI #48

Merged
merged 2 commits into from
Feb 27, 2020
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
@@ -1,6 +1,7 @@
package org.icepdf.ri.common;

import javax.swing.*;
import javax.swing.plaf.basic.BasicCheckBoxMenuItemUI;
import javax.swing.plaf.synth.SynthCheckBoxMenuItemUI;

/**
Expand All @@ -19,11 +20,20 @@ public PersistentJCheckBoxMenuItem(String title, boolean b) {
@Override
public void updateUI() {
super.updateUI();
setUI(new SynthCheckBoxMenuItemUI() {
@Override
protected void doClick(MenuSelectionManager msm) {
menuItem.doClick(0);
}
});
if (getUI() instanceof SynthCheckBoxMenuItemUI) {
setUI(new SynthCheckBoxMenuItemUI() {
@Override
protected void doClick(MenuSelectionManager msm) {
menuItem.doClick(0);
}
});
} else {
setUI(new BasicCheckBoxMenuItemUI() {
@Override
protected void doClick(MenuSelectionManager msm) {
menuItem.doClick(0);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.ResourceBundle;
import java.util.prefs.Preferences;

import static org.icepdf.ri.util.PropertiesManager.*;
import static org.icepdf.ri.util.ViewerPropertiesManager.*;

public class SearchFilterButton extends DropDownButton {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import java.util.List;
import java.util.ResourceBundle;
import java.util.logging.Logger;
import java.util.prefs.Preferences;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

Expand Down Expand Up @@ -244,7 +245,7 @@ private void setGui() {
clearSearchButton.addActionListener(this);

// apply default preferences
preferences = controller.getPropertiesManager().getPreferences();
Preferences preferences = controller.getPropertiesManager().getPreferences();
String iconSize = preferences.get(ViewerPropertiesManager.PROPERTY_ICON_DEFAULT_SIZE, Images.SIZE_LARGE);
boolean isRegex = preferences.getBoolean(PROPERTY_SEARCH_PANEL_REGEX_ENABLED, true);
boolean isWholeWord = preferences.getBoolean(PROPERTY_SEARCH_PANEL_WHOLE_WORDS_ENABLED, false);
Expand Down