/* * JFrame.java * * Created on 9 de noviembre de 2001, 08:10 PM * * @author ALvArO ArEnAs */ import javax.swing.*; import java.awt.event.*; import java.awt.*; public class TaeKwonDo extends JFrame { /** Creates new form JFrame */ public TaeKwonDo() { initComponents(); ConfigPanel = new ConfigTaeKwonDo(this); CombatePanel = new CombateTaeKwonDo(this); } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents PanelBotones = new JPanel(); BNCombate = new JButton(); BConfig = new JButton(); BSalir = new JButton(); Titulo = new JLabel(); getContentPane().setLayout(null); setFont(new Font("Papyrus", 0, 12)); addWindowListener(new WindowAdapter() { public void windowClosing( WindowEvent evt) { exitForm(evt); } }); PanelBotones.setLayout(null); PanelBotones.setBorder(new javax.swing.border.MatteBorder(new Insets(1, 1, 1, 1), new Color(204, 153, 0))); BNCombate.setForeground(new Color(0, 0, 102)); BNCombate.setFont(new Font("Papyrus", 0, 14)); BNCombate.setText("Nuevo Combate"); BNCombate.addMouseListener(new MouseAdapter() { public void mouseClicked( MouseEvent evt) { BNCombateMouseClicked(evt); } }); PanelBotones.add(BNCombate); BNCombate.setBounds(10, 20, 140, 33); BConfig.setForeground(new Color(0, 0, 102)); BConfig.setFont(new Font("Papyrus", 0, 14)); BConfig.setText("Configuraci\u00f3n"); BConfig.addMouseListener(new MouseAdapter() { public void mouseClicked( MouseEvent evt) { BConfigMouseClicked(evt); } }); PanelBotones.add(BConfig); BConfig.setBounds(160, 20, 140, 33); BSalir.setForeground(new Color(0, 0, 102)); BSalir.setFont(new Font("Papyrus", 0, 14)); BSalir.setText("Salir"); BSalir.addActionListener(new ActionListener() { public void actionPerformed( ActionEvent evt) { BSalirActionPerformed(evt); } }); PanelBotones.add(BSalir); BSalir.setBounds(310, 20, 140, 33); getContentPane().add(PanelBotones); PanelBotones.setBounds(20, 90, 460, 70); Titulo.setText(" Elija una Opci\u00f3n"); Titulo.setFont(new Font("Papyrus", 0, 22)); Titulo.setBorder(new javax.swing.border.MatteBorder(new Insets(1, 1, 1, 1), new Color(204, 153, 0))); Titulo.setHorizontalTextPosition( SwingConstants.CENTER); getContentPane().add(Titulo); Titulo.setBounds(140, 20, 220, 50); pack(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setSize(new Dimension(510, 210)); setLocation((screenSize.width-510)/2,(screenSize.height-210)/2); setResizable(false); }//GEN-END:initComponents private void BNCombateMouseClicked( MouseEvent evt) {//GEN-FIRST:event_BNCombateMouseClicked hide(); CombatePanel.IniCombate(segRound, segFuera, segDescanso, nRound); }//GEN-LAST:event_BNCombateMouseClicked private void BConfigMouseClicked( MouseEvent evt) {//GEN-FIRST:event_BConfigMouseClicked hide(); ConfigPanel.show(); }//GEN-LAST:event_BConfigMouseClicked private void BSalirActionPerformed( ActionEvent evt) {//GEN-FIRST:event_BSalirActionPerformed System.exit(0); }//GEN-LAST:event_BSalirActionPerformed /** Exit the Application */ private void exitForm( WindowEvent evt) {//GEN-FIRST:event_exitForm System.exit(0); }//GEN-LAST:event_exitForm /** Seteo los valores de la Configuración*/ public void SetDatos(int tiempoR, int tiempoF, int tiempoD, int cantidadR) { segRound = tiempoR; segFuera = tiempoF; segDescanso = tiempoD; nRound = cantidadR; show(); } public static void main(String args[]) { TaeKwonDo Principal = new TaeKwonDo(); Principal.setVisible(true); } // Variables declaration - do not modify//GEN-BEGIN:variables private JPanel PanelBotones; private JButton BNCombate; private JButton BConfig; private JButton BSalir; private JLabel Titulo; // End of variables declaration//GEN-END:variables private ConfigTaeKwonDo ConfigPanel; private CombateTaeKwonDo CombatePanel; private int segRound, segFuera, segDescanso, nRound; }