I see many errors in my program, these are doing a novel in Java, I am learning on my own to use the JFrame and the Jbutton

0

This is my code

//Aqui se encuentran los imports de los comandos de texto y del audio ademas del Jframe para la aplicacion//

import java.io.File; import java.util.Scanner; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; public class Main extends JFrame { private static JLabel texto,texto1,texto2,texto3,texto4,texto5,texto6,texto7,texto8,texto9,texto10; private static JLabel texto11,texto12,texto13,texto14,texto15,texto16,texto17,texto18,texto19,texto20; private static JLabel texto21,texto22,texto23,texto24,texto25,texto26,texto27,texto28,texto29,texto30; private static JLabel texto31,texto32,texto33,texto34,texto35,texto36,texto37,texto38,texto39,texto40; private static JLabel texto41,texto42,texto43,texto44,texto45,texto46,texto47,texto48,texto49,texto50; private static JTextField caja; private static JButton boton,boton1,boton2,boton3,boton4,boton5,boton6,boton7,boton8,boton9,boton10; private static JButton boton11,boton12,boton13,boton14,boton15,boton16,boton17,boton18,boton19,boton20; public static void main(String[] args) { //Aqui se encuentran las variables de las decisiones//

    'Scanner teclado=new Scanner(System.in);
    int desi;
    int de;
    int ewe;
    int m;
    int as;
    int fg;
    int dif;
    texto = new JLabel();
    texto1 = new JLabel();
    texto2 = new JLabel();
    texto3 = new JLabel();
    texto4 = new JLabel();
    texto5 = new JLabel();
    texto6 = new JLabel();
    texto7 = new JLabel();
    texto8 = new JLabel();
    texto9 = new JLabel();
    texto10 = new JLabel();
    caja = new JTextField();
    boton = new JButton();
    boton1 = new JButton();
    boton2 = new JButton();

//Aqui se encuentran los datos de la ventana de audio del programa// final JFrame uw = new JFrame("Enserio me crees?"); uw.setLocationRelativeTo(null); uw.setVisible(true); uw.setLayout(null); uw.setSize(1000, 1000); extracted(uw); try {

                // Se obtiene un Clip de sonido
                Clip sonido = AudioSystem.getClip();

                // Se carga con un fichero wav
                sonido.open(AudioSystem.getAudioInputStream(new File("UwU.wav")));

                // Comienza la reproducción
                sonido.start();

                // Espera mientras se esté reproduciendo.
                while (sonido.isRunning())
                    Thread.sleep(1000);

                // Se cierra el clip.
                sonido.loop(Clip.LOOP_CONTINUOUSLY);
            } catch (Exception e) {
                System.out.println("" + e);
            }

// Aqui ya empieza el programa de texto a ejecutarse con cada una de sus decisiones y finales // texto.setText("Bienvenido,quien eres?"); texto.setBounds(20, 20, 300, 25);
caja.setBounds(150, 50, 100, 25); boton.setText("Iniciar"); boton.setBounds(50, 50, 90, 30); uw.add(texto); uw.add(caja); uw.add(boton); uw.setLayout(null);

    caja.addActionListener (new ActionListener(){
    public void actionPerformed(ActionEvent f) {
    final String nombre = caja.getText();
    texto1.setText( "Wow increible  " + nombre + ".");
    texto1.setBounds(20,100,300,25);
    uw.add(texto1);
    }});
    boton.addActionListener (new ActionListener(){
    public void actionPerformed(ActionEvent e){
    texto2.setText("--Tutorial--");
    texto2.setBounds(20,120,300,25);
    uw.add(texto2);
    texto3.setText("Tienes que escoger el numero al lado de la respuesta,entiendes?");
    texto3.setBounds(20,150,500,25);
    uw.add(texto3);
    boton1.setText("Si");
    boton1.setBounds(20,200,90,30);
    uw.add(boton1);
    boton2.setText("No");
    boton2.setBounds(20,250,90,30);
    uw.add(boton2);}});
    boton1.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent f){
        texto4.setText("Bien,sigamos");
        texto4.setBounds(20,280,500,25);
        uw.add(texto4);
        texto5.setText("Este minijuego tiene 3 finales,Bueno-Neutral-Malo");
        texto5.setBounds(20,300,500,25);
        uw.add(texto5);
    }});

    boton2.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent q){
           texto6.setText("Buena esa,joven");
            texto6.setBounds(20,280,500,25);
            uw.add(texto6);
           texto7.setText("Eres uno de esos tipos molestos entonces");
            texto7.setBounds(20,300,500,25);
            uw.add(texto7);
           texto8.setText("Este minijuego tiene 3 finales,Bueno-Neutral-Malo");
            texto8.setBounds(20,320,500,25);
            uw.add(texto8);
            texto10.setText("Despiertas en medio de un bosque lleno de neblina,parece que apenas esta amaneciendo...o no?");
            texto10.setBounds(20,340,700,25);
            uw.add(texto10);
            boton3.setText("Que rayos?");
            boton3.setBounds(20,360,300,25);
            uw.add(boton3);
            boton4.setText("Silencio");
            boton4.setBounds(20,380,300,25);
            uw.add(boton4);
            uw.setLayout(null);

            boton3.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent q){ 
                final String nombre = caja.getText();
                texto11.setText(nombre+": Que rayos es este lugar?...o como..llegue aqui");
                texto12.setText("Miras a tu alrededor y notas que al lado de ti hay un reloj de bolsillo");
                texto13.setText("1-Tomarlo");
                boton6.setText("2-Dejarlo ahi");
                boton5.setText("3-Mirarlo bien");
            }})

           ;}});



};      
;


    private static void extracted(JFrame uw) {
        uw.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);



    }

}

I would like to know what I am doing wrong ... it is not finished

    
asked by Sofia 25.11.2018 в 07:56
source

0 answers