DefaultButton refactor: adding visual improvements, existing Classes and Methods, introducing AppTheme interface
@@ -1,5 +1,6 @@
|
|||||||
package FileManagement;
|
package FileManagement;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@@ -15,6 +16,21 @@ public class FileManager {
|
|||||||
|
|
||||||
findSavedCharacters();
|
findSavedCharacters();
|
||||||
|
|
||||||
|
loadFonts();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFonts() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
GraphicsEnvironment ge =
|
||||||
|
GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||||
|
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("dndBuilder/src/Resources/Fonts/SanSalvi.ttf")));
|
||||||
|
} catch (IOException|FontFormatException e) {
|
||||||
|
//Handle exception
|
||||||
|
System.out.println("Error finding font.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isReturninguser() {
|
public boolean isReturninguser() {
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package GUI;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public interface AppTheme {
|
||||||
|
|
||||||
|
public Color lightAccent = Color.decode("#EAF0CE");
|
||||||
|
public Color lightBrown = Color.decode("#EBBE9B");
|
||||||
|
public Color medBrown = Color.decode("#E4A677");
|
||||||
|
|
||||||
|
public Color darkBrown = Color.decode("#502419");
|
||||||
|
|
||||||
|
public Color darkestBrown = Color.decode("#1F0E0A");
|
||||||
|
|
||||||
|
public Color black = Color.BLACK;
|
||||||
|
|
||||||
|
public Color confirmationBlue = Color.decode("#296EB4");
|
||||||
|
|
||||||
|
public Color rejectionRed = Color.decode("#A23E48");
|
||||||
|
|
||||||
|
public Font headerFont = new Font("SanSalvi", Font.BOLD, 45);
|
||||||
|
public Font subHeaderFont = new Font("SanSalvi", Font.PLAIN, 35);
|
||||||
|
|
||||||
|
public Font paragraphFont = new Font("SanSalvi", Font.PLAIN, 20);
|
||||||
|
public Font buttonFont = new Font("SanSalvi", Font.PLAIN, 15);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,30 +1,12 @@
|
|||||||
package GUI;
|
package GUI;
|
||||||
|
|
||||||
import Character.AbilityScores.Stats;
|
|
||||||
import Character.Classes.*;
|
|
||||||
import Character.Races.*;
|
|
||||||
import GUI.Panels.*;
|
import GUI.Panels.*;
|
||||||
|
import Resources.CustomAssets.DefaultButton;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
|
|
||||||
/* private void getNextPanel() {
|
|
||||||
|
|
||||||
|
|
||||||
return switch (currentPanel) {
|
|
||||||
case 1 -> guiPanels.getRacePanel();
|
|
||||||
case 2 -> guiPanels.getClassPanel();
|
|
||||||
case 3 -> guiPanels.getAbilityScorePanel();
|
|
||||||
case 4 -> guiPanels.getDescriptionPanel();
|
|
||||||
case 5 -> guiPanels.getEquipmentPanel();
|
|
||||||
case 6 -> guiPanels.getFinalizePanel();
|
|
||||||
case 7 -> guiPanels.getLoadMenuPanel();
|
|
||||||
default -> guiPanels.getMainMenuPanel();
|
|
||||||
};
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public class GUImanager extends JFrame {
|
public class GUImanager extends JFrame {
|
||||||
|
|
||||||
private static JPanel[] panels;
|
private static JPanel[] panels;
|
||||||
@@ -56,7 +38,7 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
add(createMasterPanel());
|
add(panels[currentPanel]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,8 +46,10 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
setPreferredSize(new Dimension(730,550));
|
setPreferredSize(new Dimension(750,550));
|
||||||
setSize(getPreferredSize());
|
setSize(getPreferredSize());
|
||||||
|
setResizable(false);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
|
UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
|
||||||
@@ -75,31 +59,12 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel createMasterPanel() {
|
private DefaultButton createBackButton() {
|
||||||
|
|
||||||
JPanel masterPanel = new JPanel();
|
DefaultButton button = new DefaultButton("Back");
|
||||||
masterPanel.add(panels[currentPanel]);
|
|
||||||
|
|
||||||
JPanel navigationContainer = new JPanel(new GridLayout(1, 2, 10, 10));
|
|
||||||
navigationContainer.add(createBackButton());
|
|
||||||
navigationContainer.add(createContinueButton());
|
|
||||||
|
|
||||||
//masterPanel.add(navigationContainer);
|
|
||||||
|
|
||||||
// return masterPanel;
|
|
||||||
|
|
||||||
return panels[currentPanel];
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private JButton createBackButton() {
|
|
||||||
|
|
||||||
JButton button = new JButton("Back");
|
|
||||||
button.addActionListener(
|
button.addActionListener(
|
||||||
|
|
||||||
new ActionListener() {
|
e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
|
|
||||||
lastPanel--;
|
lastPanel--;
|
||||||
currentPanel--;
|
currentPanel--;
|
||||||
@@ -107,7 +72,6 @@ public class GUImanager extends JFrame {
|
|||||||
clearAndReset();
|
clearAndReset();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -115,14 +79,12 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JButton createContinueButton() {
|
private DefaultButton createContinueButton() {
|
||||||
|
|
||||||
JButton button = new JButton("Continue");
|
DefaultButton button = new DefaultButton("Continue");
|
||||||
button.addActionListener(
|
button.addActionListener(
|
||||||
|
|
||||||
new ActionListener() {
|
e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
|
|
||||||
lastPanel++;
|
lastPanel++;
|
||||||
currentPanel++;
|
currentPanel++;
|
||||||
@@ -130,7 +92,6 @@ public class GUImanager extends JFrame {
|
|||||||
clearAndReset();
|
clearAndReset();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -138,14 +99,12 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JButton createRandomCharacterButton() {
|
private DefaultButton createRandomCharacterButton() {
|
||||||
|
|
||||||
JButton button = new JButton("Create Random Character");
|
DefaultButton button = new DefaultButton("Create Random Character");
|
||||||
button.addActionListener(
|
button.addActionListener(
|
||||||
|
|
||||||
new ActionListener() {
|
e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
|
|
||||||
createRandomCharacter();
|
createRandomCharacter();
|
||||||
|
|
||||||
@@ -155,7 +114,6 @@ public class GUImanager extends JFrame {
|
|||||||
clearAndReset();
|
clearAndReset();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -163,14 +121,12 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JButton createSaveButton() {
|
private DefaultButton createSaveButton() {
|
||||||
|
|
||||||
JButton button = new JButton("Save");
|
DefaultButton button = new DefaultButton("Save");
|
||||||
button.addActionListener(
|
button.addActionListener(
|
||||||
|
|
||||||
new ActionListener() {
|
e -> {
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
|
|
||||||
lastPanel = currentPanel;
|
lastPanel = currentPanel;
|
||||||
currentPanel = 6;
|
currentPanel = 6;
|
||||||
@@ -178,7 +134,6 @@ public class GUImanager extends JFrame {
|
|||||||
clearAndReset();
|
clearAndReset();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -186,6 +141,7 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Need to implement.
|
||||||
private void createRandomCharacter() {
|
private void createRandomCharacter() {
|
||||||
|
|
||||||
|
|
||||||
@@ -196,10 +152,11 @@ public class GUImanager extends JFrame {
|
|||||||
|
|
||||||
getContentPane().removeAll();
|
getContentPane().removeAll();
|
||||||
|
|
||||||
add(createMasterPanel());
|
add(panels[currentPanel]);
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
revalidate();
|
revalidate();
|
||||||
|
pack();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package GUI;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public interface PanelTheme {
|
|
||||||
|
|
||||||
public Color deepRed = new Color(165, 42, 42);
|
|
||||||
public Color lightBrown = new Color(222, 184, 135);
|
|
||||||
public Color darkBrown = new Color(205, 133, 63);
|
|
||||||
|
|
||||||
public Color black = new Color(0, 0, 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,38 +1,38 @@
|
|||||||
package GUI.Panels;
|
package GUI.Panels;
|
||||||
|
|
||||||
import GUI.PanelTheme;
|
import GUI.AppTheme;
|
||||||
import GUI.Panels.SubPanels.*;
|
import GUI.Panels.SubPanels.*;
|
||||||
|
import Resources.CustomAssets.*;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.*;
|
import javax.swing.border.*;
|
||||||
|
|
||||||
public class ChooseRacePanel extends JPanel implements PanelTheme {
|
public class ChooseRacePanel extends JPanel implements AppTheme {
|
||||||
|
|
||||||
private String[] raceOptions;
|
private String[] raceOptions;
|
||||||
|
|
||||||
private String[] raceDescriptions;
|
private String[] raceDescriptions;
|
||||||
|
|
||||||
private InfoPanel infoPanel;
|
private InfoPanel infoPanel;
|
||||||
|
|
||||||
private int raceIndex;
|
private int raceIndex;
|
||||||
private JButton backButton;
|
private JButton backButton;
|
||||||
private JButton continueButton;
|
private JButton continueButton;
|
||||||
|
|
||||||
/**
|
private DefaultButton[] raceOptionButtons;
|
||||||
* Create the panel.
|
|
||||||
*/
|
public ChooseRacePanel(JButton backButton, DefaultButton continueButton) {
|
||||||
public ChooseRacePanel(JButton backButton, JButton continueButton) {
|
|
||||||
super();
|
super();
|
||||||
this.backButton = backButton;
|
this.backButton = backButton;
|
||||||
this.continueButton = continueButton;
|
this.continueButton = continueButton;
|
||||||
|
raceIndex = 0;
|
||||||
createRaces();
|
createRaces();
|
||||||
this.infoPanel = new InfoPanel(raceOptions, raceDescriptions);
|
this.infoPanel = new InfoPanel(raceOptions, raceDescriptions);
|
||||||
|
|
||||||
panelSetup();
|
panelSetup();
|
||||||
|
|
||||||
add(createMasterPanel());
|
createMasterPanel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,41 +48,49 @@ public class ChooseRacePanel extends JPanel implements PanelTheme {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel createMasterPanel() {
|
private void createMasterPanel() {
|
||||||
|
|
||||||
JLabel lblNewLabel = new JLabel("Step 1: Choose Race");
|
JLabel title = new JLabel("Step 1: Choose Race");
|
||||||
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
title.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
lblNewLabel.setFont(new Font("Bodoni 72 Oldstyle", Font.PLAIN, 33));
|
title.setFont(headerFont);
|
||||||
add(lblNewLabel, BorderLayout.NORTH);
|
title.setForeground(darkestBrown);
|
||||||
|
add(title, BorderLayout.NORTH);
|
||||||
|
|
||||||
JPanel racePanel = new JPanel();
|
JPanel racePanel = new JPanel();
|
||||||
racePanel.setOpaque(false);
|
racePanel.setOpaque(false);
|
||||||
racePanel.setLayout(null);
|
racePanel.setLayout(null);
|
||||||
|
|
||||||
racePanel.add(infoPanel);
|
racePanel.add(infoPanel);
|
||||||
|
|
||||||
racePanel.add(createRaceButtonPanel());
|
racePanel.add(createRaceButtonPanel());
|
||||||
|
|
||||||
|
add(racePanel);
|
||||||
add(createNavPanel(), BorderLayout.SOUTH);
|
add(createNavPanel(), BorderLayout.SOUTH);
|
||||||
|
|
||||||
return racePanel;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel createRaceButtonPanel() {
|
private JPanel createRaceButtonPanel() {
|
||||||
|
|
||||||
JPanel raceBtnPanel = new JPanel(new GridLayout(raceOptions.length, 1, 15, 5));
|
JPanel buttonPanel = new JPanel(new GridLayout(raceOptions.length, 1, 0, 0));
|
||||||
raceBtnPanel.setBackground(darkBrown);
|
buttonPanel.setBackground(lightBrown);
|
||||||
raceBtnPanel.setBounds(311, 6, 109, 394);
|
|
||||||
|
buttonPanel.setBounds(585, 45, 135, 355);
|
||||||
|
|
||||||
|
raceOptionButtons = new DefaultButton[raceOptions.length];
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < raceOptionButtons.length; i++) {
|
||||||
|
|
||||||
|
raceOptionButtons[i] = createButton(raceOptions[i], i);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < raceOptions.length; i++) {
|
for (int i = 0; i < raceOptions.length; i++) {
|
||||||
|
|
||||||
raceBtnPanel.add(createButton(raceOptions[i], i));
|
buttonPanel.add(raceOptionButtons[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return raceBtnPanel;
|
return buttonPanel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,9 +103,9 @@ public class ChooseRacePanel extends JPanel implements PanelTheme {
|
|||||||
|
|
||||||
private JPanel createNavPanel() {
|
private JPanel createNavPanel() {
|
||||||
|
|
||||||
JPanel panel = new JPanel();
|
JPanel panel = new JPanel(new GridLayout(1, 2, 30, 0));
|
||||||
panel.setBackground(darkBrown);
|
panel.setBackground(darkestBrown);
|
||||||
|
panel.setBorder(new EmptyBorder(15, 150, 15, 150));
|
||||||
panel.add(backButton);
|
panel.add(backButton);
|
||||||
panel.add(continueButton);
|
panel.add(continueButton);
|
||||||
|
|
||||||
@@ -105,21 +113,22 @@ public class ChooseRacePanel extends JPanel implements PanelTheme {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JButton createButton(String raceName, int index) {
|
private DefaultButton createButton(String raceName, int index) {
|
||||||
|
|
||||||
JButton button = new JButton(raceName);
|
DefaultButton button = new DefaultButton(raceName);
|
||||||
button.addActionListener(
|
button.addActionListener(e -> updateButtons(raceIndex, index));
|
||||||
|
|
||||||
e -> {
|
return button;
|
||||||
|
|
||||||
raceIndex = index;
|
|
||||||
infoPanel.updateInfo(raceIndex);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
private void updateButtons(int lastIndex, int newIndex) {
|
||||||
|
|
||||||
return button;
|
raceOptionButtons[lastIndex].deSelect();
|
||||||
|
raceOptionButtons[newIndex].select();
|
||||||
|
|
||||||
|
raceIndex = newIndex;
|
||||||
|
infoPanel.updateInfo(raceIndex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +138,4 @@ public class ChooseRacePanel extends JPanel implements PanelTheme {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
package GUI.Panels.SubPanels;
|
package GUI.Panels.SubPanels;
|
||||||
|
|
||||||
import GUI.PanelTheme;
|
import GUI.AppTheme;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.BevelBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class InfoPanel extends JPanel implements PanelTheme {
|
public class InfoPanel extends JPanel implements AppTheme {
|
||||||
|
|
||||||
private JTextArea[] descriptions;
|
private JTextArea[] descriptions;
|
||||||
private String[] holderDescriptions;
|
private String[] holderDescriptions;
|
||||||
@@ -48,7 +48,7 @@ public class InfoPanel extends JPanel implements PanelTheme {
|
|||||||
|
|
||||||
panelSetup();
|
panelSetup();
|
||||||
|
|
||||||
add(descriptions[holderIndex]);
|
add(descriptions[0]);
|
||||||
add(portraits[holderIndex][getNextPortrait(holderIndex)]);
|
add(portraits[holderIndex][getNextPortrait(holderIndex)]);
|
||||||
|
|
||||||
repaint();
|
repaint();
|
||||||
@@ -77,14 +77,16 @@ public class InfoPanel extends JPanel implements PanelTheme {
|
|||||||
private void panelSetup() {
|
private void panelSetup() {
|
||||||
|
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setBounds(6, 6, 293, 394);
|
setBounds(5, 5, 600, 400);
|
||||||
setLayout(null);
|
setLayout(null);
|
||||||
|
|
||||||
JLabel infoLbl = new JLabel("Information");
|
JLabel subHeader = new JLabel("Description");
|
||||||
infoLbl.setFont(new Font("Bodoni 72", Font.PLAIN, 20));
|
subHeader.setFont(subHeaderFont);
|
||||||
infoLbl.setHorizontalAlignment(SwingConstants.CENTER);
|
subHeader.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
infoLbl.setBounds(92, 6, 105, 16);
|
subHeader.setBounds(275, 10, 300, 35);
|
||||||
add(infoLbl);
|
subHeader.setForeground(darkestBrown);
|
||||||
|
|
||||||
|
add(subHeader);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,8 +103,10 @@ public class InfoPanel extends JPanel implements PanelTheme {
|
|||||||
tmpDesc.setOpaque(false);
|
tmpDesc.setOpaque(false);
|
||||||
tmpDesc.setEditable(false);
|
tmpDesc.setEditable(false);
|
||||||
tmpDesc.setFocusable(false);
|
tmpDesc.setFocusable(false);
|
||||||
tmpDesc.setFont(new Font("Bodoni 72", Font.PLAIN, 10));
|
tmpDesc.setFont(paragraphFont);
|
||||||
tmpDesc.setBounds(6, 21, 281, 196);
|
tmpDesc.setBounds(275, 45, 300, 355);
|
||||||
|
tmpDesc.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
|
tmpDesc.setForeground(darkestBrown);
|
||||||
|
|
||||||
descriptions[i] = tmpDesc;
|
descriptions[i] = tmpDesc;
|
||||||
|
|
||||||
@@ -118,32 +122,17 @@ public class InfoPanel extends JPanel implements PanelTheme {
|
|||||||
|
|
||||||
File imagesDir;
|
File imagesDir;
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
WINDOWS:
|
|
||||||
attempted
|
|
||||||
dndBuilder/src/GUI/img/category/
|
|
||||||
dndBuilder/src/GUI/img/category
|
|
||||||
/dndBuilder/src/GUI/img/category
|
|
||||||
/dndBuilder/src/GUI/img/category/
|
|
||||||
GUI/img/category/
|
|
||||||
/GUI/img/category/
|
|
||||||
src/GUI/img/category/
|
|
||||||
/src/GUI/img/category/
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(OS.startsWith("Windows")) {
|
if(OS.startsWith("Windows")) {
|
||||||
|
|
||||||
imagesDir = new File("dndBuilder\\src\\GUI\\img\\" + categoryHolder[i] + "\\");
|
imagesDir = new File("dndBuilder\\src\\Resources\\Img\\" + categoryHolder[i] + "\\");
|
||||||
|
|
||||||
} else if (OS.startsWith("Mac")) {
|
} else if (OS.startsWith("Mac")) {
|
||||||
|
|
||||||
imagesDir = new File("dndBuilder/src/GUI/img/" + categoryHolder[i] + "/");
|
imagesDir = new File("dndBuilder/src/Resources/Img/" + categoryHolder[i] + "/");
|
||||||
|
|
||||||
} else if (OS.startsWith("Linux")) {
|
} else if (OS.startsWith("Linux")) {
|
||||||
|
|
||||||
imagesDir = new File("dndBuilder/src/GUI/img/" + categoryHolder[i] + "/");
|
imagesDir = new File("dndBuilder/src/Resources/Img/" + categoryHolder[i] + "/");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -161,7 +150,7 @@ public class InfoPanel extends JPanel implements PanelTheme {
|
|||||||
portraits[i][index] = image(file);
|
portraits[i][index] = image(file);
|
||||||
portraits[i][index].setOpaque(true);
|
portraits[i][index].setOpaque(true);
|
||||||
portraits[i][index].setBackground(lightBrown);
|
portraits[i][index].setBackground(lightBrown);
|
||||||
portraits[i][index].setBounds(6, 229, 281, 159);
|
portraits[i][index].setBounds(10, 45, 250, 355);
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
@@ -180,7 +169,7 @@ public class InfoPanel extends JPanel implements PanelTheme {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
img = ImageIO.read(file);
|
img = ImageIO.read(file);
|
||||||
finalImg = img.getScaledInstance(281, 196, Image.SCALE_SMOOTH);
|
finalImg = img.getScaledInstance(250, 375, Image.SCALE_SMOOTH);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package Resources.CustomAssets;
|
||||||
|
|
||||||
|
import GUI.AppTheme;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
|
||||||
|
public class DefaultButton extends JButton implements AppTheme {
|
||||||
|
|
||||||
|
private boolean selected;
|
||||||
|
|
||||||
|
public DefaultButton(String buttonLabel) {
|
||||||
|
|
||||||
|
super(buttonLabel);
|
||||||
|
applyDefaultButtonStyle();
|
||||||
|
applyCommon();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deSelect() {
|
||||||
|
|
||||||
|
selected = false;
|
||||||
|
applyDefaultButtonStyle();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void select() {
|
||||||
|
|
||||||
|
selected = true;
|
||||||
|
applyFocusedButtonStyle();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyDefaultButtonStyle() {
|
||||||
|
|
||||||
|
setBackground(medBrown);
|
||||||
|
setForeground(darkestBrown);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyFocusedButtonStyle() {
|
||||||
|
|
||||||
|
setBackground(darkestBrown);
|
||||||
|
setForeground(lightAccent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyCommon() {
|
||||||
|
|
||||||
|
addMouseListener(
|
||||||
|
new MouseListener() {
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {}
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e) {}
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e) {}
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent e) { applyFocusedButtonStyle(); }
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent e) {
|
||||||
|
|
||||||
|
if (!selected) {
|
||||||
|
|
||||||
|
applyDefaultButtonStyle();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
setFocusPainted(false);
|
||||||
|
setFont(buttonFont);
|
||||||
|
setBorder(new EmptyBorder(3, 3, 3, 3));
|
||||||
|
|
||||||
|
repaint();
|
||||||
|
revalidate();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package Resources.CustomAssets;
|
||||||
|
|
||||||
|
import javax.swing.border.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class RoundedBorder implements Border {
|
||||||
|
|
||||||
|
private int radius;
|
||||||
|
|
||||||
|
public RoundedBorder(int radius) {
|
||||||
|
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Insets getBorderInsets(Component c) {
|
||||||
|
|
||||||
|
return new Insets(this.radius+1, this.radius+1, this.radius+2, this.radius);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBorderOpaque() {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||||
|
|
||||||
|
g.drawRoundRect(x, y, width-1, height-1, radius, radius);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |