/*
* !!!!!
* NOTE: PLEASE ONLY EDIT THIS USING THE NETBEANS IDE 6.0.1 OR HIGHER!!!!
* !!!!!
*
* ... an .xml file is associated with this class. Cheers.
*
* BotConsoleFrame.java
*
* Created on 28 March 2008, 08:35
*/
package org.reprap.gui.botConsole;
import org.reprap.Preferences;
import javax.swing.JOptionPane;
import org.reprap.machines.Reprap;
/**
*
* @author Ed Sells, March 2008
*
* Console to operate the RepRap printer manually.
*
*/
public class BotConsoleFrame extends javax.swing.JFrame {
/** Creates new form BotConsoleFrame */
public BotConsoleFrame() {
try {
checkPrefs();
}
catch (Exception e) {
System.out.println("Failure trying to initialise comms in botConsole: " + e);
JOptionPane.showMessageDialog(null, e.getMessage());
return;
}
initComponents();
xYZTabPanel1.setBedPanelDimensions();
this.setTitle("Bot Console");
}
// Comms variables
private GenericExtruderTabPanel[] extruderPanel;
private static Reprap reprap;
private void checkPrefs() throws Exception {
// ID the number of extruder
extruderCount = Preferences.loadGlobalInt("NumberOfExtruders");
if (extruderCount < 1)
throw new Exception("A Reprap printer must contain at least one extruder");
}
// public void dispose() {
//
// super.dispose();
// if (extruder != null)
// extruder.dispose();
// if (motorX != null)
// motorX.dispose();
// if (motorY != null)
// motorY.dispose();
// if (motorZ != null)
// motorZ.dispose();
// if (communicator != null)
// communicator.dispose();
// }
/** 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.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
initialiseExtruderPanels();
printTabPanel1 = new org.reprap.gui.botConsole.PrintTabPanel();
xYZTabPanel1 = new org.reprap.gui.botConsole.XYZTabPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jTabbedPane1.setRequestFocusEnabled(false);
printTabPanel1.setEnabled(false);
jTabbedPane1.addTab("Print", printTabPanel1);
jTabbedPane1.addTab("XYZ", xYZTabPanel1);
addExtruderPanels();
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 750, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new BotConsoleFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTabbedPane jTabbedPane1;
private org.reprap.gui.botConsole.PrintTabPanel printTabPanel1;
public static org.reprap.gui.botConsole.XYZTabPanel xYZTabPanel1;
// End of variables declaration//GEN-END:variables
private static int motorID = 0;
public static int getMotorID() {
motorID++;
return motorID;
}
private void initialiseExtruderPanels() {
extruderPanel = new GenericExtruderTabPanel[extruderCount];
for (int i = 0; i < extruderCount; i++) {
extruderPanel[i] = new GenericExtruderTabPanel();
try {
extruderPanel[i].initialiseExtruders(i);
}
catch (Exception e) {
System.out.println("Failure trying to initialise extruders in botConsole: " + e);
JOptionPane.showMessageDialog(null, e.getMessage());
return;
}
try {
extruderPanel[i].setPrefs();
}
catch (Exception e) {
System.out.println("Problem loading prefs for Extruder " + i);
JOptionPane.showMessageDialog(null, "Problem loading prefs for Extruder " + i);
}
}
}
private void addExtruderPanels() {
for (int i = 0; i < extruderCount; i++) {
jTabbedPane1.addTab("Extruder " + i, extruderPanel[i]);
}
}
private int extruderCount;
private int currentExtruder;
}