Skip to content

Commit

Permalink
Correcciones de funcionamiento, soporte para mas controles, mas colores
Browse files Browse the repository at this point in the history
  • Loading branch information
Israel-ICM committed Oct 14, 2021
1 parent 804cb7c commit 9746e6d
Show file tree
Hide file tree
Showing 106 changed files with 1,020 additions and 164 deletions.
4 changes: 0 additions & 4 deletions build/built-jar.properties

This file was deleted.

Binary file modified build/classes/icm/sphynx/styles/MetroUI.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/styles/MyStyles.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIButton.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UICheckBox.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIComboBox.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UILabel.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIList.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIOptionPane.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIPanel.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIPasswordField.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIProgressBar.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIRadioButton.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UIScrollBar.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UISlider.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UITabbedPane.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UITable.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UITableHeader.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UITextArea.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UITextField$1.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UITextField$2.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UITextField.class
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/components/metro/UITools.class
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed build/classes/icm/sphynx/ui/tools/MaterialColors.class
Binary file not shown.
Binary file not shown.
Binary file modified build/classes/icm/sphynx/ui/tools/ToolsCellRendererTable.class
Binary file not shown.
Binary file not shown.
Binary file removed captures/example1.PNG
Binary file not shown.
Binary file removed captures/example2.PNG
Binary file not shown.
Binary file added captures/version1.0.1/animation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added captures/version1.0.1/aplicado.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added captures/version1.0.1/aplicado_color.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added captures/version1.0.1/simple.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed captures/vista.gif
Binary file not shown.
25 changes: 5 additions & 20 deletions nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,19 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UITabbedPane.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/MetroUIConfigTheme.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIPanel.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UILookAndFeel.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIMenu.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UITools.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UILabel.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIButton.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIMenuItem.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIComboBox.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/tools/ThemeMaterialUI.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIPasswordField.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UITextField.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UICheckBox.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/styles/MetroUI.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/tools/ToolsHeaderCellRendererTable.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIOptionPane.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/tools/MaterialColors.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIList.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIProgressBar.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIMenuBar.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIScrollBar.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UISlider.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/tools/StyleColors.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIToggleButton.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UITableHeader.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UIRadioButton.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/styles/MyStyles.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/tools/ToolsCellRendererTable.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UITextArea.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/components/metro/UITable.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/styles/MetroUI.java</file>
<file>file:/C:/Users/josue2/Documents/NetBeansProjects/MyStyles/src/icm/sphynx/ui/tools/ToolsHeaderCellRendererTable.java</file>
</group>
</open-files>
</project-private>
162 changes: 131 additions & 31 deletions src/icm/sphynx/styles/MetroUI.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package icm.sphynx.styles;

import icm.sphynx.ui.components.metro.MetroUIConfigTheme;
import icm.sphynx.ui.components.metro.UIButton;
import icm.sphynx.ui.components.metro.UICheckBox;
import icm.sphynx.ui.components.metro.UIComboBox;
import icm.sphynx.ui.components.metro.UIFormattedTextField;
import icm.sphynx.ui.components.metro.UISpinner;
import icm.sphynx.ui.components.metro.UILabel;
import icm.sphynx.ui.components.metro.UIList;
import icm.sphynx.ui.components.metro.UILookAndFeel;
import icm.sphynx.ui.components.metro.UIMenu;
import icm.sphynx.ui.components.metro.UIMenuBar;
import icm.sphynx.ui.components.metro.UIMenuItem;
Expand All @@ -15,62 +18,148 @@
import icm.sphynx.ui.components.metro.UIRadioButton;
import icm.sphynx.ui.components.metro.UIScrollBar;
import icm.sphynx.ui.components.metro.UISlider;
import icm.sphynx.ui.components.metro.UISplitPane;
import icm.sphynx.ui.components.metro.UITabbedPane;
import icm.sphynx.ui.components.metro.UITable;
import icm.sphynx.ui.components.metro.UITableHeader;
import icm.sphynx.ui.components.metro.UITextArea;
import icm.sphynx.ui.components.metro.UITextField;
import icm.sphynx.ui.tools.MaterialColors;
import icm.sphynx.ui.components.metro.UIToggleButton;
import icm.sphynx.ui.components.metro.UITools;
import icm.sphynx.ui.tools.IconsMetroUI;
import icm.sphynx.ui.tools.StyleColors;
import icm.sphynx.ui.tools.ThemeMetroUI;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Insets;
import javafx.scene.layout.Border;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.Painter;
import javax.swing.UIManager;
import javax.swing.border.CompoundBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.MatteBorder;
import javax.swing.plaf.metal.MetalLookAndFeel;

/**
* @author israel-icm
*/
public class MetroUI {
/**
* Instala la versión normal del estilo
* @param primaryColor Color hexadecimal que se utilizará en el estilo
* @param autoColorCorrector Define si se utilizará el corrector de color según la variable primaryColor
*/
public void installLight() {
public static void installLight(String primaryColor, boolean autoColorCorrector) {
if (autoColorCorrector)
primaryColor = UITools.getColorPredeterminado(primaryColor);

MetroUIConfigTheme.setDarkMode(false);
MetroUIConfigTheme.setPrimaryColor(primaryColor);

installComponents();
UIManager.put("Panel.background", Color.decode(MaterialColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("MenuBar.background", Color.decode(MaterialColors.LIGHT_BACKGROUND_PANEL));

UIManager.put("MenuBar.background", Color.decode(StyleColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("MenuBar.border", null);
UIManager.put("Menu.background", Color.decode(MaterialColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("MenuItem.background", Color.decode(MaterialColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("MenuItem.foreground", Color.decode(MaterialColors.LIGHT_FOREGROUND));
UIManager.put("Label.foreground", Color.decode(MaterialColors.LIGHT_FOREGROUND));
UIManager.put("CheckBox.foreground", Color.decode(MaterialColors.LIGHT_FOREGROUND));
UIManager.put("RadioButton.foreground", Color.decode(MaterialColors.LIGHT_FOREGROUND));
UIManager.put("Table.background", Color.decode(MaterialColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("Table.foreground", Color.decode(MaterialColors.LIGHT_FOREGROUND));

// UIManager.put("Menu.background", Color.decode(StyleColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("Menu.foreground", Color.decode(StyleColors.LIGHT_FOREGROUND));
UIManager.put("Menu.font", new Font(UITools.FONT_DEFAULT, Font.BOLD, 13));

UIManager.put("MenuItem.background", Color.decode(StyleColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("MenuItem.foreground", Color.decode(StyleColors.LIGHT_FOREGROUND));

LineBorder border = new LineBorder(Color.decode(UITools.COLOR_BORDER_DEFAULT), 2);
// UIManager.put("ComboBox.selectionBackground", MetroUIConfigTheme.getPrimaryColor());
UIManager.put("ComboBox.selectionForeground", Color.WHITE);
UIManager.put("ComboBox.font", new Font(UITools.FONT_DEFAULT, Font.PLAIN, 12));
UIManager.put("ComboBox.border", border);
// UIManager.put("ComboBox.buttonHighlight", MetroUIConfigTheme.getPrimaryColor());

UIManager.put("Table.focusCellHighlightBorder", BorderFactory.createMatteBorder(2, 2, 2, 2, Color.WHITE));

MatteBorder bordeDelgadoGris = BorderFactory.createMatteBorder(0, 1, 0, 1, Color.decode("#CCCCCC"));
CompoundBorder bordeAnchoCelda = BorderFactory.createCompoundBorder(bordeDelgadoGris, BorderFactory.createEmptyBorder(UITools.PADDING_CONTENTS, UITools.PADDING_CONTENTS, UITools.PADDING_CONTENTS, UITools.PADDING_CONTENTS));
UIManager.put("TableHeader.cellBorder", bordeAnchoCelda);

UIManager.put("FileChooser.detailsViewIcon", IconsMetroUI.iconListDetail(18, "#FFFFFF"));
UIManager.put("FileChooser.homeFolderIcon", new IconsMetroUI().iconHome(18));
UIManager.put("FileChooser.newFolderIcon", new IconsMetroUI().iconNewFolder(18));
UIManager.put("FileChooser.listViewIcon", new IconsMetroUI().iconList(18));
UIManager.put("FileChooser.upFolderIcon", new IconsMetroUI().iconUpFolder(18));

UIManager.put("FileView.computerIcon", new IconsMetroUI().iconComputer(20));
UIManager.put("FileView.fileIcon", new IconsMetroUI().iconFile(20));
UIManager.put("FileView.directoryIcon", new IconsMetroUI().iconDirectory(20));
UIManager.put("FileView.hardDriveIcon", new IconsMetroUI().iconHardDrive(20));
UIManager.put("FileView.floppyDriveIcon", new IconsMetroUI().iconFloppyDrive(20));

UIManager.put("ProgressBar.cycleTime", 1);
}

/**
* Instala la versión oscura del estilo
*/
public void installDark() {
public static void installDark(String primaryColor, boolean autoColorCorrector) {
if (autoColorCorrector)
primaryColor = UITools.getColorPredeterminado(primaryColor);

MetroUIConfigTheme.setDarkMode(true);
MetroUIConfigTheme.setPrimaryColor(primaryColor);

installComponents();
UIManager.put("Panel.background", Color.decode(MaterialColors.DARK_BACKGROUND_PANEL));
UIManager.put("MenuBar.background", Color.decode(MaterialColors.DARK_BACKGROUND_PANEL));
UIManager.put("MenuBar.border", Color.decode(MaterialColors.DARK_FOREGROUND));
UIManager.put("Menu.background", Color.decode(MaterialColors.DARK_BACKGROUND_PANEL));
UIManager.put("MenuItem.background", Color.decode(MaterialColors.DARK_BACKGROUND_PANEL));
UIManager.put("MenuItem.foreground", Color.decode(MaterialColors.DARK_FOREGROUND));
UIManager.put("Label.foreground", Color.decode(MaterialColors.DARK_FOREGROUND));
UIManager.put("CheckBox.foreground", Color.decode(MaterialColors.DARK_FOREGROUND));
UIManager.put("RadioButton.foreground", Color.decode(MaterialColors.DARK_FOREGROUND));
UIManager.put("Table.background", Color.decode(MaterialColors.DARK_BACKGROUND_PANEL));
UIManager.put("Table.foreground", Color.decode(MaterialColors.DARK_FOREGROUND));
// UIManager.put("ScrollPane.background", Color.red);

UIManager.put("MenuBar.background", Color.decode(StyleColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("MenuBar.border", null);

// UIManager.put("Menu.background", Color.decode(StyleColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("Menu.foreground", Color.decode(StyleColors.LIGHT_FOREGROUND));
UIManager.put("Menu.font", new Font(UITools.FONT_DEFAULT, Font.BOLD, 13));

UIManager.put("MenuItem.background", Color.decode(StyleColors.LIGHT_BACKGROUND_PANEL));
UIManager.put("MenuItem.foreground", Color.decode(StyleColors.LIGHT_FOREGROUND));

LineBorder border = new LineBorder(Color.decode(UITools.COLOR_BORDER_DEFAULT), 2);
// UIManager.put("ComboBox.selectionBackground", MetroUIConfigTheme.getPrimaryColor());
UIManager.put("ComboBox.selectionForeground", Color.WHITE);
UIManager.put("ComboBox.font", new Font(UITools.FONT_DEFAULT, Font.PLAIN, 12));
UIManager.put("ComboBox.border", border);
// UIManager.put("ComboBox.buttonHighlight", MetroUIConfigTheme.getPrimaryColor());

Color bordeFocus = Color.WHITE;
if (MetroUIConfigTheme.getDarkMode())
bordeFocus = Color.decode("#CCCCCC");
UIManager.put("Table.focusCellHighlightBorder", BorderFactory.createMatteBorder(2, 2, 2, 2, bordeFocus));

MatteBorder bordeDelgadoGris = BorderFactory.createMatteBorder(0, 1, 0, 1, Color.decode("#CCCCCC"));
CompoundBorder bordeAnchoCelda = BorderFactory.createCompoundBorder(bordeDelgadoGris, BorderFactory.createEmptyBorder(UITools.PADDING_CONTENTS, UITools.PADDING_CONTENTS, UITools.PADDING_CONTENTS, UITools.PADDING_CONTENTS));
UIManager.put("TableHeader.cellBorder", bordeAnchoCelda);

UIManager.put("FileChooser.detailsViewIcon", IconsMetroUI.iconListDetail(18, "#FFFFFF"));
UIManager.put("FileChooser.homeFolderIcon", new IconsMetroUI().iconHome(18));
UIManager.put("FileChooser.newFolderIcon", new IconsMetroUI().iconNewFolder(18));
UIManager.put("FileChooser.listViewIcon", new IconsMetroUI().iconList(18));
UIManager.put("FileChooser.upFolderIcon", new IconsMetroUI().iconUpFolder(18));

UIManager.put("FileView.computerIcon", new IconsMetroUI().iconComputer(20));
UIManager.put("FileView.fileIcon", new IconsMetroUI().iconFile(20));
UIManager.put("FileView.directoryIcon", new IconsMetroUI().iconDirectory(20));
UIManager.put("FileView.hardDriveIcon", new IconsMetroUI().iconHardDrive(20));
UIManager.put("FileView.floppyDriveIcon", new IconsMetroUI().iconFloppyDrive(20));

UIManager.put("ProgressBar.cycleTime", 1);
}

/**
* Cambia los estilos componente a componente
*/
private void installComponents() {
// MetalLookAndFeel.setCurrentTheme(new ThemeMaterialUI());
UIManager.put("LookAndFeelUI", UILookAndFeel.class.getName());
private static void installComponents() {
// MetalLookAndFeel.setCurrentTheme(new ThemeMetroUI());
UIManager.put("ScrollBarUI", UIScrollBar.class.getName());
UIManager.put("LabelUI", UILabel.class.getName());
UIManager.put("PanelUI", UIPanel.class.getName());
Expand All @@ -90,6 +179,17 @@ private void installComponents() {
UIManager.put("TableHeaderUI", UITableHeader.class.getName());
UIManager.put("TableUI", UITable.class.getName());
UIManager.put("OptionPaneUI", UIOptionPane.class.getName());
// UIManager.put("ComboBoxUI", UIComboBox.class.getName());
UIManager.put("SpinnerUI", UISpinner.class.getName());
UIManager.put("FormattedTextFieldUI", UIFormattedTextField.class.getName());
UIManager.put("ToggleButtonUI", UIToggleButton.class.getName());
// UIManager.put("FileChooserUI", UIFileChooser.class.getName());
UIManager.put("ComboBoxUI", UIComboBox.class.getName());
UIManager.put("SplitPaneUI", UISplitPane.class.getName());

/*try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
// e.printStackTrace();
}*/
}
}
39 changes: 36 additions & 3 deletions src/icm/sphynx/styles/MyStyles.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,55 @@
package icm.sphynx.styles;

import icm.sphynx.ui.components.metro.MetroUIConfigTheme;
import icm.sphynx.ui.components.metro.UITools;
import icm.sphynx.ui.tools.StyleColors;
import java.awt.Color;

/**
* @author israel-icm
* @date 2021-08-10
* @version 1.0.0
* @version 1.0.1
*/
public class MyStyles {
public final static int METRO_UI = 1;
public final static int METRO_UI_DARK = 2;

public final static String COLOR_RED = "#EA4E4E";
public final static String COLOR_ORANGE = "#F97637";
public final static String COLOR_YELLOW = "#FFDA67";
public final static String COLOR_GREEN_LIGHT = "#7CEA82";
public final static String COLOR_GREEN_DARK = "#38AA5E";
public final static String COLOR_BLUE_LIGHT = "#63C6E8";
public final static String COLOR_BLUE_DARK = "#2D8DAF";
public final static String COLOR_PURPLE_LIGHT = "#CB7BF7";
public final static String COLOR_PURPLE_DARK = "#924BB7";
public final static String COLOR_ROSE = "#F97EC1";

/**
* Inicializa el estilo que se quiere utilizar
* @param style Estilo que se utilizará (Ej. MyStyles.METRO_UI)
*/
public static void install(int style) {
install(style, StyleColors.COLOR_PRIMARY, false);
}
/**
* Inicializa el estilo que se quiere utilizar
* @param style Estilo que se utilizará (Ej. MyStyles.METRO_UI)
* @param primaryColor Color hexadecimal que se utilizará en el estilo
*/
public static void install(int style, String primaryColor) {
install(style, primaryColor, false);
}
/**
* Inicializa el estilo que se quiere utilizar
* @param style Estilo que se utilizará (Ej. MyStyles.METRO_UI)
* @param primaryColor Color hexadecimal que se utilizará en el estilo
* @param autoColorCorrector Define si se utilizará el corrector de color según la variable primaryColor
*/
public static void install(int style, String primaryColor, boolean autoColorCorrector) {
switch (style) {
case MyStyles.METRO_UI: new MetroUI().installLight(); break;
case MyStyles.METRO_UI_DARK: new MetroUI().installDark(); break;
case MyStyles.METRO_UI: MetroUI.installLight(primaryColor, autoColorCorrector); break;
case MyStyles.METRO_UI_DARK: MetroUI.installDark(primaryColor, autoColorCorrector); break;
default: break;
}
}
Expand Down
40 changes: 40 additions & 0 deletions src/icm/sphynx/ui/components/metro/MetroUIConfigTheme.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package icm.sphynx.ui.components.metro;

import icm.sphynx.styles.MetroUI;
import icm.sphynx.ui.tools.StyleColors;
import java.awt.Color;
import javax.swing.UIManager;

/**
*
* @author israel-icm
*/
public class MetroUIConfigTheme {
public static void setPrimaryColor(String colorHex) {
setPrimaryColor(colorHex, false);
}
public static void setPrimaryColor(String colorHex, boolean refresh) {
UIManager.put("MetroUI.primaryColor", Color.decode(colorHex));
setSecondColor(colorHex);
}

private static void setSecondColor(String colorHex) {
UIManager.put("MetroUI.secondColor", Color.decode(UITools.getSecondColor(colorHex)));
}

public static void setDarkMode(boolean dark) {
UIManager.put("MetroUI.darkMode", dark);
}

public static Color getPrimaryColor() {
return UIManager.getColor("MetroUI.primaryColor");
}

public static Color getSecondColor() {
return UIManager.getColor("MetroUI.secondColor");
}

public static boolean getDarkMode() {
return UIManager.getBoolean("MetroUI.darkMode");
}
}
Loading

0 comments on commit 9746e6d

Please sign in to comment.