mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 10:40:45 +00:00
Fixed: #1670 Parent component/window of dialogs not properly set
This commit is contained in:
@@ -475,111 +475,6 @@ public class View {
|
||||
}
|
||||
}
|
||||
|
||||
public static int showOptionDialog(final Component parentComponent, final Object message, final String title, final int optionType, final int messageType, final Icon icon, final Object[] options, final Object initialValue) {
|
||||
final int[] ret = new int[1];
|
||||
execInEventDispatch(() -> {
|
||||
ret[0] = JOptionPane.showOptionDialog(parentComponent, message, title, optionType, messageType, icon, options, initialValue);
|
||||
});
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public static int showConfirmDialog(Component parentComponent, Object message, String title, int optionType) {
|
||||
return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE);
|
||||
}
|
||||
|
||||
public static int showConfirmDialog(final Component parentComponent, final Object message, final String title, final int optionType, final int messageTyp) {
|
||||
final int[] ret = new int[1];
|
||||
execInEventDispatch(() -> {
|
||||
ret[0] = JOptionPane.showConfirmDialog(parentComponent, message, title, optionType, messageTyp);
|
||||
});
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public static int showConfirmDialog(Component parentComponent, String message, String title, int optionType, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
|
||||
return showConfirmDialog(parentComponent, message, title, optionType, JOptionPane.PLAIN_MESSAGE, showAgainConfig, defaultOption);
|
||||
}
|
||||
|
||||
public static int showConfirmDialog(final Component parentComponent, String message, final String title, final int optionType, final int messageType, ConfigurationItem<Boolean> showAgainConfig, int defaultOption) {
|
||||
|
||||
JCheckBox donotShowAgainCheckBox = null;
|
||||
JPanel warPanel = null;
|
||||
if (showAgainConfig != null) {
|
||||
if (!showAgainConfig.get()) {
|
||||
return defaultOption;
|
||||
}
|
||||
|
||||
JLabel warLabel = new JLabel("<html>" + message.replace("\r\n", "<br>") + "</html>");
|
||||
warPanel = new JPanel(new BorderLayout());
|
||||
warPanel.add(warLabel, BorderLayout.CENTER);
|
||||
donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
|
||||
warPanel.add(donotShowAgainCheckBox, BorderLayout.SOUTH);
|
||||
}
|
||||
|
||||
final int[] ret = new int[1];
|
||||
final Object messageObj = warPanel == null ? message : warPanel;
|
||||
execInEventDispatch(() -> {
|
||||
ret[0] = JOptionPane.showConfirmDialog(parentComponent, messageObj, title, optionType, messageType);
|
||||
});
|
||||
|
||||
if (donotShowAgainCheckBox != null) {
|
||||
showAgainConfig.set(!donotShowAgainCheckBox.isSelected());
|
||||
}
|
||||
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public static void showMessageDialog(final Component parentComponent, final String message, final String title, final int messageType) {
|
||||
showMessageDialog(parentComponent, message, title, messageType, null);
|
||||
}
|
||||
|
||||
public static void showMessageDialog(final Component parentComponent, final String message, final String title, final int messageType, ConfigurationItem<Boolean> showAgainConfig) {
|
||||
|
||||
execInEventDispatch(() -> {
|
||||
Object msg = message;
|
||||
JCheckBox donotShowAgainCheckBox = null;
|
||||
if (showAgainConfig != null) {
|
||||
if (!showAgainConfig.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
JLabel warLabel = new JLabel("<html>" + message.replace("\r\n", "<br>") + "</html>");
|
||||
final JPanel warPanel = new JPanel(new BorderLayout());
|
||||
warPanel.add(warLabel, BorderLayout.CENTER);
|
||||
donotShowAgainCheckBox = new JCheckBox(AppStrings.translate("message.confirm.donotshowagain"));
|
||||
warPanel.add(donotShowAgainCheckBox, BorderLayout.SOUTH);
|
||||
msg = warPanel;
|
||||
}
|
||||
final Object fmsg = msg;
|
||||
|
||||
JOptionPane.showMessageDialog(parentComponent, fmsg, title, messageType);
|
||||
if (donotShowAgainCheckBox != null) {
|
||||
showAgainConfig.set(!donotShowAgainCheckBox.isSelected());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void showMessageDialog(final Component parentComponent, final Object message) {
|
||||
execInEventDispatch(() -> {
|
||||
JOptionPane.showMessageDialog(parentComponent, message);
|
||||
});
|
||||
}
|
||||
|
||||
public static String showInputDialog(final Object message, final Object initialSelection) {
|
||||
final String[] ret = new String[1];
|
||||
execInEventDispatch(() -> {
|
||||
ret[0] = JOptionPane.showInputDialog(message, initialSelection);
|
||||
});
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public static String showInputDialog(Component parentComponent, final Object message, final String title, final Object initialSelection) {
|
||||
final String[] ret = new String[1];
|
||||
execInEventDispatch(() -> {
|
||||
ret[0] = (String) JOptionPane.showInputDialog(parentComponent, message, title, JOptionPane.QUESTION_MESSAGE, null, null, initialSelection);
|
||||
});
|
||||
return ret[0];
|
||||
}
|
||||
|
||||
public static SubstanceColorScheme getColorScheme() {
|
||||
return SubstanceColorSchemeUtilities.getActiveColorScheme(new JButton(), ComponentState.ENABLED);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user