/*
* Copyright (C) 2012 Vinu K.N
*
* 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 org.domainmath.gui.packages.datasmooth;
import java.awt.Desktop;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.domainmath.gui.MainFrame;
import org.domainmath.gui.about.AboutDlg;
import org.domainmath.gui.tools.plot.PlotOptionsDialog;
public class DataSmoothFrame extends javax.swing.JFrame {
public Image icon = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/domainmath/gui/resources/DomainMath.png"));
/**
* Creates new form DataSmoothFrame
*/
public DataSmoothFrame() {
setIconImage(icon);
initComponents();
setLocationRelativeTo(null);
}
/**
* 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() {
jSplitPane1 = new javax.swing.JSplitPane();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jLabel3 = new javax.swing.JLabel();
xDataField = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
yDataField = new javax.swing.JTextField();
runButton = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
jLabel5 = new javax.swing.JLabel();
dField = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
lambdaField = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
stdevField = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
gcvField = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
lgussField = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
xhatField = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
weightsField = new javax.swing.JTextField();
relativeCheckBox = new javax.swing.JCheckBox();
midpointCheckBox = new javax.swing.JCheckBox();
statusPanel2 = new org.domainmath.gui.StatusPanel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
exitItem = new javax.swing.JMenuItem();
helpMenu = new javax.swing.JMenu();
forumItem = new javax.swing.JMenuItem();
onlineHelpItem = new javax.swing.JMenuItem();
howToItem = new javax.swing.JMenuItem();
faqItem = new javax.swing.JMenuItem();
jSeparator14 = new javax.swing.JPopupMenu.Separator();
suggestionsItem = new javax.swing.JMenuItem();
reportBugItem = new javax.swing.JMenuItem();
feedBackItem = new javax.swing.JMenuItem();
jSeparator7 = new javax.swing.JPopupMenu.Separator();
AboutItem = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("regdatasmooth");
jSplitPane1.setDividerLocation(250);
jLabel1.setForeground(new java.awt.Color(0, 0, 255));
jLabel1.setText("Data");
jLabel3.setText("X Data:");
jLabel4.setText("Y Data:");
runButton.setText("Run");
runButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
runButtonActionPerformed(evt);
}
});
jButton1.setText("[mxn]");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("[mxn]");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(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()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(runButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(xDataField, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(yDataField)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton1)
.addComponent(jButton2))))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(xDataField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(yDataField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 287, Short.MAX_VALUE)
.addComponent(runButton)
.addContainerGap())
);
jSplitPane1.setLeftComponent(jPanel2);
jLabel2.setForeground(new java.awt.Color(0, 0, 255));
jLabel2.setText("Options");
jLabel5.setText("Smoothing Derivative:");
jLabel6.setText("Regularization Paramater:");
jLabel7.setText("Standard Deviation:");
jLabel8.setText("Generalized Cross-Validation:");
jLabel9.setText("Initial Value for Lambda:");
jLabel10.setText("Xhat:");
jLabel11.setText("Weights:");
relativeCheckBox.setText("Use relative differences for the goodnes of fit term");
midpointCheckBox.setText("Use the midpoint rule for the integration terms rather than a direct sum");
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()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 575, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(relativeCheckBox)
.addComponent(midpointCheckBox)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel8)
.addComponent(jLabel9)
.addComponent(jLabel10))
.addGap(181, 181, 181)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(xhatField, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
.addComponent(lgussField)
.addComponent(gcvField)
.addComponent(stdevField)
.addComponent(lambdaField)
.addComponent(dField)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel11)
.addGap(278, 278, 278)
.addComponent(weightsField)))))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(dField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(lambdaField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(stdevField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(gcvField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(lgussField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(xhatField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(weightsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(relativeCheckBox)
.addGap(7, 7, 7)
.addComponent(midpointCheckBox)
.addContainerGap(126, Short.MAX_VALUE))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {dField, gcvField, lambdaField, lgussField, stdevField, weightsField, xhatField});
jSplitPane1.setRightComponent(jPanel1);
getContentPane().add(jSplitPane1, java.awt.BorderLayout.CENTER);
getContentPane().add(statusPanel2, java.awt.BorderLayout.SOUTH);
jMenu1.setText("File");
exitItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK));
exitItem.setText("Exit");
exitItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitItemActionPerformed(evt);
}
});
jMenu1.add(exitItem);
jMenuBar1.add(jMenu1);
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/domainmath/gui/resources/DomainMath_en"); // NOI18N
helpMenu.setText(bundle.getString("helpMenu.name")); // NOI18N
forumItem.setText("Forum");
forumItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
forumItemActionPerformed(evt);
}
});
helpMenu.add(forumItem);
onlineHelpItem.setText("Help and Support");
onlineHelpItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
onlineHelpItemActionPerformed(evt);
}
});
helpMenu.add(onlineHelpItem);
howToItem.setText("How to...");
howToItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
howToItemActionPerformed(evt);
}
});
helpMenu.add(howToItem);
faqItem.setText("Online FAQ");
faqItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
faqItemActionPerformed(evt);
}
});
helpMenu.add(faqItem);
helpMenu.add(jSeparator14);
suggestionsItem.setText("Suggestions");
suggestionsItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
suggestionsItemActionPerformed(evt);
}
});
helpMenu.add(suggestionsItem);
reportBugItem.setText(bundle.getString("reportBugItem.name")); // NOI18N
reportBugItem.setToolTipText(bundle.getString("reportBugItem.tooltip")); // NOI18N
reportBugItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
reportBugItemActionPerformed(evt);
}
});
helpMenu.add(reportBugItem);
feedBackItem.setText(bundle.getString("yourFeedbackItem.name")); // NOI18N
feedBackItem.setToolTipText(bundle.getString("yourFeedbackItem.tooltip")); // NOI18N
feedBackItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
feedBackItemActionPerformed(evt);
}
});
helpMenu.add(feedBackItem);
helpMenu.add(jSeparator7);
AboutItem.setText(bundle.getString("aboutItem.name")); // NOI18N
AboutItem.setToolTipText(bundle.getString("aboutItem.tooltip")); // NOI18N
AboutItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
AboutItemActionPerformed(evt);
}
});
helpMenu.add(AboutItem);
jMenuBar1.add(helpMenu);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>//GEN-END:initComponents
private void exitItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitItemActionPerformed
dispose();
}//GEN-LAST:event_exitItemActionPerformed
private void runButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_runButtonActionPerformed
String xData = this.xDataField.getText();
String yData = this.yDataField.getText();
String d = this.dField.getText();
String lambda = this.lambdaField.getText();
String stdev = this.stdevField.getText();
String gcv = this.gcvField.getText();
String lguss = this.lgussField.getText();
String xhat = this.xhatField.getText();
String weights = this.weightsField.getText();
String optCmd ="";
String copy;
if(xData.equals("") || yData.equals("")) {
JOptionPane.showMessageDialog(this, "Data missing. ","Error" ,JOptionPane.ERROR_MESSAGE);
}
if(!d.equals("")) {
optCmd +=Character.toString('"')+"d"+Character.toString('"')+","+d;
}
if(!lambda.equals("")) {
optCmd +=","+Character.toString('"')+"lambda"+Character.toString('"')+","+lambda;
}
if(!stdev.equals("")) {
optCmd +=","+Character.toString('"')+"stdev"+Character.toString('"')+","+stdev;
}
if(!gcv.equals("")) {
optCmd +=","+Character.toString('"')+"gcv"+Character.toString('"')+","+gcv;
}
if(!lguss.equals("")) {
optCmd +=","+Character.toString('"')+"lguss"+Character.toString('"')+","+lguss;
}
if(!xhat.equals("")) {
optCmd +=","+Character.toString('"')+"xhat"+Character.toString('"')+","+xhat;
}
if(!weights.equals("")) {
optCmd +=","+Character.toString('"')+"weights"+Character.toString('"')+","+weights;
}
if(this.relativeCheckBox.isSelected()) {
optCmd +=","+Character.toString('"')+"relative"+Character.toString('"');
}
if(this.midpointCheckBox.isSelected()) {
optCmd +=","+Character.toString('"')+"midpointrule"+Character.toString('"');
}
if(optCmd.startsWith(",")) {
optCmd = optCmd.substring(1);
}
if(optCmd.endsWith(",") && (xData.equals("") || yData.equals(""))){
copy = optCmd.substring(1, (optCmd.length()-1));
MainFrame.octavePanel.eval( "[yh, lambda] = regdatasmooth ("+xData+","+yData+","+copy+");");
if(!xhat.equals("")) {
pltCmd(xData,yData,xhat);
}else{
pltCmd(xData,yData);
}
}else{
if( !(xData.equals("") || yData.equals(""))) {
if(!optCmd.equals("")) {
MainFrame.octavePanel.eval( "[yh, lambda] = regdatasmooth ("+xData+","+yData+","+optCmd+");");
if(!xhat.equals("")) {
pltCmd(xData,yData,xhat);
}else{
pltCmd(xData,yData);
}
}else {
MainFrame.octavePanel.eval( "[yh, lambda] = regdatasmooth ("+xData+","+yData+");");
if(!xhat.equals("")) {
pltCmd(xData,yData,xhat);
}else{
pltCmd(xData,yData);
}
}
}
}
}//GEN-LAST:event_runButtonActionPerformed
public void setPath(String path) {
try {
URI uri = new URI(path);
Desktop desktop=Desktop.getDesktop();
desktop.browse(uri);
} catch (URISyntaxException | IOException ex) {
}
}
private void forumItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_forumItemActionPerformed
setPath("http://domainmathide.freeforums.org/");
}//GEN-LAST:event_forumItemActionPerformed
private void onlineHelpItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onlineHelpItemActionPerformed
setPath("http://domainmathide.freeforums.org/help-and-support-f5.html");
}//GEN-LAST:event_onlineHelpItemActionPerformed
private void howToItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_howToItemActionPerformed
setPath("http://domainmathide.freeforums.org/how-to-f9.html");
}//GEN-LAST:event_howToItemActionPerformed
private void faqItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_faqItemActionPerformed
setPath("http://domainmathide.freeforums.org/faq-f8.html");
}//GEN-LAST:event_faqItemActionPerformed
private void suggestionsItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_suggestionsItemActionPerformed
setPath("http://domainmathide.freeforums.org/suggestions-f6.html");
}//GEN-LAST:event_suggestionsItemActionPerformed
private void reportBugItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reportBugItemActionPerformed
setPath("http://domainmathide.freeforums.org/bugs-f3.html");
}//GEN-LAST:event_reportBugItemActionPerformed
private void feedBackItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_feedBackItemActionPerformed
setPath("http://domainmathide.freeforums.org/feedback-f4.html");
}//GEN-LAST:event_feedBackItemActionPerformed
private void AboutItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AboutItemActionPerformed
AboutDlg aboutDlg = new AboutDlg(this,true);
aboutDlg.setLocationRelativeTo(this);
aboutDlg.setVisible(true);
}//GEN-LAST:event_AboutItemActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
String text = this.xDataField.getText();
this.xDataField.setText("["+createOctMtx(text)+"]");
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
String text = this.yDataField.getText();
this.yDataField.setText("["+createOctMtx(text)+"]");
}//GEN-LAST:event_jButton2ActionPerformed
private String createOctMtx(String text) {
String val = text.replaceAll("\t", ",");
return val.replaceAll(" ", ";");
}
private void pltCmd(String xData,String yData) {
PlotOptionsDialog plotOptionsDialog = new PlotOptionsDialog(this,true);
String x[] = {xData,"None"};
String y[]={yData,"'o'"};
String yh[] = {"yh","None"};
plotOptionsDialog.model.addRow(x);
plotOptionsDialog.model.addRow(y);
plotOptionsDialog.model.addRow(x);
plotOptionsDialog.model.addRow(yh);
plotOptionsDialog.setMore_cmd("legend('noisy','smoothed');grid on");
plotOptionsDialog.setLocationRelativeTo(this);
plotOptionsDialog.setVisible(true);
}
private void pltCmd(String xData,String yData,String xHat) {
PlotOptionsDialog plotOptionsDialog = new PlotOptionsDialog(this,true);
String x[] = {xData,"None"};
String y[]={yData,"'o'"};
String xh[] = {xHat,"None"};
String yh[] = {"yh","None"};
plotOptionsDialog.model.addRow(x);
plotOptionsDialog.model.addRow(y);
plotOptionsDialog.model.addRow(xh);
plotOptionsDialog.model.addRow(yh);
plotOptionsDialog.setLocationRelativeTo(this);
plotOptionsDialog.setVisible(true);
plotOptionsDialog.setMore_cmd("legend('noisy','smoothed');grid on");
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
}
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new DataSmoothFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JMenuItem AboutItem;
private javax.swing.JTextField dField;
private javax.swing.JMenuItem exitItem;
private javax.swing.JMenuItem faqItem;
private javax.swing.JMenuItem feedBackItem;
private javax.swing.JMenuItem forumItem;
private javax.swing.JTextField gcvField;
private javax.swing.JMenu helpMenu;
private javax.swing.JMenuItem howToItem;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JPopupMenu.Separator jSeparator14;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JPopupMenu.Separator jSeparator7;
private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JTextField lambdaField;
private javax.swing.JTextField lgussField;
private javax.swing.JCheckBox midpointCheckBox;
private javax.swing.JMenuItem onlineHelpItem;
private javax.swing.JCheckBox relativeCheckBox;
private javax.swing.JMenuItem reportBugItem;
private javax.swing.JButton runButton;
private org.domainmath.gui.StatusPanel statusPanel2;
private javax.swing.JTextField stdevField;
private javax.swing.JMenuItem suggestionsItem;
private javax.swing.JTextField weightsField;
private javax.swing.JTextField xDataField;
private javax.swing.JTextField xhatField;
private javax.swing.JTextField yDataField;
// End of variables declaration//GEN-END:variables
}