/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package cnc.gcode.controller; import cnc.gcode.controller.communication.Communication; import java.awt.Color; import java.io.File; import javax.swing.JColorChooser; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; /** * * @author patrick */ public class JPanelSettings extends javax.swing.JPanel implements IGUIEvent{ private IEvent GUIEvent = null; /** * Creates new form JPanelSettings */ public JPanelSettings() { initComponents(); } @Override public void setGUIEvent(IEvent event) { GUIEvent = event; } @Override public void updateGUI(boolean serial, boolean isworking) { jBImport.setEnabled(!isworking); //Akt Text jLSHomeing.setText(DatabaseV2.EHoming.get().toString()); //Homeing jLSFastFeedrate.setText(DatabaseV2.MAXFEEDRATE.get()); jLSWorkSpace.setText(""); for(int i = 0; i < 3;i++ ) { jLSWorkSpace.setText(jLSWorkSpace.getText() + CommandParsing.axesName[i] + " = " + DatabaseV2.getWorkspace(i)+" "); } jLSCNCStart.setText(Tools.convertToMultiline(DatabaseV2.STARTCODE.get())); jLSCNCToolChange.setText(Tools.convertToMultiline(DatabaseV2.TOOLCHANGE.get())); jLSCNCSpindleON.setText(Tools.convertToMultiline(DatabaseV2.SPINDLEON.get())); jLSCNCSpindleOFF.setText(Tools.convertToMultiline(DatabaseV2.SPINDLEOFF.get())); jLSCNCG0Feedrate.setText(DatabaseV2.GOFEEDRATE.get()); jLSCNCAFeedrate.setText(DatabaseV2.AFEEDRATE.get()); jLSCNCToolSize.setText(DatabaseV2.TOOLSIZE.get()); jLSCNCOptimiserTime.setText(DatabaseV2.OPTIMISATIONTIMEOUT.get()); jLSALOptions.setText(Tools.convertToMultiline( "Zero height: " + DatabaseV2.ALZERO + "\nMax depth: " + DatabaseV2.ALMAXPROBDEPTH + "\nSafe height: " + DatabaseV2.ALSAVEHEIGHT + "\nClearence: " + DatabaseV2.ALCLEARANCE + "\nFeedrate: " + DatabaseV2.ALFEEDRATE+ "\nUse outside the probed area: " + DatabaseV2.ALUSEOUTSIDEPROBEAREA )); jLSALDistance.setText(Tools.convertToMultiline("Distance: " + DatabaseV2.ALDISTANCE + "\nMax XY Move Length: " + DatabaseV2.ALMAXMOVELENGTH)); jLSALStart.setText(Tools.convertToMultiline(DatabaseV2.ALSTARTCODE.get())); jLSARC.setText(DatabaseV2.ARCSEGMENTLENGTH.get()); jLSBacklash.setText(""); for(int i=0; i<3;i++ ) { jLSBacklash.setText(jLSBacklash.getText() + CommandParsing.axesName[i] + " = " + DatabaseV2.getBacklash(i) + " "); } jLSmodal.setText(Tools.convertToMultiline("Allow G1: "+DatabaseV2.EOnOff.get(DatabaseV2.G1MODAL).name()+"\nAllow G0: "+DatabaseV2.EOnOff.get(DatabaseV2.G0MODAL).name())); jLSComType.setText(DatabaseV2.COMTYPE.get()); jLSCStreamAhead.setText(DatabaseV2.CSTREAMAHEAD.get()); jLSCBack.setBackground(new Color(Integer.parseInt(DatabaseV2.CBACKGROUND.get()))); jLSCGrid.setBackground(new Color(Integer.parseInt(DatabaseV2.CGRID.get()))); jLSCGridDis.setText(DatabaseV2.CGRIDDISTANCE.getsaved()>0?""+DatabaseV2.CGRIDDISTANCE.get():"OFF"); jLSCG0.setBackground(new Color(Integer.parseInt(DatabaseV2.CG0.get()))); jLSCG1.setBackground(new Color(Integer.parseInt(DatabaseV2.CG1.get()))); } private void fireupdateGUI() { if(GUIEvent == null) { throw new RuntimeException("GUI EVENT NOT USED!"); } GUIEvent.fired(); } /** * 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() { jLabel2 = new javax.swing.JLabel(); jBSHoming = new javax.swing.JButton(); jLSHomeing = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); jBSFastFeedrate = new javax.swing.JButton(); jLSFastFeedrate = new javax.swing.JLabel(); jLabel20 = new javax.swing.JLabel(); jBSWorkSpace = new javax.swing.JButton(); jLSWorkSpace = new javax.swing.JLabel(); jLabel21 = new javax.swing.JLabel(); jBSCNCStart = new javax.swing.JButton(); jLSCNCStart = new javax.swing.JLabel(); jLabel32 = new javax.swing.JLabel(); jBSCNCToolChange = new javax.swing.JButton(); jLSCNCToolChange = new javax.swing.JLabel(); jLabel35 = new javax.swing.JLabel(); jBSCNCSpindleON = new javax.swing.JButton(); jLSCNCSpindleON = new javax.swing.JLabel(); jLabel36 = new javax.swing.JLabel(); jBSCNCSpindleOFF = new javax.swing.JButton(); jLSCNCSpindleOFF = new javax.swing.JLabel(); jLabel33 = new javax.swing.JLabel(); jBSCNCG0Feedrate = new javax.swing.JButton(); jLSCNCG0Feedrate = new javax.swing.JLabel(); jLabel34 = new javax.swing.JLabel(); jBSCNCToolSize = new javax.swing.JButton(); jLSCNCToolSize = new javax.swing.JLabel(); jLabel39 = new javax.swing.JLabel(); jBSCNCOptimiserTime = new javax.swing.JButton(); jLSCNCOptimiserTime = new javax.swing.JLabel(); jLabel37 = new javax.swing.JLabel(); jBSALOptions = new javax.swing.JButton(); jLSALOptions = new javax.swing.JLabel(); jLabel41 = new javax.swing.JLabel(); jBSALDistance = new javax.swing.JButton(); jLSALDistance = new javax.swing.JLabel(); jLabel38 = new javax.swing.JLabel(); jBSALStart = new javax.swing.JButton(); jLSALStart = new javax.swing.JLabel(); jLabel40 = new javax.swing.JLabel(); jBSARC = new javax.swing.JButton(); jLSARC = new javax.swing.JLabel(); jLabel42 = new javax.swing.JLabel(); jBSBacklash = new javax.swing.JButton(); jLSBacklash = new javax.swing.JLabel(); jLabel43 = new javax.swing.JLabel(); jBSmodal = new javax.swing.JButton(); jLSmodal = new javax.swing.JLabel(); jLabel44 = new javax.swing.JLabel(); jBSComType = new javax.swing.JButton(); jLSComType = new javax.swing.JLabel(); jLabel51 = new javax.swing.JLabel(); jBSCStreamAhead = new javax.swing.JButton(); jLSCStreamAhead = new javax.swing.JLabel(); jLabel46 = new javax.swing.JLabel(); jBSCBack = new javax.swing.JButton(); jLSCBack = new javax.swing.JLabel(); jLabel49 = new javax.swing.JLabel(); jBSCGrid = new javax.swing.JButton(); jLSCGrid = new javax.swing.JLabel(); jLabel50 = new javax.swing.JLabel(); jBSCGridDis = new javax.swing.JButton(); jLSCGridDis = new javax.swing.JLabel(); jLabel47 = new javax.swing.JLabel(); jBSCG0 = new javax.swing.JButton(); jLSCG0 = new javax.swing.JLabel(); jLabel48 = new javax.swing.JLabel(); jBSCG1 = new javax.swing.JButton(); jLSCG1 = new javax.swing.JLabel(); jBexport = new javax.swing.JButton(); jBImport = new javax.swing.JButton(); jLabel45 = new javax.swing.JLabel(); jBSCNCAFeedrate = new javax.swing.JButton(); jLSCNCAFeedrate = new javax.swing.JLabel(); jLabel2.setText("Homing:"); jBSHoming.setText("Change"); jBSHoming.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSHomeing.setText("Settings Text"); jLabel19.setText("Fast Move Feedrate:"); jBSFastFeedrate.setText("Change"); jBSFastFeedrate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSFastFeedrate.setText("Settings Text"); jLabel20.setText("Size of Workingspace:"); jBSWorkSpace.setText("Change"); jBSWorkSpace.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSWorkSpace.setText("Settings Text"); jLabel21.setText("CNC/StartGCode"); jBSCNCStart.setText("Change"); jBSCNCStart.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCNCStart.setText("Settings Text"); jLabel32.setText("CNC/Tool Change:"); jBSCNCToolChange.setText("Change"); jBSCNCToolChange.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCNCToolChange.setText("Settings Text"); jLabel35.setText("CNC/Spindle ON:"); jBSCNCSpindleON.setText("Change"); jBSCNCSpindleON.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCNCSpindleON.setText("Settings Text"); jLabel36.setText("CNC/Spindle OFF:"); jBSCNCSpindleOFF.setText("Change"); jBSCNCSpindleOFF.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCNCSpindleOFF.setText("Settings Text"); jLabel33.setText("CNC/G0 Feedrate:"); jBSCNCG0Feedrate.setText("Change"); jBSCNCG0Feedrate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCNCG0Feedrate.setText("Settings Text"); jLabel34.setText("CNC/Paint Tool Size:"); jBSCNCToolSize.setText("Change"); jBSCNCToolSize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCNCToolSize.setText("Settings Text"); jLabel39.setText("CNC/Optimize Time:"); jBSCNCOptimiserTime.setText("Change"); jBSCNCOptimiserTime.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCNCOptimiserTime.setText("Settings Text"); jLabel37.setText("Autolevel/Options:"); jBSALOptions.setText("Change"); jBSALOptions.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSALOptions.setText("Settings Text"); jLabel41.setText("Autolevel/Distance:"); jBSALDistance.setText("Change"); jBSALDistance.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSALDistance.setText("Settings Text"); jLabel38.setText("Autolevel/Start GCode:"); jBSALStart.setText("Change"); jBSALStart.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSALStart.setText("Settings Text"); jLabel40.setText("ARC/ Max Segment Length:"); jBSARC.setText("Change"); jBSARC.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSARC.setText("Settings Text"); jLabel42.setText("Backlash Correction:"); jBSBacklash.setText("Change"); jBSBacklash.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSBacklash.setText("Settings Text"); jLabel43.setText("Allow modal:"); jBSmodal.setText("Change"); jBSmodal.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSmodal.setText("Settings Text"); jLabel44.setText("Device connected:"); jBSComType.setText("Change"); jBSComType.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSComType.setText("Settings Text"); jLabel51.setText("Stream ahead"); jBSCStreamAhead.setText("Change"); jBSCStreamAhead.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCStreamAhead.setText("Settings Text"); jLabel46.setText("Background color:"); jBSCBack.setText("Change"); jBSCBack.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCBack.setText(" "); jLSCBack.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLSCBack.setOpaque(true); jLabel49.setText("Grid color:"); jBSCGrid.setText("Change"); jBSCGrid.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCGrid.setText(" "); jLSCGrid.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLSCGrid.setOpaque(true); jLabel50.setText("Grid distance:"); jBSCGridDis.setText("Change"); jBSCGridDis.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCGridDis.setText("Settings Text"); jLabel47.setText("G0 color:"); jBSCG0.setText("Change"); jBSCG0.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCG0.setText(" "); jLSCG0.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLSCG0.setOpaque(true); jLabel48.setText("G1 color:"); jBSCG1.setText("Change"); jBSCG1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCG1.setText(" "); jLSCG1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLSCG1.setOpaque(true); jBexport.setText("Export"); jBexport.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBexportActionPerformed(evt); } }); jBImport.setText("Import"); jBImport.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBImportActionPerformed(evt); } }); jLabel45.setText("CNC/A max Feedrate:"); jBSCNCAFeedrate.setText("Change"); jBSCNCAFeedrate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSettingsActionPerformed(evt); } }); jLSCNCAFeedrate.setText("Settings Text"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel39) .addComponent(jLabel2) .addComponent(jLabel19) .addComponent(jLabel20) .addComponent(jLabel32) .addComponent(jLabel35) .addComponent(jLabel36) .addComponent(jLabel33) .addComponent(jLabel34) .addComponent(jLabel21) .addComponent(jLabel37) .addComponent(jLabel38) .addComponent(jLabel41) .addComponent(jLabel40) .addComponent(jLabel42)) .addGap(50, 50, 50) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jBSWorkSpace) .addComponent(jBSFastFeedrate) .addComponent(jBSHoming) .addComponent(jBSCNCStart) .addComponent(jBSCNCToolChange) .addComponent(jBSCNCSpindleON) .addComponent(jBSCNCSpindleOFF) .addComponent(jBSCNCG0Feedrate) .addComponent(jBSCNCToolSize) .addComponent(jBSCNCOptimiserTime) .addComponent(jBSALOptions) .addComponent(jBSALDistance) .addComponent(jBSALStart) .addComponent(jBSARC) .addComponent(jBSBacklash) .addComponent(jBSmodal) .addComponent(jBSComType) .addComponent(jBSCBack) .addComponent(jBSCGrid) .addComponent(jBSCGridDis) .addComponent(jBSCG0) .addComponent(jBSCG1) .addComponent(jBSCNCAFeedrate) .addComponent(jBSCStreamAhead))) .addComponent(jLabel44) .addGroup(layout.createSequentialGroup() .addComponent(jBexport) .addGap(18, 18, 18) .addComponent(jBImport)) .addComponent(jLabel46) .addComponent(jLabel49) .addComponent(jLabel50) .addComponent(jLabel47) .addComponent(jLabel48) .addComponent(jLabel45) .addComponent(jLabel51)) .addGap(50, 50, 50) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLSCNCAFeedrate) .addComponent(jLSCNCG0Feedrate))) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(jLabel43)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCG1)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCG0)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCGridDis)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCGrid)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSComType)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSmodal)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSBacklash)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSARC)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSALStart)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSALDistance)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSALOptions)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCNCOptimiserTime)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCNCToolSize)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCNCSpindleOFF)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCNCSpindleON)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCNCToolChange)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSCNCStart)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSWorkSpace)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSFastFeedrate)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addComponent(jLSHomeing)) .addGroup(layout.createSequentialGroup() .addGap(312, 312, 312) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLSCStreamAhead) .addComponent(jLSCBack)))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jBSHoming) .addComponent(jLabel2) .addComponent(jLSHomeing)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel19) .addComponent(jBSFastFeedrate) .addComponent(jLSFastFeedrate)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel20) .addComponent(jBSWorkSpace) .addComponent(jLSWorkSpace)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel21) .addComponent(jBSCNCStart) .addComponent(jLSCNCStart)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel32) .addComponent(jBSCNCToolChange) .addComponent(jLSCNCToolChange)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel35) .addComponent(jBSCNCSpindleON) .addComponent(jLSCNCSpindleON)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel36) .addComponent(jBSCNCSpindleOFF) .addComponent(jLSCNCSpindleOFF)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel33) .addComponent(jBSCNCG0Feedrate) .addComponent(jLSCNCG0Feedrate)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel45) .addComponent(jBSCNCAFeedrate) .addComponent(jLSCNCAFeedrate)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel34) .addComponent(jBSCNCToolSize) .addComponent(jLSCNCToolSize)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel39) .addComponent(jBSCNCOptimiserTime) .addComponent(jLSCNCOptimiserTime)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel37) .addComponent(jBSALOptions) .addComponent(jLSALOptions)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jBSALDistance) .addComponent(jLSALDistance) .addComponent(jLabel41)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel38) .addComponent(jLSALStart) .addComponent(jBSALStart)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel40) .addComponent(jLSARC) .addComponent(jBSARC)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel42) .addComponent(jLSBacklash) .addComponent(jBSBacklash)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel43) .addComponent(jLSmodal) .addComponent(jBSmodal)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel44) .addComponent(jBSComType) .addComponent(jLSComType)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel51) .addComponent(jBSCStreamAhead) .addComponent(jLSCStreamAhead)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel46) .addComponent(jBSCBack) .addComponent(jLSCBack)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel49) .addComponent(jBSCGrid) .addComponent(jLSCGrid)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel50) .addComponent(jBSCGridDis) .addComponent(jLSCGridDis)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel47) .addComponent(jBSCG0) .addComponent(jLSCG0)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel48) .addComponent(jBSCG1) .addComponent(jLSCG1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jBexport) .addComponent(jBImport)) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents private void jBSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSettingsActionPerformed //HOMING if(evt.getSource() == jBSHoming) { JSettingsDialog.SEnum<DatabaseV2.EHoming> setting= new JSettingsDialog.SEnum<>("Select homing corner",DatabaseV2.EHoming.get()); if(JSettingsDialog.showSettingsDialog("Homing",setting)) { setting.getValue().set(); } } //MAXFEEDRATE if(evt.getSource() == jBSFastFeedrate) { JSettingsDialog.SDouble setting= new JSettingsDialog.SDouble("Set the feedrate for the fast move:", DatabaseV2.MAXFEEDRATE.getsaved()); setting.setDmin(Double.MIN_VALUE); if(JSettingsDialog.showSettingsDialog("Feedrate",setting)) { DatabaseV2.MAXFEEDRATE.set(setting.getText()); } } //WORKINGSPACE if(evt.getSource() == jBSWorkSpace) { JSettingsDialog.SDouble[] settings= new JSettingsDialog.SDouble[3]; for(int i = 0; i < 3;i++ ) { settings[i]= new JSettingsDialog.SDouble("Set Size for the " + CommandParsing.axesName[i] + " axis:", DatabaseV2.getWorkspace(i).getsaved()); settings[i].setDmin(Double.MIN_VALUE); } if(JSettingsDialog.showSettingsDialog("Size of Workingspace",settings)) { for(int i = 0; i < 3;i++ ) { DatabaseV2.getWorkspace(i).set(settings[i].getText()); } } } //StartCode if(evt.getSource() == jBSCNCStart) { JSettingsDialog.STextArea setting= new JSettingsDialog.STextArea("Enter the command that will be executed when milling starts:", DatabaseV2.STARTCODE.get()); if(JSettingsDialog.showSettingsDialog("Commands",setting)) { DatabaseV2.STARTCODE.set(setting.getText()); } } //Toolchange if(evt.getSource() == jBSCNCToolChange) { JSettingsDialog.STextArea setting= new JSettingsDialog.STextArea("Enter the command to change the tool: \nHint: '?' will be replaced with the tool number", DatabaseV2.TOOLCHANGE.get()); if(JSettingsDialog.showSettingsDialog("Tool change:",setting)) { DatabaseV2.TOOLCHANGE.set(setting.getText()); } } //Spindle ON if(evt.getSource() == jBSCNCSpindleON) { JSettingsDialog.STextArea setting= new JSettingsDialog.STextArea("Enter the command to turn the spindle on: \nHint: '?' will be replaced with the original command number!", DatabaseV2.SPINDLEON.get()); if(JSettingsDialog.showSettingsDialog("Spindle ON:",setting)) { DatabaseV2.SPINDLEON.set(setting.getText()); } } //Spindle OFF if(evt.getSource() == jBSCNCSpindleOFF) { JSettingsDialog.STextArea setting= new JSettingsDialog.STextArea("Enter the command to turn the spindle off: \n", DatabaseV2.SPINDLEOFF.get()); if(JSettingsDialog.showSettingsDialog("Spindle OFF:",setting)) { DatabaseV2.SPINDLEOFF.set(setting.getText()); } } //G0Feedrate if(evt.getSource() == jBSCNCG0Feedrate) { JSettingsDialog.SDouble setting= new JSettingsDialog.SDouble("Set the feedrate for the G0 move:", DatabaseV2.GOFEEDRATE.getsaved()); setting.setDmin(Double.MIN_VALUE); if(JSettingsDialog.showSettingsDialog("Feedrate",setting)) { DatabaseV2.GOFEEDRATE.set(setting.getText()); } } //AFeedrate if(evt.getSource() == jBSCNCAFeedrate) { JSettingsDialog.SDouble setting= new JSettingsDialog.SDouble("Set the feedrate for the G0 move:", DatabaseV2.AFEEDRATE.getsaved()); setting.setDmin(Double.MIN_VALUE); if(JSettingsDialog.showSettingsDialog("Feedrate",setting)) { DatabaseV2.AFEEDRATE.set(setting.getText()); } } //Tooldiameter if(evt.getSource() == jBSCNCToolSize) { JSettingsDialog.SDouble setting= new JSettingsDialog.SDouble("Set the toolsize for CNC milling simulation:", DatabaseV2.TOOLSIZE.getsaved()); setting.setDmin(Double.MIN_VALUE); if(JSettingsDialog.showSettingsDialog("Setting",setting)) { DatabaseV2.TOOLSIZE.set(setting.getText()); } } //Optimiser Timeout if(evt.getSource() == jBSCNCOptimiserTime) { JSettingsDialog.SDouble setting= new JSettingsDialog.SDouble("Set the timeout in seconds for optimizing:", DatabaseV2.OPTIMISATIONTIMEOUT.getsaved()); setting.setDmin(Double.MIN_VALUE); if(JSettingsDialog.showSettingsDialog("Setting",setting)) { DatabaseV2.OPTIMISATIONTIMEOUT.set(setting.getText()); } } //AL Options if(evt.getSource() == jBSALOptions) { JSettingsDialog.Setting[] settings= new JSettingsDialog.Setting[6]; JSettingsDialog.SDouble dsetting; settings[0]= new JSettingsDialog.SDouble("The absolute position where the Autoleveling is correcting. \nSo after level correction, this Z value will have the probed value. (Normally it is 0)", DatabaseV2.ALZERO.getsaved()); dsetting= new JSettingsDialog.SDouble("How deep the system tries to probe. (You should home your system before Autoleveling.) \nIn absolute position it is \"Zero height\" - this value.", DatabaseV2.ALMAXPROBDEPTH.getsaved()); dsetting.setDmin(-1.0); dsetting.setDmax(DatabaseV2.WORKSPACE2.getsaved()); settings[1]=dsetting; dsetting= new JSettingsDialog.SDouble("Absolute height where the CNC can move safely without problems. \nThe first probing will also start from this position!", DatabaseV2.ALSAVEHEIGHT.getsaved()); dsetting.setDmin(-DatabaseV2.WORKSPACE2.getsaved()); dsetting.setDmax(DatabaseV2.WORKSPACE2.getsaved()); settings[2]=dsetting; dsetting= new JSettingsDialog.SDouble("The clearance to the object between two probes.", DatabaseV2.ALCLEARANCE.getsaved()); dsetting.setDmin(0.0); dsetting.setDmax(DatabaseV2.WORKSPACE2.getsaved()); settings[3]=dsetting; dsetting= new JSettingsDialog.SDouble("The feedrate used for the probing", DatabaseV2.ALFEEDRATE.getsaved()); dsetting.setDmin(0.0); settings[4]=dsetting; settings[5] = new JSettingsDialog.SEnum<>("Use interpolation if our point is outside the probed area:",DatabaseV2.EOnOff.get(DatabaseV2.ALUSEOUTSIDEPROBEAREA)); if(JSettingsDialog.showSettingsDialog("Auto leveling settings", settings)) { DatabaseV2.ALZERO.set(settings[0].getText()); DatabaseV2.ALMAXPROBDEPTH.set(settings[1].getText()); DatabaseV2.ALSAVEHEIGHT.set(settings[2].getText()); DatabaseV2.ALCLEARANCE.set(settings[3].getText()); DatabaseV2.ALFEEDRATE.set(settings[4].getText()); DatabaseV2.ALUSEOUTSIDEPROBEAREA.set(settings[5].getText()); } } //AL Distance if(evt.getSource() == jBSALDistance) { JSettingsDialog.SDouble[] settings= new JSettingsDialog.SDouble[2]; settings[0]= new JSettingsDialog.SDouble("The maximum distance between two probs", DatabaseV2.ALDISTANCE.getsaved()); settings[0].setDmin(Double.MIN_VALUE); settings[1]= new JSettingsDialog.SDouble("The maximum Length of a XY move before it gets split", DatabaseV2.ALMAXMOVELENGTH.getsaved()); settings[1].setDmin( Double.MIN_VALUE); if(JSettingsDialog.showSettingsDialog("Workspace size", settings)) { DatabaseV2.ALDISTANCE.set(settings[0].getText()); DatabaseV2.ALMAXMOVELENGTH.set(settings[1].getText()); } } //AutoLavel StartCode if(evt.getSource( )== jBSALStart) { JSettingsDialog.STextArea setting= new JSettingsDialog.STextArea("Enter the commands that will be executed when autoleveling starts:", DatabaseV2.ALSTARTCODE.get()); if(JSettingsDialog.showSettingsDialog("Tool change:",setting)) { DatabaseV2.ALSTARTCODE.set(setting.getText()); } } //ARC if(evt.getSource() == jBSARC) { JSettingsDialog.SDouble setting= new JSettingsDialog.SDouble("Set the maximum segment length for ARC to linear move conversion \n The lower the value the more communication is needed:", DatabaseV2.ARCSEGMENTLENGTH.getsaved()); setting.setDmin(Double.MIN_VALUE); if(JSettingsDialog.showSettingsDialog("Setting",setting)) { DatabaseV2.ARCSEGMENTLENGTH.set(setting.getText()); } } //Backlash if(evt.getSource() == jBSBacklash) { JSettingsDialog.SDouble[] settings= new JSettingsDialog.SDouble[3]; for(int i = 0; i < 3;i++ ) { settings[i]= new JSettingsDialog.SDouble("Set the backlash for the " + CommandParsing.axesName[i] + " axis:", DatabaseV2.getBacklash(i).getsaved()); settings[i].setDmin(0.0); } if(JSettingsDialog.showSettingsDialog("Backlash Correction",settings)) { for(int i = 0; i < 3;i++ ) { DatabaseV2.getBacklash(i).set(settings[i].getText()); } } } //Modal if(evt.getSource() == jBSmodal) { JSettingsDialog.SEnum<DatabaseV2.EOnOff> settingG1= new JSettingsDialog.SEnum<>("Select G1 modal mode:",DatabaseV2.EOnOff.get(DatabaseV2.G1MODAL)); JSettingsDialog.SEnum<DatabaseV2.EOnOff> settingG0= new JSettingsDialog.SEnum<>("Select G0 modal mode:",DatabaseV2.EOnOff.get(DatabaseV2.G0MODAL)); if(JSettingsDialog.showSettingsDialog("Allow Modal:",new JSettingsDialog.Setting[]{settingG1,settingG0})) { settingG1.getValue().set(DatabaseV2.G1MODAL); settingG0.getValue().set(DatabaseV2.G0MODAL); } } //ComType if(evt.getSource() == jBSComType) { int options = JOptionPane.showOptionDialog(this, "Select type of communication", "Device Type", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE, null, Communication.values(), 0); if(options != JOptionPane.CLOSED_OPTION) { DatabaseV2.COMTYPE.set(Communication.values()[options].toString()); } } //CStreamAhead if(evt.getSource() == jBSCStreamAhead) { JSettingsDialog.SEnum<DatabaseV2.EOnOff> setting= new JSettingsDialog.SEnum<>("Stream 3 commands ahead:",DatabaseV2.EOnOff.get(DatabaseV2.G1MODAL)); if(JSettingsDialog.showSettingsDialog("Stream ahead:",new JSettingsDialog.Setting[]{setting})) { setting.getValue().set(DatabaseV2.CSTREAMAHEAD); } } //Colors if(evt.getSource() == jBSCBack) { Color c=JColorChooser.showDialog(this, "Set the background color for the visualisation", new Color(Integer.parseInt(DatabaseV2.CBACKGROUND.get()))); if(c!=null) DatabaseV2.CBACKGROUND.set(""+c.getRGB()); } if(evt.getSource() == jBSCGrid) { Color c=JColorChooser.showDialog(this, "Set the background color for the visualisation", new Color(Integer.parseInt(DatabaseV2.CGRID.get()))); if(c!=null) DatabaseV2.CGRID.set(""+c.getRGB()); } if(evt.getSource() == jBSCGridDis) { JSettingsDialog.SDouble setting= new JSettingsDialog.SDouble("Set the distace for the Grid (0==off):", DatabaseV2.CGRIDDISTANCE.getsaved()); setting.setDmin(0.0); if(JSettingsDialog.showSettingsDialog("Setting",setting)) { DatabaseV2.CGRIDDISTANCE.set(setting.getText()); } } if(evt.getSource() == jBSCG0) { Color c=JColorChooser.showDialog(this, "Set the color for G0", new Color(Integer.parseInt(DatabaseV2.CG0.get()))); if(c!=null) DatabaseV2.CG0.set(""+c.getRGB()); } if(evt.getSource() == jBSCG1) { Color c=JColorChooser.showDialog(this, "Set the color for G1", new Color(Integer.parseInt(DatabaseV2.CG1.get()))); if(c!=null) DatabaseV2.CG1.set(""+c.getRGB()); } fireupdateGUI(); }//GEN-LAST:event_jBSettingsActionPerformed private void jBexportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBexportActionPerformed JFileChooser fc = DatabaseV2.getFileChooser(); fc.setFileFilter(new FileFilter() { @Override public boolean accept(File f) { return f.getName().toLowerCase().endsWith(".ois")||f.isDirectory(); } @Override public String getDescription() { return "Settings files (*.ois)"; } }); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setMultiSelectionEnabled(false); if(fc.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) { return; } File f = fc.getSelectedFile(); if(f.getName().lastIndexOf('.') == -1) { f = new File(f.getPath()+".ois"); } if(DatabaseV2.save(f) == false) { JOptionPane.showMessageDialog(this, "Cannot export Settings!"); } }//GEN-LAST:event_jBexportActionPerformed private void jBImportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBImportActionPerformed JFileChooser fc = DatabaseV2.getFileChooser(); fc.setFileFilter(new FileFilter() { @Override public boolean accept(File f) { return f.getName().toLowerCase().endsWith(".ois")||f.isDirectory(); } @Override public String getDescription() { return "Settings files (*.ois)"; } }); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setMultiSelectionEnabled(false); if(fc.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) { return; } if(DatabaseV2.load(fc.getSelectedFile()) == false) { JOptionPane.showMessageDialog(this, "Cannot import settings!"); } fireupdateGUI(); }//GEN-LAST:event_jBImportActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jBImport; private javax.swing.JButton jBSALDistance; private javax.swing.JButton jBSALOptions; private javax.swing.JButton jBSALStart; private javax.swing.JButton jBSARC; private javax.swing.JButton jBSBacklash; private javax.swing.JButton jBSCBack; private javax.swing.JButton jBSCG0; private javax.swing.JButton jBSCG1; private javax.swing.JButton jBSCGrid; private javax.swing.JButton jBSCGridDis; private javax.swing.JButton jBSCNCAFeedrate; private javax.swing.JButton jBSCNCG0Feedrate; private javax.swing.JButton jBSCNCOptimiserTime; private javax.swing.JButton jBSCNCSpindleOFF; private javax.swing.JButton jBSCNCSpindleON; private javax.swing.JButton jBSCNCStart; private javax.swing.JButton jBSCNCToolChange; private javax.swing.JButton jBSCNCToolSize; private javax.swing.JButton jBSCStreamAhead; private javax.swing.JButton jBSComType; private javax.swing.JButton jBSFastFeedrate; private javax.swing.JButton jBSHoming; private javax.swing.JButton jBSWorkSpace; private javax.swing.JButton jBSmodal; private javax.swing.JButton jBexport; private javax.swing.JLabel jLSALDistance; private javax.swing.JLabel jLSALOptions; private javax.swing.JLabel jLSALStart; private javax.swing.JLabel jLSARC; private javax.swing.JLabel jLSBacklash; private javax.swing.JLabel jLSCBack; private javax.swing.JLabel jLSCG0; private javax.swing.JLabel jLSCG1; private javax.swing.JLabel jLSCGrid; private javax.swing.JLabel jLSCGridDis; private javax.swing.JLabel jLSCNCAFeedrate; private javax.swing.JLabel jLSCNCG0Feedrate; private javax.swing.JLabel jLSCNCOptimiserTime; private javax.swing.JLabel jLSCNCSpindleOFF; private javax.swing.JLabel jLSCNCSpindleON; private javax.swing.JLabel jLSCNCStart; private javax.swing.JLabel jLSCNCToolChange; private javax.swing.JLabel jLSCNCToolSize; private javax.swing.JLabel jLSCStreamAhead; private javax.swing.JLabel jLSComType; private javax.swing.JLabel jLSFastFeedrate; private javax.swing.JLabel jLSHomeing; private javax.swing.JLabel jLSWorkSpace; private javax.swing.JLabel jLSmodal; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel32; private javax.swing.JLabel jLabel33; private javax.swing.JLabel jLabel34; private javax.swing.JLabel jLabel35; private javax.swing.JLabel jLabel36; private javax.swing.JLabel jLabel37; private javax.swing.JLabel jLabel38; private javax.swing.JLabel jLabel39; private javax.swing.JLabel jLabel40; private javax.swing.JLabel jLabel41; private javax.swing.JLabel jLabel42; private javax.swing.JLabel jLabel43; private javax.swing.JLabel jLabel44; private javax.swing.JLabel jLabel45; private javax.swing.JLabel jLabel46; private javax.swing.JLabel jLabel47; private javax.swing.JLabel jLabel48; private javax.swing.JLabel jLabel49; private javax.swing.JLabel jLabel50; private javax.swing.JLabel jLabel51; // End of variables declaration//GEN-END:variables @Override public boolean isRunning() { return false; } }