no message
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
package Common.Visual;
|
||||
import Common.MainModule_;
|
||||
import Common.Utils.Utils_;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -9,18 +10,9 @@ import java.util.Stack;
|
||||
public class UI_ {
|
||||
public static boolean active = false; //есть ли интерфейс. в консольных версиях не нужен.
|
||||
//---
|
||||
public static Stack<Component> windowsStack = new Stack<>();
|
||||
public static boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
public static Component getFrontWindow() {
|
||||
Component res = null;
|
||||
try {
|
||||
res = windowsStack.peek();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//-----
|
||||
public static void Clear(Container container) {
|
||||
container.removeAll();
|
||||
@@ -67,21 +59,21 @@ public class UI_ {
|
||||
JOptionPane.QUESTION_MESSAGE) == 0);
|
||||
}
|
||||
public static boolean Question(String text) {
|
||||
return Question(getFrontWindow(), text);
|
||||
return Question(MainModule_.instance.getUI().getFrontWindow(), text);
|
||||
}
|
||||
public static void Info(String message) {
|
||||
Utils_.CopyToClipboard(message);
|
||||
if (UI_.isActive())
|
||||
JOptionPane.showMessageDialog(getFrontWindow(), message, "", 1);
|
||||
JOptionPane.showMessageDialog(MainModule_.instance.getUI().getFrontWindow(), message, "", 1);
|
||||
}
|
||||
public static void Error(String message) {
|
||||
Utils_.CopyToClipboard(message);
|
||||
if (UI_.isActive())
|
||||
JOptionPane.showMessageDialog(getFrontWindow(), message, "", 0);
|
||||
JOptionPane.showMessageDialog(MainModule_.instance.getUI().getFrontWindow(), message, "", 0);
|
||||
}
|
||||
public static boolean Warning(String text) {
|
||||
return !UI_.isActive() ||
|
||||
JOptionPane.showConfirmDialog(getFrontWindow(),
|
||||
JOptionPane.showConfirmDialog(MainModule_.instance.getUI().getFrontWindow(),
|
||||
text + "\nВы уверены?",
|
||||
"Подтверждение",
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
|
||||
Reference in New Issue
Block a user