/*
* Gui.java
*/
package presentacio;
import aplicacio.Controlador;
import java.net.URL;
import javax.help.HelpBroker;
import javax.help.HelpSet;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
/**
* Classe que modela la UI de l'aplicacio.
* @author Joaquim Laplana
*/
public class Gui extends javax.swing.JFrame {
private int eoid;
private Controlador con;
public Gui(int eoid, Controlador con) {
this.eoid = eoid;
//System.out.println("Dins la gui " + eoid + this.eoid);
this.con = con;
initComponents();
setHelper();
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Gui other = (Gui) obj;
if (this.eoid != other.eoid) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 17 * hash + this.eoid;
return hash;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jpCartes = new javax.swing.JPanel();
jbCarta1 = new javax.swing.JButton();
jbCarta2 = new javax.swing.JButton();
jbCarta3 = new javax.swing.JButton();
jbCarta4 = new javax.swing.JButton();
jbCarta5 = new javax.swing.JButton();
jbCarta6 = new javax.swing.JButton();
jbCarta7 = new javax.swing.JButton();
jbCarta8 = new javax.swing.JButton();
jbCarta9 = new javax.swing.JButton();
jbCarta10 = new javax.swing.JButton();
jbCarta11 = new javax.swing.JButton();
jbCarta12 = new javax.swing.JButton();
jpZonaDescart = new javax.swing.JPanel();
jlCartaJugador2Parella1 = new javax.swing.JLabel();
jlCartaJugador2Parella2 = new javax.swing.JLabel();
jlCartaJugador1Parella1 = new javax.swing.JLabel();
jlParella2NomJugador1 = new javax.swing.JLabel();
jlParella1NomJugador2 = new javax.swing.JLabel();
jlParella1NomJugador1 = new javax.swing.JLabel();
jlParella2NomJugador2 = new javax.swing.JLabel();
jlCartaJugador1Parella2 = new javax.swing.JLabel();
jpBotonsCantar = new javax.swing.JPanel();
jbCantarOros = new javax.swing.JButton();
jbCantarCopes = new javax.swing.JButton();
jbCantarEspases = new javax.swing.JButton();
jbCantarBastos = new javax.swing.JButton();
jbCantarButifarra = new javax.swing.JButton();
jpPuntuacions = new javax.swing.JPanel();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
jLabel20 = new javax.swing.JLabel();
jLabel21 = new javax.swing.JLabel();
jlParella1NomJugador1Punts = new javax.swing.JLabel();
jlParella1NomJugador2Punts = new javax.swing.JLabel();
jlParella1Punts = new javax.swing.JLabel();
jlParella2NomJugador1Punts = new javax.swing.JLabel();
jlParella2NomJugador2Punts = new javax.swing.JLabel();
jlParella2Punts = new javax.swing.JLabel();
jpBotonsContrar = new javax.swing.JPanel();
jbPassar = new javax.swing.JButton();
jbContrar = new javax.swing.JButton();
jbNovaBasa = new javax.swing.JButton();
jbIniciarPartida = new javax.swing.JButton();
jbRepartir = new javax.swing.JButton();
jmbMenus = new javax.swing.JMenuBar();
jmAplicacio = new javax.swing.JMenu();
jmiNovaPartida = new javax.swing.JMenuItem();
jmiSortir = new javax.swing.JMenuItem();
jmLaF = new javax.swing.JMenu();
jmiLaFMetal = new javax.swing.JMenuItem();
jmiLaFMotif = new javax.swing.JMenuItem();
jmiWindows = new javax.swing.JMenuItem();
jmiMac = new javax.swing.JMenuItem();
jmAjuda = new javax.swing.JMenu();
jmiAjuda = new javax.swing.JMenuItem();
jmiQuantA = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("ButiFree 2.0");
getContentPane().setLayout(null);
jpCartes.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), "Ma"));
jpCartes.setLayout(new java.awt.GridLayout(2, 6));
jbCarta1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta1ActionPerformed(evt);
}
});
jpCartes.add(jbCarta1);
jbCarta2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta2.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta2ActionPerformed(evt);
}
});
jpCartes.add(jbCarta2);
jbCarta3.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta3.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta3ActionPerformed(evt);
}
});
jpCartes.add(jbCarta3);
jbCarta4.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta4ActionPerformed(evt);
}
});
jpCartes.add(jbCarta4);
jbCarta5.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta5.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta5ActionPerformed(evt);
}
});
jpCartes.add(jbCarta5);
jbCarta6.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta6.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta6ActionPerformed(evt);
}
});
jpCartes.add(jbCarta6);
jbCarta7.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta7.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta7ActionPerformed(evt);
}
});
jpCartes.add(jbCarta7);
jbCarta8.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta8.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta8ActionPerformed(evt);
}
});
jpCartes.add(jbCarta8);
jbCarta9.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta9.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta9ActionPerformed(evt);
}
});
jpCartes.add(jbCarta9);
jbCarta10.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta10.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta10ActionPerformed(evt);
}
});
jpCartes.add(jbCarta10);
jbCarta11.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta11.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta11ActionPerformed(evt);
}
});
jpCartes.add(jbCarta11);
jbCarta12.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
jbCarta12.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jbCarta12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCarta12ActionPerformed(evt);
}
});
jpCartes.add(jbCarta12);
getContentPane().add(jpCartes);
jpCartes.setBounds(16, 468, 330, 260);
jpZonaDescart.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), "Taulell de joc"));
jpZonaDescart.setForeground(new java.awt.Color(236, 233, 233));
jpZonaDescart.setLayout(null);
jlCartaJugador2Parella1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/10B.jpg"))); // NOI18N
jpZonaDescart.add(jlCartaJugador2Parella1);
jlCartaJugador2Parella1.setBounds(110, 60, 90, 125);
jlCartaJugador2Parella2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jlCartaJugador2Parella2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/10B.jpg"))); // NOI18N
jpZonaDescart.add(jlCartaJugador2Parella2);
jlCartaJugador2Parella2.setBounds(20, 180, 90, 125);
jlCartaJugador1Parella1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/10B.jpg"))); // NOI18N
jpZonaDescart.add(jlCartaJugador1Parella1);
jlCartaJugador1Parella1.setBounds(110, 300, 90, 125);
jlParella2NomJugador1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jlParella2NomJugador1.setText("Jugador 1");
jlParella2NomJugador1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jpZonaDescart.add(jlParella2NomJugador1);
jlParella2NomJugador1.setBounds(210, 150, 90, 19);
jlParella1NomJugador2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jlParella1NomJugador2.setText("Jugador 2");
jlParella1NomJugador2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jpZonaDescart.add(jlParella1NomJugador2);
jlParella1NomJugador2.setBounds(110, 30, 90, 19);
jlParella1NomJugador1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jlParella1NomJugador1.setText("Jugador 0");
jlParella1NomJugador1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jpZonaDescart.add(jlParella1NomJugador1);
jlParella1NomJugador1.setBounds(120, 270, 80, 19);
jlParella2NomJugador2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jlParella2NomJugador2.setText("Jugador 3");
jlParella2NomJugador2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jpZonaDescart.add(jlParella2NomJugador2);
jlParella2NomJugador2.setBounds(20, 150, 80, 19);
jlCartaJugador1Parella2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/10B.jpg"))); // NOI18N
jpZonaDescart.add(jlCartaJugador1Parella2);
jlCartaJugador1Parella2.setBounds(200, 180, 90, 125);
getContentPane().add(jpZonaDescart);
jpZonaDescart.setBounds(20, 10, 330, 450);
jpBotonsCantar.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), "Cantar"));
jpBotonsCantar.setLayout(new java.awt.GridLayout(5, 1, 0, 4));
jbCantarOros.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/orosP_1.jpg"))); // NOI18N
jbCantarOros.setEnabled(false);
jbCantarOros.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
jbCantarOros.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCantarOrosActionPerformed(evt);
}
});
jpBotonsCantar.add(jbCantarOros);
jbCantarCopes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/copasP_1.jpg"))); // NOI18N
jbCantarCopes.setEnabled(false);
jbCantarCopes.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
jbCantarCopes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCantarCopesActionPerformed(evt);
}
});
jpBotonsCantar.add(jbCantarCopes);
jbCantarEspases.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/espadasP_1.jpg"))); // NOI18N
jbCantarEspases.setEnabled(false);
jbCantarEspases.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
jbCantarEspases.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCantarEspasesActionPerformed(evt);
}
});
jpBotonsCantar.add(jbCantarEspases);
jbCantarBastos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/bastosP_1.jpg"))); // NOI18N
jbCantarBastos.setEnabled(false);
jbCantarBastos.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
jbCantarBastos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCantarBastosActionPerformed(evt);
}
});
jpBotonsCantar.add(jbCantarBastos);
jbCantarButifarra.setIcon(new javax.swing.ImageIcon(getClass().getResource("/serveis/imatges/butifarra.jpg"))); // NOI18N
jbCantarButifarra.setEnabled(false);
jbCantarButifarra.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
jbCantarButifarra.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCantarButifarraActionPerformed(evt);
}
});
jpBotonsCantar.add(jbCantarButifarra);
getContentPane().add(jpBotonsCantar);
jpBotonsCantar.setBounds(360, 470, 90, 260);
jpPuntuacions.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), "Puntuacions"));
jLabel14.setForeground(java.awt.Color.blue);
jLabel14.setText("Parella 1");
jLabel15.setText("Nom");
jLabel16.setText("Nom");
jLabel17.setText("Punts");
jLabel18.setForeground(java.awt.Color.blue);
jLabel18.setText("Parella 2");
jLabel19.setText("Nom");
jLabel20.setText("Nom");
jLabel21.setText("Punts");
jlParella1NomJugador1Punts.setText("Julio");
jlParella1NomJugador1Punts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jlParella1NomJugador2Punts.setText("Quim");
jlParella1NomJugador2Punts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jlParella1Punts.setText("34");
jlParella1Punts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jlParella2NomJugador1Punts.setText("Anna");
jlParella2NomJugador1Punts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jlParella2NomJugador2Punts.setText("Mònica");
jlParella2NomJugador2Punts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jlParella2Punts.setText("56");
jlParella2Punts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
javax.swing.GroupLayout jpPuntuacionsLayout = new javax.swing.GroupLayout(jpPuntuacions);
jpPuntuacions.setLayout(jpPuntuacionsLayout);
jpPuntuacionsLayout.setHorizontalGroup(
jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jpPuntuacionsLayout.createSequentialGroup()
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jpPuntuacionsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel19, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
.addComponent(jLabel20)
.addComponent(jLabel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel15, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE)
.addComponent(jLabel17, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jlParella2NomJugador2Punts, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jlParella2NomJugador1Punts, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jlParella1Punts, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jlParella2Punts, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jlParella1NomJugador2Punts, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jlParella1NomJugador1Punts, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
.addComponent(jLabel18)))
.addGroup(jpPuntuacionsLayout.createSequentialGroup()
.addGap(59, 59, 59)
.addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(37, Short.MAX_VALUE))
);
jpPuntuacionsLayout.setVerticalGroup(
jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jpPuntuacionsLayout.createSequentialGroup()
.addGap(26, 26, 26)
.addComponent(jLabel14)
.addGap(18, 18, 18)
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel15)
.addComponent(jlParella1NomJugador1Punts))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel16)
.addComponent(jlParella1NomJugador2Punts))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel17)
.addComponent(jlParella1Punts))
.addGap(37, 37, 37)
.addComponent(jLabel18)
.addGap(26, 26, 26)
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel19)
.addComponent(jlParella2NomJugador1Punts))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel20)
.addComponent(jlParella2NomJugador2Punts))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jpPuntuacionsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel21)
.addComponent(jlParella2Punts))
.addContainerGap(118, Short.MAX_VALUE))
);
getContentPane().add(jpPuntuacions);
jpPuntuacions.setBounds(360, 10, 210, 450);
jpBotonsContrar.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), "Accions"));
jpBotonsContrar.setLayout(new java.awt.GridLayout(5, 1));
jbPassar.setText("Passo");
jbPassar.setEnabled(false);
jbPassar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbPassarActionPerformed(evt);
}
});
jpBotonsContrar.add(jbPassar);
jbContrar.setText("Contrar");
jbContrar.setEnabled(false);
jbContrar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbContrarActionPerformed(evt);
}
});
jpBotonsContrar.add(jbContrar);
jbNovaBasa.setText("Nova Basa");
jbNovaBasa.setEnabled(false);
jbNovaBasa.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbNovaBasaActionPerformed(evt);
}
});
jpBotonsContrar.add(jbNovaBasa);
jbIniciarPartida.setText("Iniciar P");
jbIniciarPartida.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbIniciarPartidaActionPerformed(evt);
}
});
jpBotonsContrar.add(jbIniciarPartida);
jbRepartir.setText("Repartir");
jbRepartir.setEnabled(false);
jbRepartir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbRepartirActionPerformed(evt);
}
});
jpBotonsContrar.add(jbRepartir);
getContentPane().add(jpBotonsContrar);
jpBotonsContrar.setBounds(470, 470, 110, 210);
jmAplicacio.setText("Aplicació");
jmiNovaPartida.setText("Nova partida");
jmiNovaPartida.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiNovaPartidaActionPerformed(evt);
}
});
jmAplicacio.add(jmiNovaPartida);
jmiSortir.setText("Sortir");
jmiSortir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiSortirActionPerformed(evt);
}
});
jmAplicacio.add(jmiSortir);
jmbMenus.add(jmAplicacio);
jmLaF.setText("Look&Feel");
jmiLaFMetal.setText("Metal");
jmiLaFMetal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiLaFMetalActionPerformed(evt);
}
});
jmLaF.add(jmiLaFMetal);
jmiLaFMotif.setText("Motif");
jmiLaFMotif.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiLaFMotifActionPerformed(evt);
}
});
jmLaF.add(jmiLaFMotif);
jmiWindows.setText("Windows");
jmiWindows.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiWindowsActionPerformed(evt);
}
});
jmLaF.add(jmiWindows);
jmiMac.setText("Mac");
jmiMac.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiMacActionPerformed(evt);
}
});
jmLaF.add(jmiMac);
jmbMenus.add(jmLaF);
jmAjuda.setText("Ajuda");
jmiAjuda.setText("Ajuda de ButiFree");
jmAjuda.add(jmiAjuda);
jmiQuantA.setText("Quant a ButiFree");
jmiQuantA.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jmiQuantAActionPerformed(evt);
}
});
jmAjuda.add(jmiQuantA);
jmbMenus.add(jmAjuda);
setJMenuBar(jmbMenus);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-592)/2, (screenSize.height-792)/2, 592, 792);
}// </editor-fold>//GEN-END:initComponents
private void jbPassarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbPassarActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoPassar(this, evt);
}//GEN-LAST:event_jbPassarActionPerformed
private void jmiLaFMotifActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiLaFMotifActionPerformed
// TODO add your handling code here:
try {
String plaf = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
UIManager.setLookAndFeel(plaf);
SwingUtilities.updateComponentTreeUI(this);
} catch (final Exception exception) {
final String missatge = "No s'ha pogut carregar el Look&Feel desitjat.";
final String titol = "S'ha produit una excepcio";
JOptionPane.showMessageDialog(this, missatge, titol, JOptionPane.ERROR_MESSAGE);
} finally {
this.setVisible(true);
}
}//GEN-LAST:event_jmiLaFMotifActionPerformed
private void jbIniciarPartidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbIniciarPartidaActionPerformed
// TODO add your handling code here:
con.gestionarAccioIniciarPartida(this, evt);
}//GEN-LAST:event_jbIniciarPartidaActionPerformed
private void jmiQuantAActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiQuantAActionPerformed
// TODO add your handling code here:
showDialogQuantA();
}//GEN-LAST:event_jmiQuantAActionPerformed
private void jmiLaFMetalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiLaFMetalActionPerformed
// TODO add your handling code here:
try {
String plaf = "javax.swing.plaf.metal.MetalLookAndFeel";
UIManager.setLookAndFeel(plaf);
SwingUtilities.updateComponentTreeUI(this);
} catch (final Exception exception) {
final String missatge = "No s'ha pogut carregar el Look&Feel desitjat.";
final String titol = "S'ha produit una excepcio";
JOptionPane.showMessageDialog(this, missatge, titol, JOptionPane.ERROR_MESSAGE);
} finally {
this.setVisible(true);
}
}//GEN-LAST:event_jmiLaFMetalActionPerformed
private void jmiSortirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiSortirActionPerformed
// TODO add your handling code here:
this.dispose();
}//GEN-LAST:event_jmiSortirActionPerformed
private void jbCarta1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta1ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta1(this, evt);
}//GEN-LAST:event_jbCarta1ActionPerformed
private void jbCarta2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta2ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta2(this, evt);
}//GEN-LAST:event_jbCarta2ActionPerformed
private void jbCarta3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta3ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta3(this, evt);
}//GEN-LAST:event_jbCarta3ActionPerformed
private void jbCarta4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta4ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta4(this, evt);
}//GEN-LAST:event_jbCarta4ActionPerformed
private void jbCarta5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta5ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta5(this, evt);
}//GEN-LAST:event_jbCarta5ActionPerformed
private void jbCarta6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta6ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta6(this, evt);
}//GEN-LAST:event_jbCarta6ActionPerformed
private void jbCarta7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta7ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta7(this, evt);
}//GEN-LAST:event_jbCarta7ActionPerformed
private void jbCarta8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta8ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta8(this, evt);
}//GEN-LAST:event_jbCarta8ActionPerformed
private void jbCarta9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta9ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta9(this, evt);
}//GEN-LAST:event_jbCarta9ActionPerformed
private void jbCarta10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta10ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta10(this, evt);
}//GEN-LAST:event_jbCarta10ActionPerformed
private void jbCarta11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta11ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta11(this, evt);
}//GEN-LAST:event_jbCarta11ActionPerformed
private void jbCarta12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCarta12ActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCarta12(this, evt);
}//GEN-LAST:event_jbCarta12ActionPerformed
private void jmiWindowsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiWindowsActionPerformed
// TODO add your handling code here:
try {
String plaf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
UIManager.setLookAndFeel(plaf);
SwingUtilities.updateComponentTreeUI(this);
} catch (final Exception exception) {
final String missatge = "No s'ha pogut carregar el Look&Feel desitjat.";
final String titol = "S'ha produit una excepcio";
JOptionPane.showMessageDialog(this, missatge, titol, JOptionPane.ERROR_MESSAGE);
} finally {
this.setVisible(true);
}
}//GEN-LAST:event_jmiWindowsActionPerformed
private void jmiMacActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiMacActionPerformed
// TODO add your handling code here:
try {
String plaf = "javax.swing.plaf.mac.MacLookAndFeel";
UIManager.setLookAndFeel(plaf);
SwingUtilities.updateComponentTreeUI(this);
} catch (final Exception exception) {
final String missatge = "No s'ha pogut carregar el Look&Feel desitjat.";
final String titol = "S'ha produit una excepcio";
JOptionPane.showMessageDialog(this, missatge, titol, JOptionPane.ERROR_MESSAGE);
} finally {
this.setVisible(true);
}
}//GEN-LAST:event_jmiMacActionPerformed
private void jbCantarOrosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCantarOrosActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCantarOros(this, evt);
}//GEN-LAST:event_jbCantarOrosActionPerformed
private void jbCantarCopesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCantarCopesActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCantarCopes(this, evt);
}//GEN-LAST:event_jbCantarCopesActionPerformed
private void jbCantarEspasesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCantarEspasesActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCantarEspases(this, evt);
}//GEN-LAST:event_jbCantarEspasesActionPerformed
private void jbCantarBastosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCantarBastosActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCantarBastos(this, evt);
}//GEN-LAST:event_jbCantarBastosActionPerformed
private void jbCantarButifarraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbCantarButifarraActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoCantarButifarra(this, evt);
}//GEN-LAST:event_jbCantarButifarraActionPerformed
private void jbContrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbContrarActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoContrar(this, evt);
}//GEN-LAST:event_jbContrarActionPerformed
private void jbNovaBasaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbNovaBasaActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoNovaBasa(this, evt);
}//GEN-LAST:event_jbNovaBasaActionPerformed
private void jmiNovaPartidaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiNovaPartidaActionPerformed
// TODO add your handling code here:
con.gestionarAccioMenuItemNovaPartiva(this, evt);
}//GEN-LAST:event_jmiNovaPartidaActionPerformed
private void jbRepartirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbRepartirActionPerformed
// TODO add your handling code here:
con.gestionarAccioBotoRepartir(this, evt);
}//GEN-LAST:event_jbRepartirActionPerformed
/** Metode que gestiona el JavaHelper de l'aplicacio.*/
private void setHelper() {
try {
// Obtenim el recurs HelpEmpresa.hs
final String pathFileHs = "/serveis/help/ButiHelp.hs";
URL hsURL = Gui.class.getResource(pathFileHs);
// Creem un objecte HelpSet referenciat
HelpSet helpSet = new HelpSet(null, hsURL);
// Creem un objecte HelpBroker referenciat a paretir del HelpSet
HelpBroker helpBroker = helpSet.createHelpBroker();
//En el fitxer Map.jhm emprar el mapID target="Ajuda.Intro"
final String stringID = "Ajuda.NormesBut";
// Fem que l'objecte jmiAjuda dispari l'ajuda
helpBroker.enableHelpOnButton(jmiAjuda, stringID, helpSet);
// Per obrir l'ajuda amb la tecla de funcio F1
JRootPane jRootPane = this.getRootPane();
helpBroker.enableHelpKey(jRootPane, stringID, helpSet);
} catch (Exception ee) {
JOptionPane.showMessageDialog(this, "Fitxer HelpSet no trobat: " + ee.toString());
}
}
private void showDialogQuantA() {
String credits;
credits = "Joc de la burifarra. Versio 1.0\n";
credits += "Fet per:\nAnna Cots\nJulio Amorós\nJoaquim Laplana (UI)\n";
JOptionPane.showMessageDialog(null, credits, "Quant a ButiFree",
JOptionPane.INFORMATION_MESSAGE);
}
public JButton getJbCantarBastos() {
return jbCantarBastos;
}
public JButton getJbCantarButifarra() {
return jbCantarButifarra;
}
public JButton getJbCantarCopes() {
return jbCantarCopes;
}
public JButton getJbCantarEspases() {
return jbCantarEspases;
}
public JButton getJbCantarOros() {
return jbCantarOros;
}
public JButton getJbCarta1() {
return jbCarta1;
}
public JButton getJbCarta10() {
return jbCarta10;
}
public JButton getJbCarta11() {
return jbCarta11;
}
public JButton getJbCarta12() {
return jbCarta12;
}
public JButton getJbCarta2() {
return jbCarta2;
}
public JButton getJbCarta3() {
return jbCarta3;
}
public JButton getJbCarta4() {
return jbCarta4;
}
public JButton getJbCarta5() {
return jbCarta5;
}
public JButton getJbCarta6() {
return jbCarta6;
}
public JButton getJbCarta7() {
return jbCarta7;
}
public JButton getJbCarta8() {
return jbCarta8;
}
public JButton getJbCarta9() {
return jbCarta9;
}
public JButton getJbContrar() {
return jbContrar;
}
public JButton getJbPassar() {
return jbPassar;
}
public JButton getJbNovaBasa() {
return jbNovaBasa;
}
public JButton getJbSIniciarPartida() {
return jbIniciarPartida;
}
public JLabel getJlCartaJugador1Parella1() {
return jlCartaJugador1Parella1;
}
public JLabel getJlCartaJugador1Parella2() {
return jlCartaJugador1Parella2;
}
public JLabel getJlCartaJugador2Parella1() {
return jlCartaJugador2Parella1;
}
public JLabel getJlCartaJugador2Parella2() {
return jlCartaJugador2Parella2;
}
public JLabel getJlParella1NomJugador1() {
return jlParella1NomJugador1;
}
public JLabel getJlParella1NomJugador2() {
return jlParella1NomJugador2;
}
public JLabel getJlParella2NomJugador1() {
return jlParella2NomJugador1;
}
public JLabel getJlParella2NomJugador2() {
return jlParella2NomJugador2;
}
public JPanel getJpBotonsCantar() {
return jpBotonsCantar;
}
public JPanel getJpBotonsContrar() {
return jpBotonsContrar;
}
public JButton getJbRepartir() {
return jbRepartir;
}
public JLabel getJlParella1NomJugador1Punts() {
return jlParella1NomJugador1Punts;
}
public JLabel getJlParella1NomJugador2Punts() {
return jlParella1NomJugador2Punts;
}
public JLabel getJlParella1Punts() {
return jlParella1Punts;
}
public JLabel getJlParella2NomJugador1Punts() {
return jlParella2NomJugador1Punts;
}
public JLabel getJlParella2NomJugador2Punts() {
return jlParella2NomJugador2Punts;
}
public JLabel getJlParella2Punts() {
return jlParella2Punts;
}
public int getEoid(){
return eoid;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JButton jbCantarBastos;
private javax.swing.JButton jbCantarButifarra;
private javax.swing.JButton jbCantarCopes;
private javax.swing.JButton jbCantarEspases;
private javax.swing.JButton jbCantarOros;
private javax.swing.JButton jbCarta1;
private javax.swing.JButton jbCarta10;
private javax.swing.JButton jbCarta11;
private javax.swing.JButton jbCarta12;
private javax.swing.JButton jbCarta2;
private javax.swing.JButton jbCarta3;
private javax.swing.JButton jbCarta4;
private javax.swing.JButton jbCarta5;
private javax.swing.JButton jbCarta6;
private javax.swing.JButton jbCarta7;
private javax.swing.JButton jbCarta8;
private javax.swing.JButton jbCarta9;
private javax.swing.JButton jbContrar;
private javax.swing.JButton jbIniciarPartida;
private javax.swing.JButton jbNovaBasa;
private javax.swing.JButton jbPassar;
private javax.swing.JButton jbRepartir;
private javax.swing.JLabel jlCartaJugador1Parella1;
private javax.swing.JLabel jlCartaJugador1Parella2;
private javax.swing.JLabel jlCartaJugador2Parella1;
private javax.swing.JLabel jlCartaJugador2Parella2;
private javax.swing.JLabel jlParella1NomJugador1;
private javax.swing.JLabel jlParella1NomJugador1Punts;
private javax.swing.JLabel jlParella1NomJugador2;
private javax.swing.JLabel jlParella1NomJugador2Punts;
private javax.swing.JLabel jlParella1Punts;
private javax.swing.JLabel jlParella2NomJugador1;
private javax.swing.JLabel jlParella2NomJugador1Punts;
private javax.swing.JLabel jlParella2NomJugador2;
private javax.swing.JLabel jlParella2NomJugador2Punts;
private javax.swing.JLabel jlParella2Punts;
private javax.swing.JMenu jmAjuda;
private javax.swing.JMenu jmAplicacio;
private javax.swing.JMenu jmLaF;
private javax.swing.JMenuBar jmbMenus;
private javax.swing.JMenuItem jmiAjuda;
private javax.swing.JMenuItem jmiLaFMetal;
private javax.swing.JMenuItem jmiLaFMotif;
private javax.swing.JMenuItem jmiMac;
private javax.swing.JMenuItem jmiNovaPartida;
private javax.swing.JMenuItem jmiQuantA;
private javax.swing.JMenuItem jmiSortir;
private javax.swing.JMenuItem jmiWindows;
private javax.swing.JPanel jpBotonsCantar;
private javax.swing.JPanel jpBotonsContrar;
private javax.swing.JPanel jpCartes;
private javax.swing.JPanel jpPuntuacions;
private javax.swing.JPanel jpZonaDescart;
// End of variables declaration//GEN-END:variables
}