/* * Copyright (C) 2014 tc * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package nars.lab.launcher; import java.awt.Desktop; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URI; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import nars.NAR; import nars.config.Plugins; import nars.gui.NARSwing; import nars.io.Narsese; import nars.web.NARServer; /** * * @author tc */ public class Launcher extends javax.swing.JFrame { public static File resource(String path) { return new File("./nars_lab/nars/lab/launcher/" + path); } /** * Creates new form Launcher */ public Launcher() { initComponents(); jLabel1.setIcon(new ImageIcon("./doc/opennars_logo2.png")); this.setTitle("OpenNARS Launcher"); /*try { BufferedImage myPicture = ImageIO.read(resource("mario.png")); jLabel8.setIcon(new ImageIcon(myPicture)); } catch (IOException ex) { Logger.getLogger(Launcher.class.getName()).log(Level.SEVERE, null, ex); }*/ try { BufferedImage myPicture = ImageIO.read(resource("testchamber.png")); jLabel6.setIcon(new ImageIcon(myPicture)); } catch (IOException ex) { Logger.getLogger(Launcher.class.getName()).log(Level.SEVERE, null, ex); } /*try { BufferedImage myPicture = ImageIO.read(resource("rover.png")); jLabel7.setIcon(new ImageIcon(myPicture)); } catch (IOException ex) { Logger.getLogger(Launcher.class.getName()).log(Level.SEVERE, null, ex); }*/ /*try { BufferedImage myPicture = ImageIO.read(resource("nartactoe.png")); jLabel2.setIcon(new ImageIcon(myPicture)); } catch (IOException ex) { Logger.getLogger(Launcher.class.getName()).log(Level.SEVERE, null, ex); } try { BufferedImage myPicture = ImageIO.read(resource("predict.png")); jLabel5.setIcon(new ImageIcon(myPicture)); } catch (IOException ex) { Logger.getLogger(Launcher.class.getName()).log(Level.SEVERE, null, ex); }*/ try { BufferedImage myPicture = ImageIO.read(resource("pong.png")); jLabel9.setIcon(new ImageIcon(myPicture)); } catch (IOException ex) { Logger.getLogger(Launcher.class.getName()).log(Level.SEVERE, null, ex); } try { BufferedImage myPicture = ImageIO.read(resource("NLP.png")); jLabel10.setIcon(new ImageIcon(myPicture)); } catch (IOException ex) { Logger.getLogger(Launcher.class.getName()).log(Level.SEVERE, null, ex); } try { BufferedImage myPicture = ImageIO.read(resource("microworld.png")); jLabel11.setIcon(new ImageIcon(myPicture)); } catch (IOException ex) { Logger.getLogger(Launcher.class.getName()).log(Level.SEVERE, null, ex); } } /** * 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() { jPanel2 = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jLabel6 = new javax.swing.JLabel(); jButton5 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) ); jButton1.setForeground(new java.awt.Color(255, 255, 254)); jButton1.setText("OpenNARS"); jButton1.setActionCommand("jButton1"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel3.setForeground(new java.awt.Color(254, 255, 255)); jLabel3.setText("Run Application Examples:"); jButton2.setForeground(new java.awt.Color(254, 255, 255)); jButton2.setText("Website"); jButton2.setActionCommand("jButton1"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jLabel6.setBackground(new java.awt.Color(255, 255, 255)); jLabel6.setForeground(new java.awt.Color(254, 255, 255)); jLabel6.setText("Test Chamber"); jLabel6.setToolTipText(""); jLabel6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel6MouseClicked(evt); } }); jButton5.setForeground(new java.awt.Color(254, 255, 255)); jButton5.setText("IRC"); jButton5.setActionCommand("jButton1"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jButton3.setForeground(new java.awt.Color(255, 255, 254)); jButton3.setText("Web GUI"); jButton3.setActionCommand("jButton1"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jLabel9.setBackground(new java.awt.Color(255, 255, 255)); jLabel9.setForeground(new java.awt.Color(254, 255, 255)); jLabel9.setText("NAR Pong"); jLabel9.setToolTipText(""); jLabel9.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel9MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel9MouseEntered(evt); } }); jLabel10.setBackground(new java.awt.Color(255, 255, 255)); jLabel10.setForeground(new java.awt.Color(254, 255, 255)); jLabel10.setText("Language Lab"); jLabel10.setToolTipText(""); jLabel10.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel10MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel10MouseEntered(evt); } }); jLabel11.setBackground(new java.awt.Color(255, 255, 255)); jLabel11.setForeground(new java.awt.Color(254, 255, 255)); jLabel11.setText("Micro World"); jLabel11.setToolTipText(""); jLabel11.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jLabel11MouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jLabel11MouseEntered(evt); } }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(12, 12, 12) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton5))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(21, 21, 21)))) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(22, 22, 22)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton3) .addComponent(jButton2) .addComponent(jButton5)) .addGap(18, 18, 18) .addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 330, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed NARSwing sw=new NARSwing(new NAR()); this.dispose(); }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try{ Desktop.getDesktop().browse(new URI("http://code.google.com/p/open-nars/")); }catch(Exception ex){} }//GEN-LAST:event_jButton2ActionPerformed private void jLabel6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseClicked nars.lab.grid2d.main.TestChamber.main(new String[]{}); //this.setVisible(false); this.dispose(); }//GEN-LAST:event_jLabel6MouseClicked private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed try{ Desktop.getDesktop().browse(new URI("http://webchat.freenode.net/?channels=nars")); }catch(Exception ex){} }//GEN-LAST:event_jButton5ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed try { NARServer.main(new String[]{"9999","localhost","9100","1000"}); Desktop.getDesktop().browse(new URI("http://127.0.0.1:9999")); }catch(Exception ex){} }//GEN-LAST:event_jButton3ActionPerformed private void jLabel9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseClicked nars.lab.microworld.Pong.main(null); this.dispose(); }//GEN-LAST:event_jLabel9MouseClicked private void jLabel9MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseEntered // TODO add your handling code here: }//GEN-LAST:event_jLabel9MouseEntered private void jLabel10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel10MouseClicked nars.lab.language.LanguageGUI.main(null); this.dispose(); }//GEN-LAST:event_jLabel10MouseClicked private void jLabel10MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel10MouseEntered // TODO add your handling code here: }//GEN-LAST:event_jLabel10MouseEntered private void jLabel11MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel11MouseClicked nars.lab.microworld.SimNAR.main(null); this.dispose(); }//GEN-LAST:event_jLabel11MouseClicked private void jLabel11MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel11MouseEntered // TODO add your handling code here: }//GEN-LAST:event_jLabel11MouseEntered /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ // try { // for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { // if ("Nimbus".equals(info.getName())) { // javax.swing.UIManager.setLookAndFeel(info.getClassName()); // break; // } // } // } catch (ClassNotFoundException ex) { // java.util.logging.Logger.getLogger(Launcher.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); // } catch (InstantiationException ex) { // java.util.logging.Logger.getLogger(Launcher.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); // } catch (IllegalAccessException ex) { // java.util.logging.Logger.getLogger(Launcher.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); // } catch (javax.swing.UnsupportedLookAndFeelException ex) { // java.util.logging.Logger.getLogger(Launcher.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); // } //</editor-fold> NARSwing.themeInvert(); /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Launcher().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; // End of variables declaration//GEN-END:variables }