Couleur par défaut
This commit is contained in:
parent
700d7f2c52
commit
28d9248fc7
@ -1,10 +1,30 @@
|
||||
package fr.iutfbleau.projetAgile;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import java.awt.Color;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import fr.iutfbleau.projetAgile.Menu.View.Menu;
|
||||
import fr.iutfbleau.projetAgile.Puissance4.Utils.Constants;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
UIManager.put("Button.background", Constants.RED);
|
||||
UIManager.put("Button.foreground", Color.WHITE);
|
||||
UIManager.put("OptionPane.background", Constants.BACKGROUND_COLOR);
|
||||
UIManager.put("Panel.background", Constants.BACKGROUND_COLOR);
|
||||
UIManager.put("Panel.foreground", Color.WHITE);
|
||||
UIManager.put("Label.background", Constants.BACKGROUND_COLOR);
|
||||
UIManager.put("Label.foreground", Color.WHITE);
|
||||
UIManager.put("TextPane.foreground", Color.WHITE);
|
||||
UIManager.put("OptionPane.messageForeground", Color.WHITE);
|
||||
UIManager.put("RadioButton.background", Constants.BACKGROUND_COLOR);
|
||||
UIManager.put("RadioButton.foreground", Color.WHITE);
|
||||
UIManager.put("Button.focus", Constants.RED);
|
||||
UIManager.put("Button.border", new EmptyBorder(5,10,5,10));
|
||||
|
||||
JFrame frame = Menu.getFrame();
|
||||
JPanel menu=Menu.InitMenu();
|
||||
frame.add(menu, Menu.MENU);
|
||||
|
@ -1,14 +1,19 @@
|
||||
package fr.iutfbleau.projetAgile.Menu.Controller;
|
||||
|
||||
import java.awt.event.*;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JOptionPane;
|
||||
import fr.iutfbleau.projetAgile.Menu.View.Menu;
|
||||
|
||||
public class ObservateurAccueil implements ActionListener{
|
||||
|
||||
public ObservateurAccueil(){}
|
||||
|
||||
public void actionPerformed(ActionEvent evenement){
|
||||
int confirmation = JOptionPane.showConfirmDialog(Menu.getFrame(), "Etes-vous sûr de vouloir retourner au menu ?", "Menu", JOptionPane.YES_NO_OPTION);
|
||||
if(confirmation == 1) return;
|
||||
JButton e = (JButton) evenement.getSource();
|
||||
int confirmation = JOptionPane.showConfirmDialog(e.getRootPane(), "Etes-vous sûr de vouloir retourner au menu ?", "Menu", JOptionPane.YES_NO_OPTION);
|
||||
if(confirmation != JOptionPane.YES_OPTION) return;
|
||||
Menu.show(Menu.MENU);
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import fr.iutfbleau.projetAgile.Puissance4.Utils.Constants;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import org.mariadb.jdbc.*;
|
||||
import java.sql.Statement;
|
||||
import java.util.concurrent.CancellationException;
|
||||
|
||||
@ -32,6 +31,7 @@ public class LancementPuissance4 implements Jeu{
|
||||
* @throws CancellationException Renvoie une exception si les utilisateurs annule le lancement de la partie
|
||||
*/
|
||||
public LancementPuissance4(JFrame fenetre) throws CancellationException{
|
||||
|
||||
String J1 = null;
|
||||
String J2 = null;
|
||||
String J3 = null;
|
||||
|
@ -26,6 +26,11 @@ public class Constants {
|
||||
* La couleur de fond du panneau
|
||||
*/
|
||||
public final static Color BACKGROUND_COLOR = new Color(31,31,31);
|
||||
/**
|
||||
* La couleur des boutons
|
||||
*/
|
||||
public final static Color RED = new Color(255,64,64);
|
||||
|
||||
/**
|
||||
* L'entier qui représente un pion "vide"
|
||||
*/
|
||||
|
@ -8,12 +8,14 @@ import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.colorchooser.AbstractColorChooserPanel;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Color;
|
||||
|
||||
|
||||
import fr.iutfbleau.projetAgile.Puissance4.Controller.ColorActionListener;
|
||||
@ -63,11 +65,14 @@ public class ColorChooserDialog extends JDialog{
|
||||
}
|
||||
|
||||
JButton confirmButton = new JButton("Confirmer");
|
||||
confirmButton.setFocusPainted(false);
|
||||
confirmButton.setActionCommand(Constants.CONFIRM);
|
||||
JButton denyButton = new JButton("Annuler");
|
||||
denyButton.setFocusPainted(false);
|
||||
denyButton.setActionCommand(Constants.DENY);
|
||||
|
||||
JPanel panelButton = new JPanel();
|
||||
panelButton.setOpaque(false);
|
||||
panelButton.add(confirmButton);
|
||||
panelButton.add(denyButton);
|
||||
|
||||
|
@ -128,12 +128,12 @@ public class Puissance4Panel extends JPanel{
|
||||
this.add(this.reset, gbc);
|
||||
|
||||
|
||||
reset.setBackground(new Color(255,64,64));
|
||||
reset.setBackground(Constants.RED);
|
||||
reset.setForeground(Color.WHITE);
|
||||
reset.setFocusPainted(false);
|
||||
reset.setBorder(new EmptyBorder(5,10,5,10));
|
||||
|
||||
menu.setBackground(new Color(255,64,64));
|
||||
menu.setBackground(Constants.RED);
|
||||
menu.setForeground(Color.WHITE);
|
||||
menu.setFocusPainted(false);
|
||||
menu.setBorder(new EmptyBorder(5,10,5,10));
|
||||
|
Loading…
Reference in New Issue
Block a user