Package yakimusic

Source Code of yakimusic.YakiMusicView_backup

/*
* YakiMusicView.java
*/

package yakimusic;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import yakimusic.analyzer.*;

import abc.parser.*;
import abc.notation.*;
import abc.ui.swing.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.HeadlessException;

import org.jfugue.*;
import java.util.Calendar;
import java.io.*;
import java.util.GregorianCalendar;

import java_cup.runtime.Symbol;

import javax.swing.*;

import yakimusic.analyzer.*;

/**
* The application's main frame.
*/
public class YakiMusicView_backup extends FrameView {

  private final String editorTabName = "Editor";
  private final String scoreTabName = "Pentagrama";
  private JComponent editorPanel, scorePanel;
  File archivo;
  JTextPane doc = null;
  private static Calendar cal;
  LexLog lexLog;
  String logText;
  Boolean onlyErrors = true;

  public YakiMusicView_backup(SingleFrameApplication app) {
    super(app);

    initComponents();
    //lexLog = new LexLog(log, "");
    logText = "";
    log.setFont(Font.getFont(Font.MONOSPACED));
    log.setBackground(Color.black);
    log("Iniciando aplicación...");

    newDocument(null);

    // status bar initialization - message timeout, idle icon and busy
    // animation, etc
    ResourceMap resourceMap = getResourceMap();
    int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
    messageTimer = new Timer(messageTimeout, new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        statusMessageLabel.setText("");
      }
    });
    messageTimer.setRepeats(false);
    int busyAnimationRate = resourceMap
        .getInteger("StatusBar.busyAnimationRate");
    for (int i = 0; i < busyIcons.length; i++) {
      busyIcons[i] = resourceMap
          .getIcon("StatusBar.busyIcons[" + i + "]");
    }
    busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
        statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
      }
    });
    idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
    statusAnimationLabel.setIcon(idleIcon);
    progressBar.setVisible(false);

    // connecting action tasks to status bar via TaskMonitor
    TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
    taskMonitor
        .addPropertyChangeListener(new java.beans.PropertyChangeListener() {
          public void propertyChange(
              java.beans.PropertyChangeEvent evt) {
            String propertyName = evt.getPropertyName();
            if ("started".equals(propertyName)) {
              if (!busyIconTimer.isRunning()) {
                statusAnimationLabel.setIcon(busyIcons[0]);
                busyIconIndex = 0;
                busyIconTimer.start();
              }
              progressBar.setVisible(true);
              progressBar.setIndeterminate(true);
            } else if ("done".equals(propertyName)) {
              busyIconTimer.stop();
              statusAnimationLabel.setIcon(idleIcon);
              progressBar.setVisible(false);
              progressBar.setValue(0);
            } else if ("message".equals(propertyName)) {
              String text = (String) (evt.getNewValue());
              statusMessageLabel.setText((text == null) ? ""
                  : text);
              messageTimer.restart();
            } else if ("progress".equals(propertyName)) {
              int value = (Integer) (evt.getNewValue());
              progressBar.setVisible(true);
              progressBar.setIndeterminate(false);
              progressBar.setValue(value);
            }
          }
        });
  }

  private static String getHead() {
    int h, m, s;
    cal = new GregorianCalendar();
    String h2, m2, s2;
    h = cal.get(Calendar.HOUR_OF_DAY);
    m = cal.get(Calendar.MINUTE);
    s = cal.get(Calendar.SECOND);
    h2 = "0" + h;
    m2 = "0" + m;
    s2 = "0" + s;
    return "[" + h2.substring(h2.length() - 2) + ":"
        + m2.substring(m2.length() - 2) + ":"
        + s2.substring(s2.length() - 2) + "] ";
  }

  public void log(String s) {
    // String text = log.getText()
    // +"<html><head></head><body><font color=\"#cc6600\">" + getHead() +
    // "</font>" + " <font color=\"#ffffff\">" + s +
    // "</font><br></body></html>";
    // System.out.println(text);
    log.append(Color.gray, getHead());
    log.append(Color.white, s + "\n");

  }

  public void error(String s) {
    // String text = log.getText()
    // +"<html><head></head><body><font color=\"#cc6600\">" + getHead() +
    // "</font>" + " <font color=\"#ffffff\">" + s +
    // "</font><br></body></html>";
    // System.out.println(text);
    log.append(Color.gray, getHead());
    log.append(Color.red, s + "\n");
  }

  @Action
  public void sintacticAnalysis() {
    try {
      String s = doc.getText();
      StringReader r = new StringReader(s);
      log("Realizando análisis sintáctico...");
      //InputStream is = new FileInputStream("/home/sgm/ejemplo.yml");
      lexLog = new LexLog(log, s);
      lexLog.setOnlyErrors(onlyErrors);
      parser p = new parser(new LexAnalyzer(r, lexLog), lexLog);     
      Symbol simbol = p.parse();
      //System.out.println(simbol);
      log("Análisis sintáctico finalizado (" + lexLog.getErrorCount() + " errores).");
    } catch (IOException ex) {
      log("Error durante el análisis léxico \n"+ex);
    } catch (Exception e) {
      System.err.println("El analizador sintáctico casca: ");
      e.printStackTrace();
    }
  }

  @Action
  public void lexicAnalysis() {
    /*
    try {
      String s = doc.getText();
      Reader r = new StringReader(s);
      log("Realizando análisis léxico...");
      LexAnalyzer an = new LexAnalyzer(r, lexLog);
      an.yylex();
      log("Análisis léxico finalizado");
    } catch (IOException ex) {
      log("Error durante el análisis léxico");
    }
    */
  }

  @Action
  public void newDocument() {
    JOptionPane op = new JOptionPane();
    if (doc.getText().isEmpty()
        || op.showConfirmDialog(
            getComponent(),
            "Si crea un documento nuevo se cerrará el documento actual,\ny perderá todos los cambios que no haya guardado\n¿Desea continuar?",
            "Pregunta", op.YES_NO_OPTION) == op.OK_OPTION) {
      newDocument(null);
      log("Se ha creado documento nuevo");
    }

  }

  private void newDocument(File f) {
    archivo = f;
    if (editorPanel != null) {
      editor.remove(0);
    }
    doc = new JTextPane();
    editorPanel = yakimusic.editor.ComponentGenerator
        .genNewDocument(f, doc);
    editor.add(editorPanel, this.editorTabName);
    if (f != null)
      editor.setTitleAt(0, f.getName());
    else
      editor.setTitleAt(0, "Nuevo documento");
    // editor.add(doc, "pruebas");
  }

  @Action
  public void reload() {
    JOptionPane op = new JOptionPane();
    if (op.showConfirmDialog(
        getComponent(),
        "¿Desea recargar el documento del disco duro?\nPerderá los cambios que no haya guardado.",
        "Pregunta", op.YES_NO_OPTION) == op.OK_OPTION) {
      newDocument(archivo);
      log("Se ha recargado el archivo " + archivo.getAbsolutePath());
    }
  }

  @Action
  public void openDocument() {
    JOptionPane op = new JOptionPane();
    if (doc.getText().isEmpty()
        || op.showConfirmDialog(
            getComponent(),
            "Si carga otro documento, el documento actual será cerrado,\ny perderá todos los cambios que no haya guardado\n¿Desea continuar?",
            "Pregunta", op.YES_NO_OPTION) == op.OK_OPTION) {
      // newDocument(null);
      javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
      fc.showOpenDialog(this.getComponent());
      java.io.File f = fc.getSelectedFile();
      if (f != null) { // Esto esta mal, hay que apañarlo
        newDocument(f);
        log("Se ha abierto el archivo " + f.getAbsolutePath());
      }
    }
  }

  @Action
  public void save() {
    if (archivo == null) {
      saveAs();
    } else {
      try {
        FileWriter fw = new FileWriter(archivo);
        fw.write(doc.getText());
        fw.close();
        log("Se ha guardado el documento " + archivo.getAbsolutePath());
      } catch (IOException ex) {
        log("Error al guardar el documento "
            + archivo.getAbsolutePath());
        ex.printStackTrace();
      }

    }
  }

  @Action
  public void saveAs() {
    javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
    fc.setName("Guardar como...");
    fc.showSaveDialog(fc);
    File f = fc.getSelectedFile();
    if (f != null) {
      try {
        f.createNewFile();
        FileWriter fw = new FileWriter(f);
        fw.write(doc.getText());
        fw.close();
        log("Se ha guardado el documento " + f.getAbsolutePath());
        archivo = f;
      } catch (IOException ex) {
        log("Error al guardar el documento " + f.getAbsolutePath());
        ex.printStackTrace();
      }
    }
  }

  @Action
  public void play() {

    Thread piano = new Thread() {
      @Override
      public void run() {
        Player player = new Player();
        player.play("T320 I[ACOUSTIC_SNARE] C3w D6h E3q F#5i Rs Ab7q Bb2i C3w D6h E3q F#5i Rs Ab7q Bb2i Cmajw Cmajw Cmajw Dminq");
        // player.play("Bb6/0.5");
        System.out.println("Fin de reproducción");

      }
    };

    Thread guitarra = new Thread() {
      @Override
      public void run() {
        Player player = new Player();
        player.play("T[Allegro] V0 I0 G6q A5q V1 A5q G6q");
        player.play("V0 Cmajw V1 I[Flute] G4q E4q C4q E4q");
        player.play("T120 V0 I[Piano] G5q G5q V9 [Hand_Clap]q Rq");
        System.out.println("Fin de reproducción");
      }
    };

    Thread bateria = new Thread() {
      @Override
      public void run() {
        Rhythm rhythm = new Rhythm();
        rhythm.setLayer(1, "O..oO...O..oOO..");
        // rhythm.setLayer(2, "..*...*...*...*.");
        // rhythm.setLayer(3, "^^^^^^^^^^^^^^^^"); M
        rhythm.setLayer(4, "...............!");
        rhythm.addSubstitution('O', "[ACCORDIAN]i");
        rhythm.addSubstitution('o', "Rs [MELODIC_TOM]s");
        rhythm.addSubstitution('*', "[FLUTE]i");
        rhythm.addSubstitution('^', "[PEDAL_HI_HAT]s Rs");
        rhythm.addSubstitution('!', "[CRASH_CYMBAL_1]s Rs");
        rhythm.addSubstitution('.', "Ri");
        Pattern pattern = rhythm.getPattern();
        pattern.repeat(4);
        Player player = new Player();
        player.play(pattern);

      }
    };

    piano.start();
    // piano.start();
    // guitarra.start();

    // Mostramos una partitura
    try {
      String tuneAsString = "X:0\nT:A simple scale exercise\nK:D\nCDEFGABcdefggfedcBAGFEDC\n";
      Tune tune = new TuneParser().parse(tuneAsString);
      JScoreComponent scoreUI = new JScoreComponent();
      scoreUI.setTune(tune);

      javax.swing.JPanel j = new javax.swing.JPanel();
      // JFrame j = new JFrame();
      j.add(scoreUI);
      // j.pack();
      j.setVisible(true);
      editor.add(new javax.swing.JScrollPane(j), "Pentagrama");

    } catch (HeadlessException ex2) {
    }

  }

  @Action
  public void showAboutBox() {
    if (aboutBox == null) {
      JFrame mainFrame = YakiMusicApp.getApplication().getMainFrame();
      aboutBox = new YakiMusicAboutBox(mainFrame);
      aboutBox.setLocationRelativeTo(mainFrame);
    }
    YakiMusicApp.getApplication().show(aboutBox);
  }

  /**
   * 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() {

    mainPanel = new javax.swing.JPanel();
    splitPane_vertical = new javax.swing.JSplitPane();
    editor = new javax.swing.JTabbedPane();
    jPanel1 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    log = new yakimusic.editor.ColorPane();
    jToolBar1 = new javax.swing.JToolBar();
    jButton1 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jButton7 = new javax.swing.JButton();
    jButton4 = new javax.swing.JButton();
    jButton8 = new javax.swing.JButton();
    jSeparator1 = new javax.swing.JToolBar.Separator();
    jButton5 = new javax.swing.JButton();
    jButton6 = new javax.swing.JButton();
    jSeparator5 = new javax.swing.JToolBar.Separator();
    jButton2 = new javax.swing.JButton();
    menuBar = new javax.swing.JMenuBar();
    javax.swing.JMenu fileMenu = new javax.swing.JMenu();
    jMenuItem2 = new javax.swing.JMenuItem();
    jSeparator4 = new javax.swing.JPopupMenu.Separator();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenuItem3 = new javax.swing.JMenuItem();
    jSeparator3 = new javax.swing.JPopupMenu.Separator();
    jMenuItem4 = new javax.swing.JMenuItem();
    jMenuItem5 = new javax.swing.JMenuItem();
    jSeparator2 = new javax.swing.JPopupMenu.Separator();
    javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem6 = new javax.swing.JMenuItem();
    jMenuItem7 = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    jCheckBoxMenuItem1 = new javax.swing.JCheckBoxMenuItem();
    javax.swing.JMenu helpMenu = new javax.swing.JMenu();
    javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
    statusPanel = new javax.swing.JPanel();
    javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
    statusMessageLabel = new javax.swing.JLabel();
    statusAnimationLabel = new javax.swing.JLabel();
    progressBar = new javax.swing.JProgressBar();

    mainPanel.setName("mainPanel"); // NOI18N
    mainPanel.addComponentListener(new java.awt.event.ComponentAdapter() {
      public void componentResized(java.awt.event.ComponentEvent evt) {
        mainPanelComponentResized(evt);
      }
    });

    splitPane_vertical.setDividerLocation(250);
    splitPane_vertical.setDividerSize(5);
    splitPane_vertical
        .setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
    splitPane_vertical.setName("splitPane_vertical"); // NOI18N

    editor.setName("editor"); // NOI18N
    splitPane_vertical.setLeftComponent(editor);

    org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application
        .getInstance(yakimusic.YakiMusicApp.class).getContext()
        .getResourceMap(YakiMusicView_backup.class);
    jPanel1.setBorder(javax.swing.BorderFactory
        .createTitledBorder(resourceMap
            .getString("jPanel1.border.title"))); // NOI18N
    jPanel1.setName("jPanel1"); // NOI18N

    jScrollPane1.setName("jScrollPane1"); // NOI18N

    log.setName("log"); // NOI18N
    jScrollPane1.setViewportView(log);

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
        jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(
        javax.swing.GroupLayout.Alignment.LEADING).addGroup(
        jPanel1Layout
            .createSequentialGroup()
            .addContainerGap()
            .addComponent(jScrollPane1,
                javax.swing.GroupLayout.DEFAULT_SIZE, 856,
                Short.MAX_VALUE).addContainerGap()));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(
        javax.swing.GroupLayout.Alignment.LEADING).addGroup(
        jPanel1Layout
            .createSequentialGroup()
            .addComponent(jScrollPane1,
                javax.swing.GroupLayout.DEFAULT_SIZE, 308,
                Short.MAX_VALUE).addContainerGap()));

    splitPane_vertical.setRightComponent(jPanel1);

    jToolBar1.setRollover(true);
    jToolBar1.setName("jToolBar1"); // NOI18N

    javax.swing.ActionMap actionMap = org.jdesktop.application.Application
        .getInstance(yakimusic.YakiMusicApp.class).getContext()
        .getActionMap(YakiMusicView_backup.class, this);
    jButton1.setAction(actionMap.get("newDocument")); // NOI18N
    jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
    jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
    jButton1.setFocusable(false);
    jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    jButton1.setName("jButton1"); // NOI18N
    jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jToolBar1.add(jButton1);

    jButton3.setAction(actionMap.get("openDocument")); // NOI18N
    jButton3.setIcon(resourceMap.getIcon("jButton3.icon")); // NOI18N
    jButton3.setText(resourceMap.getString("jButton3.text")); // NOI18N
    jButton3.setFocusable(false);
    jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    jButton3.setName("jButton3"); // NOI18N
    jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jToolBar1.add(jButton3);

    jButton7.setAction(actionMap.get("reload")); // NOI18N
    jButton7.setIcon(resourceMap.getIcon("jButton7.icon")); // NOI18N
    jButton7.setText(resourceMap.getString("jButton7.text")); // NOI18N
    jButton7.setFocusable(false);
    jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    jButton7.setName("jButton7"); // NOI18N
    jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jToolBar1.add(jButton7);

    jButton4.setAction(actionMap.get("save")); // NOI18N
    jButton4.setIcon(resourceMap.getIcon("jButton4.icon")); // NOI18N
    jButton4.setText(resourceMap.getString("jButton4.text")); // NOI18N
    jButton4.setFocusable(false);
    jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    jButton4.setName("jButton4"); // NOI18N
    jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jToolBar1.add(jButton4);

    jButton8.setAction(actionMap.get("saveAs")); // NOI18N
    jButton8.setIcon(resourceMap.getIcon("jButton8.icon")); // NOI18N
    jButton8.setText(resourceMap.getString("jButton8.text")); // NOI18N
    jButton8.setFocusable(false);
    jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    jButton8.setName("jButton8"); // NOI18N
    jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jToolBar1.add(jButton8);

    jSeparator1.setName("jSeparator1"); // NOI18N
    jToolBar1.add(jSeparator1);

    jButton5.setAction(actionMap.get("lexicAnalysis")); // NOI18N
    jButton6.setAction(actionMap.get("sintacticAnalysis")); // NOI18N
    jButton5.setIcon(resourceMap.getIcon("jButton5.icon")); // NOI18N
    jButton5.setText(resourceMap.getString("jButton5.text")); // NOI18N
    jButton5.setFocusable(false);
    jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    jButton5.setName("jButton5"); // NOI18N
    jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jToolBar1.add(jButton5);

    jButton6.setIcon(resourceMap.getIcon("jButton6.icon")); // NOI18N
    jButton6.setText(resourceMap.getString("jButton6.text")); // NOI18N
    jButton6.setFocusable(false);
    jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
    jButton6.setName("jButton6"); // NOI18N
    jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jToolBar1.add(jButton6);

    jSeparator5.setName("jSeparator5"); // NOI18N
    jToolBar1.add(jSeparator5);

    jButton2.setAction(actionMap.get("play")); // NOI18N
    jButton2.setText(resourceMap.getString("jButton2.text")); // NOI18N
    jButton2.setFocusable(false);
    jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    jButton2.setName("jButton2"); // NOI18N
    jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jToolBar1.add(jButton2);

    javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(
        mainPanel);
    mainPanel.setLayout(mainPanelLayout);
    mainPanelLayout.setHorizontalGroup(mainPanelLayout
        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE,
            892, Short.MAX_VALUE)
        .addComponent(splitPane_vertical,
            javax.swing.GroupLayout.DEFAULT_SIZE, 892,
            Short.MAX_VALUE));
    mainPanelLayout
        .setVerticalGroup(mainPanelLayout
            .createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                mainPanelLayout
                    .createSequentialGroup()
                    .addComponent(
                        jToolBar1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        25,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        splitPane_vertical,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        602, Short.MAX_VALUE)));

    menuBar.setName("menuBar"); // NOI18N

    fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
    fileMenu.setName("fileMenu"); // NOI18N

    jMenuItem2.setAction(actionMap.get("newDocument")); // NOI18N
    jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
    jMenuItem2.setName("jMenuItem2"); // NOI18N
    fileMenu.add(jMenuItem2);

    jSeparator4.setName("jSeparator4"); // NOI18N
    fileMenu.add(jSeparator4);

    jMenuItem1.setAction(actionMap.get("openDocument")); // NOI18N
    jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
    jMenuItem1.setName("jMenuItem1"); // NOI18N
    fileMenu.add(jMenuItem1);

    jMenuItem3.setAction(actionMap.get("reload")); // NOI18N
    jMenuItem3.setText(resourceMap.getString("jMenuItem3.text")); // NOI18N
    jMenuItem3.setName("jMenuItem3"); // NOI18N
    fileMenu.add(jMenuItem3);

    jSeparator3.setName("jSeparator3"); // NOI18N
    fileMenu.add(jSeparator3);

    jMenuItem4.setAction(actionMap.get("save")); // NOI18N
    jMenuItem4.setText(resourceMap.getString("jMenuItem4.text")); // NOI18N
    jMenuItem4.setName("jMenuItem4"); // NOI18N
    fileMenu.add(jMenuItem4);

    jMenuItem5.setAction(actionMap.get("saveAs")); // NOI18N
    jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N
    jMenuItem5.setName("jMenuItem5"); // NOI18N
    fileMenu.add(jMenuItem5);

    jSeparator2.setName("jSeparator2"); // NOI18N
    fileMenu.add(jSeparator2);

    exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
    exitMenuItem.setName("exitMenuItem"); // NOI18N
    fileMenu.add(exitMenuItem);

    menuBar.add(fileMenu);

    jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
    jMenu1.setName("jMenu1"); // NOI18N

    jMenuItem6.setText(resourceMap.getString("jMenuItem6.text")); // NOI18N
    jMenuItem6.setName("jMenuItem6"); // NOI18N
    jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        jMenuItem6ActionPerformed(evt);
      }
    });
    jMenu1.add(jMenuItem6);

    jMenuItem7.setText(resourceMap.getString("jMenuItem7.text")); // NOI18N
    jMenuItem7.setName("jMenuItem7"); // NOI18N
    jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        jMenuItem7ActionPerformed(evt);
      }
    });
    jMenu1.add(jMenuItem7);

    jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
    jMenu2.setName("jMenu2"); // NOI18N

    jCheckBoxMenuItem1.setSelected(true);
    jCheckBoxMenuItem1.setText(resourceMap
        .getString("jCheckBoxMenuItem1.text")); // NOI18N
    jCheckBoxMenuItem1.setName("jCheckBoxMenuItem1"); // NOI18N
    jCheckBoxMenuItem1.addItemListener(new java.awt.event.ItemListener() {
      public void itemStateChanged(java.awt.event.ItemEvent evt) {
        jCheckBoxMenuItem1ItemStateChanged(evt);
      }
    });
    jMenu2.add(jCheckBoxMenuItem1);

    jMenu1.add(jMenu2);

    menuBar.add(jMenu1);

    helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
    helpMenu.setName("helpMenu"); // NOI18N

    aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
    aboutMenuItem.setName("aboutMenuItem"); // NOI18N
    helpMenu.add(aboutMenuItem);

    menuBar.add(helpMenu);

    statusPanel.setName("statusPanel"); // NOI18N

    statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

    statusMessageLabel.setName("statusMessageLabel"); // NOI18N

    statusAnimationLabel
        .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
    statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

    progressBar.setName("progressBar"); // NOI18N

    javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(
        statusPanel);
    statusPanel.setLayout(statusPanelLayout);
    statusPanelLayout
        .setHorizontalGroup(statusPanelLayout
            .createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator,
                javax.swing.GroupLayout.DEFAULT_SIZE, 892,
                Short.MAX_VALUE)
            .addGroup(
                statusPanelLayout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(statusMessageLabel)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                        706, Short.MAX_VALUE)
                    .addComponent(
                        progressBar,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(statusAnimationLabel)
                    .addContainerGap()));
    statusPanelLayout
        .setVerticalGroup(statusPanelLayout
            .createParallelGroup(
                javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                statusPanelLayout
                    .createSequentialGroup()
                    .addComponent(
                        statusPanelSeparator,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        2,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addGroup(
                        statusPanelLayout
                            .createParallelGroup(
                                javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                statusMessageLabel)
                            .addComponent(
                                statusAnimationLabel)
                            .addComponent(
                                progressBar,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(3, 3, 3)));

    setComponent(mainPanel);
    setMenuBar(menuBar);
    setStatusBar(statusPanel);
  }// </editor-fold>//GEN-END:initComponents

  private void mainPanelComponentResized(java.awt.event.ComponentEvent evt) {// GEN-FIRST:event_mainPanelComponentResized
    splitPane_vertical.setDividerLocation(0.7);
    // splitPane_horizontal.setDividerLocation(0.6);
  }// GEN-LAST:event_mainPanelComponentResized

  private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem6ActionPerformed
    log.setText("");
    log("Registro borrado");
  }// GEN-LAST:event_jMenuItem6ActionPerformed

  private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem7ActionPerformed
    javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
    fc.setName("Guardar como...");
    fc.showSaveDialog(fc);
    File f = fc.getSelectedFile();
    if (f != null) {
      try {
        f.createNewFile();
        FileWriter fw = new FileWriter(f);
        fw.write(log.getText());
        fw.close();
        log("Se ha guardado el registro en " + f.getAbsolutePath());
        archivo = f;
      } catch (IOException ex) {
        error("Error al guardar el registro en " + f.getAbsolutePath());
        ex.printStackTrace();
      }
    }
  }// GEN-LAST:event_jMenuItem7ActionPerformed

  private void jCheckBoxMenuItem1ItemStateChanged(java.awt.event.ItemEvent evt) {// GEN-FIRST:event_jCheckBoxMenuItem1ItemStateChanged
    onlyErrors = jCheckBoxMenuItem1.getState();   
  }// GEN-LAST:event_jCheckBoxMenuItem1ItemStateChanged

  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JTabbedPane editor;
  private javax.swing.JButton jButton1;
  private javax.swing.JButton jButton2;
  private javax.swing.JButton jButton3;
  private javax.swing.JButton jButton4;
  private javax.swing.JButton jButton5;
  private javax.swing.JButton jButton6;
  private javax.swing.JButton jButton7;
  private javax.swing.JButton jButton8;
  private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem1;
  private javax.swing.JMenu jMenu1;
  private javax.swing.JMenu jMenu2;
  private javax.swing.JMenuItem jMenuItem1;
  private javax.swing.JMenuItem jMenuItem2;
  private javax.swing.JMenuItem jMenuItem3;
  private javax.swing.JMenuItem jMenuItem4;
  private javax.swing.JMenuItem jMenuItem5;
  private javax.swing.JMenuItem jMenuItem6;
  private javax.swing.JMenuItem jMenuItem7;
  private javax.swing.JPanel jPanel1;
  private javax.swing.JScrollPane jScrollPane1;
  private javax.swing.JToolBar.Separator jSeparator1;
  private javax.swing.JPopupMenu.Separator jSeparator2;
  private javax.swing.JPopupMenu.Separator jSeparator3;
  private javax.swing.JPopupMenu.Separator jSeparator4;
  private javax.swing.JToolBar.Separator jSeparator5;
  private javax.swing.JToolBar jToolBar1;
  private yakimusic.editor.ColorPane log;
  private javax.swing.JPanel mainPanel;
  private javax.swing.JMenuBar menuBar;
  private javax.swing.JProgressBar progressBar;
  private javax.swing.JSplitPane splitPane_vertical;
  private javax.swing.JLabel statusAnimationLabel;
  private javax.swing.JLabel statusMessageLabel;
  private javax.swing.JPanel statusPanel;
  // End of variables declaration//GEN-END:variables

  private final Timer messageTimer;
  private final Timer busyIconTimer;
  private final Icon idleIcon;
  private final Icon[] busyIcons = new Icon[15];
  private int busyIconIndex = 0;

  private JDialog aboutBox;
}
TOP

Related Classes of yakimusic.YakiMusicView_backup

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.