cambios que no se habian hecho en el refactor porque eran referencias textuales
[luxor.git] / casinoNetbeans / src / org / casino / gui / comun / PanelResumenJuego.java
blobe1fcb3cff4a5f81de6f4614287bb791bcc067e5b
1 /*
2 * PanelResumenJuego.java
4 * Created on May 6, 2008, 5:17 AM
5 */
7 package org.casino.gui.comun;
9 import java.awt.Image;
10 import java.awt.event.ComponentAdapter;
11 import java.awt.event.ComponentEvent;
12 import javax.swing.ImageIcon;
14 /**
16 * @author ubuntu
18 public class PanelResumenJuego extends javax.swing.JPanel {
19 private boolean editable;
21 public boolean isEditable() {
22 return editable;
25 public void setEditable(boolean editable) {
26 this.editable = editable;
27 nombreJuego.setEditable(editable);
28 descripcionJuego.setEditable(editable);
29 //TODO Editar imagen...
30 juegoFavorito.setVisible(!editable);
31 botonJugar.setVisible(!editable);
32 botonBorrar.setVisible(editable);
33 categoriaEditable.setVisible(editable);
34 categoriaNoEditable.setVisible(!editable);
37 /** Creates new form PanelResumenJuego */
38 public PanelResumenJuego() {
39 initComponents();
40 setEditable(false);
41 addComponentListener(new ComponentAdapter() {
43 @Override
44 public void componentResized(ComponentEvent e) {
45 actualizarImagen();
48 });
50 private void actualizarImagen()
52 ImageIcon icon = new ImageIcon(getClass().getResource("/org/casino/resources/default_game_logo.jpg"));
53 Image img = icon.getImage();
54 icon.setImage(img.getScaledInstance(imagenJuego.getWidth(), imagenJuego.getHeight(),Image.SCALE_SMOOTH));
55 imagenJuego.setIcon(icon);
57 /** This method is called from within the constructor to
58 * initialize the form.
59 * WARNING: Do NOT modify this code. The content of this method is
60 * always regenerated by the Form Editor.
62 @SuppressWarnings("unchecked")
63 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
64 private void initComponents() {
66 imagenJuego = new javax.swing.JLabel();
67 nombreJuego = new javax.swing.JTextField();
68 jScrollPane1 = new javax.swing.JScrollPane();
69 descripcionJuego = new javax.swing.JTextArea();
70 juegoFavorito = new javax.swing.JCheckBox();
71 botonJugar = new javax.swing.JButton();
72 categoriaEditable = new javax.swing.JComboBox();
73 categoriaNoEditable = new javax.swing.JLabel();
74 jLabel2 = new javax.swing.JLabel();
75 botonBorrar = new javax.swing.JButton();
77 setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
79 imagenJuego.setBackground(new java.awt.Color(153, 153, 255));
80 imagenJuego.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/casino/resources/default_game_logo.jpg"))); // NOI18N
81 imagenJuego.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
82 imagenJuego.setMinimumSize(new java.awt.Dimension(150, 150));
83 imagenJuego.setPreferredSize(new java.awt.Dimension(150, 150));
85 nombreJuego.setEditable(false);
86 nombreJuego.setToolTipText("Nombre del juego");
87 nombreJuego.addActionListener(new java.awt.event.ActionListener() {
88 public void actionPerformed(java.awt.event.ActionEvent evt) {
89 nombreJuegoActionPerformed(evt);
91 });
93 descripcionJuego.setColumns(20);
94 descripcionJuego.setEditable(false);
95 descripcionJuego.setRows(5);
96 descripcionJuego.setToolTipText("DescripciĆ³n del juego");
97 jScrollPane1.setViewportView(descripcionJuego);
99 juegoFavorito.setText("Favorito");
100 juegoFavorito.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
102 botonJugar.setText("Jugar");
103 botonJugar.addActionListener(new java.awt.event.ActionListener() {
104 public void actionPerformed(java.awt.event.ActionEvent evt) {
105 botonJugarActionPerformed(evt);
109 categoriaEditable.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
111 categoriaNoEditable.setBackground(new java.awt.Color(204, 204, 204));
112 categoriaNoEditable.setText("jLabel1");
114 jLabel2.setText("Categoria:");
116 botonBorrar.setText("Borrar juego");
117 botonBorrar.addActionListener(new java.awt.event.ActionListener() {
118 public void actionPerformed(java.awt.event.ActionEvent evt) {
119 botonBorrarActionPerformed(evt);
123 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
124 this.setLayout(layout);
125 layout.setHorizontalGroup(
126 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
127 .addGroup(layout.createSequentialGroup()
128 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
129 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
130 .addComponent(nombreJuego, javax.swing.GroupLayout.DEFAULT_SIZE, 272, Short.MAX_VALUE)
131 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
132 .addComponent(juegoFavorito))
133 .addGroup(layout.createSequentialGroup()
134 .addContainerGap()
135 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
136 .addComponent(botonBorrar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
137 .addComponent(imagenJuego, javax.swing.GroupLayout.PREFERRED_SIZE, 120, Short.MAX_VALUE)
138 .addComponent(botonJugar, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE))
139 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
140 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
141 .addGroup(layout.createSequentialGroup()
142 .addComponent(jLabel2)
143 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
144 .addComponent(categoriaNoEditable, javax.swing.GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE)
145 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
146 .addComponent(categoriaEditable, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
147 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
148 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 229, Short.MAX_VALUE))))
149 .addGap(0, 0, 0))
151 layout.setVerticalGroup(
152 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
153 .addGroup(layout.createSequentialGroup()
154 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
155 .addComponent(juegoFavorito, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
156 .addComponent(nombreJuego, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
157 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
158 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
159 .addComponent(imagenJuego, 0, 0, Short.MAX_VALUE)
160 .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE))
161 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
162 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
163 .addGroup(layout.createSequentialGroup()
164 .addComponent(botonJugar, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
165 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
166 .addComponent(botonBorrar, javax.swing.GroupLayout.PREFERRED_SIZE, 9, Short.MAX_VALUE)
167 .addGap(3, 3, 3))
168 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
169 .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
170 .addComponent(categoriaNoEditable, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
171 .addComponent(categoriaEditable, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
172 .addGap(0, 0, 0))
174 }// </editor-fold>//GEN-END:initComponents
176 private void botonJugarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonJugarActionPerformed
177 // TODO add your handling code here:
178 }//GEN-LAST:event_botonJugarActionPerformed
180 private void nombreJuegoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nombreJuegoActionPerformed
181 // TODO add your handling code here:
182 }//GEN-LAST:event_nombreJuegoActionPerformed
184 private void botonBorrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarActionPerformed
185 // TODO add your handling code here:
186 }//GEN-LAST:event_botonBorrarActionPerformed
189 // Variables declaration - do not modify//GEN-BEGIN:variables
190 private javax.swing.JButton botonBorrar;
191 private javax.swing.JButton botonJugar;
192 private javax.swing.JComboBox categoriaEditable;
193 private javax.swing.JLabel categoriaNoEditable;
194 private javax.swing.JTextArea descripcionJuego;
195 private javax.swing.JLabel imagenJuego;
196 private javax.swing.JLabel jLabel2;
197 private javax.swing.JScrollPane jScrollPane1;
198 private javax.swing.JCheckBox juegoFavorito;
199 private javax.swing.JTextField nombreJuego;
200 // End of variables declaration//GEN-END:variables