no message
This commit is contained in:
@@ -1,8 +1,40 @@
|
||||
package Common.Visual;
|
||||
import Common_old.UI.Menus_2023.DataMenuBar;
|
||||
import Common.Database.Tables.DataSet;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Stack;
|
||||
public class CommonUI {
|
||||
public static LinkedHashMap<Class<? extends DataSet>, DataMenuBar> menuBars = new LinkedHashMap<>();
|
||||
public static Stack<Component> windowsStack = new Stack<>();
|
||||
//-----
|
||||
public static void Clear(Container container) {
|
||||
container.removeAll();
|
||||
container.repaint();
|
||||
container.revalidate();
|
||||
}
|
||||
// http://java-online.ru/swing-joptionpane.xhtml
|
||||
public static <T> void TrySelect(JComboBox box, T value_in) {
|
||||
if (value_in != null) {
|
||||
for (int i = 0; i < box.getItemCount(); ++i) {
|
||||
T value = (T) box.getItemAt(i);
|
||||
if (value.equals(value_in)) {
|
||||
box.setSelectedIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
box.addItem(value_in);
|
||||
box.setSelectedIndex(box.getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
public static void TrySelect_s(JComboBox box, String value_string_in) {
|
||||
for (int i = 0; i < box.getItemCount(); ++i) {
|
||||
Object value = box.getItemAt(i);
|
||||
if (value.toString().equals(value_string_in)) {
|
||||
box.setSelectedIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user