|
@ -2,7 +2,9 @@ package de.sogomn.rat; |
|
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
import java.awt.Color; |
|
|
import java.awt.Font; |
|
|
import java.awt.Font; |
|
|
|
|
|
import java.awt.FontFormatException; |
|
|
import java.awt.image.BufferedImage; |
|
|
import java.awt.image.BufferedImage; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
import javax.swing.ImageIcon; |
|
|
import javax.swing.ImageIcon; |
|
|
import javax.swing.Painter; |
|
|
import javax.swing.Painter; |
|
@ -23,17 +25,28 @@ final class GUISettings { |
|
|
private static final Color BRIGHTER = new Color(255, 220, 190); |
|
|
private static final Color BRIGHTER = new Color(255, 220, 190); |
|
|
private static final Color DARKER = new Color(225, 185, 155); |
|
|
private static final Color DARKER = new Color(225, 185, 155); |
|
|
private static final Color ALTERNATIVE = new Color(245, 235, 215); |
|
|
private static final Color ALTERNATIVE = new Color(245, 235, 215); |
|
|
private static final Color SELECTION = new Color(225, 215, 195); |
|
|
|
|
|
|
|
|
private static final Color SELECTION = new Color(100, 115, 155); |
|
|
|
|
|
|
|
|
private static final EmptyBorder TABLE_CELL_BORDER = new EmptyBorder(2, 5, 2, 5); |
|
|
private static final EmptyBorder TABLE_CELL_BORDER = new EmptyBorder(2, 5, 2, 5); |
|
|
|
|
|
|
|
|
private static final Font FONT = new Font("Trebuchet MS", Font.PLAIN, 12); |
|
|
|
|
|
|
|
|
|
|
|
private static final BufferedImage[] ICONS = new SpriteSheet("/gui_notification_icons.png", 16, 16).getSprites(); |
|
|
|
|
|
private static final ImageIcon ERROR_ICON = new ImageIcon(ImageUtils.scaleImage(ICONS[0], 2)); |
|
|
|
|
|
private static final ImageIcon INFORMATION_ICON = new ImageIcon(ImageUtils.scaleImage(ICONS[1], 2)); |
|
|
|
|
|
private static final ImageIcon QUESTION_ICON = new ImageIcon(ImageUtils.scaleImage(ICONS[2], 2)); |
|
|
|
|
|
private static final ImageIcon WARNING_ICON = new ImageIcon(ImageUtils.scaleImage(ICONS[3], 2)); |
|
|
|
|
|
|
|
|
private static final Font FONT; |
|
|
|
|
|
|
|
|
|
|
|
private static final BufferedImage[] NOTIFICATION_ICONS = new SpriteSheet("/gui_notification_icons.png", 16, 16).getSprites(); |
|
|
|
|
|
private static final BufferedImage[] FILE_ICONS = new SpriteSheet("/gui_file_icons.png", 16, 16).getSprites(); |
|
|
|
|
|
private static final ImageIcon ERROR_ICON = new ImageIcon(ImageUtils.scaleImage(NOTIFICATION_ICONS[0], 2)); |
|
|
|
|
|
private static final ImageIcon INFORMATION_ICON = new ImageIcon(ImageUtils.scaleImage(NOTIFICATION_ICONS[1], 2)); |
|
|
|
|
|
private static final ImageIcon QUESTION_ICON = new ImageIcon(ImageUtils.scaleImage(NOTIFICATION_ICONS[2], 2)); |
|
|
|
|
|
private static final ImageIcon WARNING_ICON = new ImageIcon(ImageUtils.scaleImage(NOTIFICATION_ICONS[3], 2)); |
|
|
|
|
|
private static final ImageIcon SAVE_ICON = new ImageIcon(FILE_ICONS[0]); |
|
|
|
|
|
private static final ImageIcon FOLDER_ICON = new ImageIcon(FILE_ICONS[1]); |
|
|
|
|
|
private static final ImageIcon FOLDER_OPEN_ICON = new ImageIcon(FILE_ICONS[2]); |
|
|
|
|
|
private static final ImageIcon FILE_ICON = new ImageIcon(FILE_ICONS[3]); |
|
|
|
|
|
private static final ImageIcon LIST_ICON = new ImageIcon(FILE_ICONS[4]); |
|
|
|
|
|
private static final ImageIcon DISC_ICON = new ImageIcon(FILE_ICONS[5]); |
|
|
|
|
|
private static final ImageIcon HOME_ICON = new ImageIcon(FILE_ICONS[6]); |
|
|
|
|
|
private static final ImageIcon NEW_FOLDER_ICON = new ImageIcon(FILE_ICONS[7]); |
|
|
|
|
|
private static final ImageIcon UP_FOLDER_ICON = new ImageIcon(FILE_ICONS[8]); |
|
|
|
|
|
private static final ImageIcon DETAILS_ICON = new ImageIcon(FILE_ICONS[9]); |
|
|
|
|
|
|
|
|
private static final Painter<?> BASE_PAINTER = (g, object, width, height) -> { |
|
|
private static final Painter<?> BASE_PAINTER = (g, object, width, height) -> { |
|
|
g.setColor(BASE); |
|
|
g.setColor(BASE); |
|
@ -50,6 +63,23 @@ final class GUISettings { |
|
|
g.fillRect(0, 0, width, height); |
|
|
g.fillRect(0, 0, width, height); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
private static final Painter<?> SELECTION_PAINTER = (g, object, width, height) -> { |
|
|
|
|
|
g.setColor(SELECTION); |
|
|
|
|
|
g.fillRect(0, 0, width, height); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
static { |
|
|
|
|
|
Font newFont; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
newFont = Font.createFont(Font.TRUETYPE_FONT, Ratty.class.getResourceAsStream("/lato.ttf")).deriveFont(13f); |
|
|
|
|
|
} catch (final IOException | FontFormatException ex) { |
|
|
|
|
|
newFont = new Font("Trebuchet MS", Font.PLAIN, 13); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FONT = newFont; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private GUISettings() { |
|
|
private GUISettings() { |
|
|
//... |
|
|
//... |
|
|
} |
|
|
} |
|
@ -71,16 +101,16 @@ final class GUISettings { |
|
|
defaults.put("Button[Focused+Pressed].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("Button[Focused+Pressed].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("Button[Default+Focused+Pressed].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("Button[Default+Focused+Pressed].backgroundPainter", DARKER_PAINTER); |
|
|
|
|
|
|
|
|
defaults.put("ToggleButton[Enabled].backgroundPainter", BRIGHTER_PAINTER); |
|
|
|
|
|
defaults.put("ToggleButton[Focused].backgroundPainter", BRIGHTER_PAINTER); |
|
|
|
|
|
|
|
|
defaults.put("ToggleButton[Enabled].backgroundPainter", BASE_PAINTER); |
|
|
|
|
|
defaults.put("ToggleButton[Focused].backgroundPainter", BASE_PAINTER); |
|
|
defaults.put("ToggleButton[MouseOver].backgroundPainter", BRIGHTER_PAINTER); |
|
|
defaults.put("ToggleButton[MouseOver].backgroundPainter", BRIGHTER_PAINTER); |
|
|
defaults.put("ToggleButton[Focused+MouseOver].backgroundPainter", BRIGHTER_PAINTER); |
|
|
defaults.put("ToggleButton[Focused+MouseOver].backgroundPainter", BRIGHTER_PAINTER); |
|
|
defaults.put("ToggleButton[Pressed].backgroundPainter", BRIGHTER_PAINTER); |
|
|
|
|
|
defaults.put("ToggleButton[Focused+Pressed].backgroundPainter", BRIGHTER_PAINTER); |
|
|
|
|
|
|
|
|
defaults.put("ToggleButton[Pressed].backgroundPainter", BASE_PAINTER); |
|
|
|
|
|
defaults.put("ToggleButton[Focused+Pressed].backgroundPainter", BASE_PAINTER); |
|
|
defaults.put("ToggleButton[Selected].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("ToggleButton[Selected].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("ToggleButton[Focused+Selected].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("ToggleButton[Focused+Selected].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("ToggleButton[MouseOver+Selected].backgroundPainter", DARKER_PAINTER); |
|
|
|
|
|
defaults.put("ToggleButton[Focused+MouseOver+Selected].backgroundPainter", DARKER_PAINTER); |
|
|
|
|
|
|
|
|
defaults.put("ToggleButton[MouseOver+Selected].backgroundPainter", BASE_PAINTER); |
|
|
|
|
|
defaults.put("ToggleButton[Focused+MouseOver+Selected].backgroundPainter", BASE_PAINTER); |
|
|
defaults.put("ToggleButton[Pressed+Selected].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("ToggleButton[Pressed+Selected].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("ToggleButton[Focused+Pressed+Selected].backgroundPainter", DARKER_PAINTER); |
|
|
defaults.put("ToggleButton[Focused+Pressed+Selected].backgroundPainter", DARKER_PAINTER); |
|
|
|
|
|
|
|
@ -88,7 +118,6 @@ final class GUISettings { |
|
|
defaults.put("Table:\"Table.cellRenderer\".background", ALTERNATIVE); |
|
|
defaults.put("Table:\"Table.cellRenderer\".background", ALTERNATIVE); |
|
|
defaults.put("Table.alternateRowColor", ALTERNATIVE); |
|
|
defaults.put("Table.alternateRowColor", ALTERNATIVE); |
|
|
defaults.put("Table[Enabled+Selected].textBackground", SELECTION); |
|
|
defaults.put("Table[Enabled+Selected].textBackground", SELECTION); |
|
|
defaults.put("Table[Enabled+Selected].textForeground", Color.BLACK); |
|
|
|
|
|
defaults.put("Table.focusCellHighlightBorder", TABLE_CELL_BORDER); |
|
|
defaults.put("Table.focusCellHighlightBorder", TABLE_CELL_BORDER); |
|
|
defaults.put("TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter", BASE_PAINTER); |
|
|
defaults.put("TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter", BASE_PAINTER); |
|
|
defaults.put("TableHeader:\"TableHeader.renderer\"[MouseOver].backgroundPainter", BASE_PAINTER); |
|
|
defaults.put("TableHeader:\"TableHeader.renderer\"[MouseOver].backgroundPainter", BASE_PAINTER); |
|
@ -104,6 +133,22 @@ final class GUISettings { |
|
|
defaults.put("ScrollBar:\"ScrollBar.button\"[MouseOver].foregroundPainter", BRIGHTER_PAINTER); |
|
|
defaults.put("ScrollBar:\"ScrollBar.button\"[MouseOver].foregroundPainter", BRIGHTER_PAINTER); |
|
|
defaults.put("ScrollBar:\"ScrollBar.button\"[Pressed].foregroundPainter", BASE_PAINTER); |
|
|
defaults.put("ScrollBar:\"ScrollBar.button\"[Pressed].foregroundPainter", BASE_PAINTER); |
|
|
|
|
|
|
|
|
|
|
|
defaults.put("PopupMenu[Enabled].backgroundPainter", BASE_PAINTER); |
|
|
|
|
|
defaults.put("MenuItem[MouseOver].backgroundPainter", SELECTION_PAINTER); |
|
|
|
|
|
|
|
|
|
|
|
defaults.put("Tree:TreeCell[Enabled+Selected].backgroundPainter", SELECTION_PAINTER); |
|
|
|
|
|
defaults.put("Tree:TreeCell[Focused+Selected].backgroundPainter", SELECTION_PAINTER); |
|
|
|
|
|
|
|
|
|
|
|
defaults.put("ComboBox:\"ComboBox.listRenderer\"[Selected].background", SELECTION); |
|
|
|
|
|
defaults.put("ComboBox:\"ComboBox.renderer\"[Selected].background", SELECTION); |
|
|
|
|
|
defaults.put("ComboBox[Enabled].backgroundPainter", BASE_PAINTER); |
|
|
|
|
|
defaults.put("ComboBox[Focused].backgroundPainter", BASE_PAINTER); |
|
|
|
|
|
defaults.put("ComboBox[Enabled+Selected].backgroundPainter", BASE_PAINTER); |
|
|
|
|
|
defaults.put("ComboBox[MouseOver].backgroundPainter", BRIGHTER_PAINTER); |
|
|
|
|
|
defaults.put("ComboBox[Focused+MouseOver].backgroundPainter", BRIGHTER_PAINTER); |
|
|
|
|
|
defaults.put("ComboBox[Pressed].backgroundPainter", DARKER_PAINTER); |
|
|
|
|
|
defaults.put("ComboBox[Focused+Pressed].backgroundPainter", DARKER_PAINTER); |
|
|
|
|
|
|
|
|
defaults.put("Button.font", FONT); |
|
|
defaults.put("Button.font", FONT); |
|
|
defaults.put("Table.font", FONT); |
|
|
defaults.put("Table.font", FONT); |
|
|
defaults.put("Label.font", FONT); |
|
|
defaults.put("Label.font", FONT); |
|
@ -119,11 +164,23 @@ final class GUISettings { |
|
|
defaults.put("ToggleButton.font", FONT); |
|
|
defaults.put("ToggleButton.font", FONT); |
|
|
defaults.put("List.font", FONT); |
|
|
defaults.put("List.font", FONT); |
|
|
defaults.put("OptionPane.font", FONT); |
|
|
defaults.put("OptionPane.font", FONT); |
|
|
|
|
|
defaults.put("ComboBox.font", FONT); |
|
|
|
|
|
|
|
|
defaults.put("OptionPane.errorIcon", ERROR_ICON); |
|
|
defaults.put("OptionPane.errorIcon", ERROR_ICON); |
|
|
defaults.put("OptionPane.informationIcon", INFORMATION_ICON); |
|
|
defaults.put("OptionPane.informationIcon", INFORMATION_ICON); |
|
|
defaults.put("OptionPane.questionIcon", QUESTION_ICON); |
|
|
defaults.put("OptionPane.questionIcon", QUESTION_ICON); |
|
|
defaults.put("OptionPane.warningIcon", WARNING_ICON); |
|
|
defaults.put("OptionPane.warningIcon", WARNING_ICON); |
|
|
|
|
|
defaults.put("FileChooser.directoryIcon", FOLDER_ICON); |
|
|
|
|
|
defaults.put("FileChooser.floppyDriveIcon", SAVE_ICON); |
|
|
|
|
|
defaults.put("FileChooser.homeFolderIcon", HOME_ICON); |
|
|
|
|
|
defaults.put("FileChooser.listViewIcon", LIST_ICON); |
|
|
|
|
|
defaults.put("FileChooser.newFolderIcon", NEW_FOLDER_ICON); |
|
|
|
|
|
defaults.put("FileChooser.upFolderIcon", UP_FOLDER_ICON); |
|
|
|
|
|
defaults.put("FileChooser.hardDriveIcon", DISC_ICON); |
|
|
|
|
|
defaults.put("FileChooser.detailsViewIcon", DETAILS_ICON); |
|
|
|
|
|
defaults.put("Tree.closedIcon", FOLDER_ICON); |
|
|
|
|
|
defaults.put("Tree.openIcon", FOLDER_OPEN_ICON); |
|
|
|
|
|
defaults.put("Tree.leafIcon", FILE_ICON); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |