Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Netbeans Java make it GUI

Posted on 2009-02-23
6
Medium Priority
?
395 Views
Last Modified: 2013-12-14
I am very new to programming, and ave been given a piece of code from a friend. It is just a simple database application. However some of the files (as shown in attachment picture) only have a source section and not a design section. I was wondering if there is any way that I can get it so that the it will display a editable GUI.

If any of this is not clear or you need more information, please do not hesitate tio ask

Regards

Liam
gui.JPG
0
Comment
Question by:liamrichards
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 23714645
0
 
LVL 92

Expert Comment

by:objects
ID: 23716224
be aware that not all classes need a GUI component
post me the details of the code you need and I'll have a look for you

0
 
LVL 1

Author Comment

by:liamrichards
ID: 23716401
There the section of the code that i want to be able to get edit the GUI that it goes to but am unable. PLease note i am VERY new to programming and just learning as I go, so any help would be appreciated

If you want i can send teh full version of the code. It all works fine, i just want to be be able to somehow edit the GUI part of the snippet posted
/*
 * NewEntry.java
 *
 * Created on February 21, 2009, 4:55 PM
 */
package desktopdatabaseapplication;
 
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
 
/**
 *
 * @author  Liam Richards
 */
public class EditEntry extends javax.swing.JFrame {
 
    /** Creates new form NewEntry */
    private String old_project_ref = "";
    public EditEntry(String project_ref) {
        initComponents();
        setTitle("Edit Database Entry");
        old_project_ref = project_ref;
        
        Connection connection = null;
        String url = "jdbc:odbc:commend";
        String username = "";
        String password = "";
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            connection = DriverManager.getConnection(url, username, password);
        } catch (ClassNotFoundException cnfex) {
            JOptionPane.showMessageDialog(null, "Driver Failed");
            System.exit(1);
        } catch (SQLException sqlex) {
            JOptionPane.showMessageDialog(null, "Unable To Connect");
            sqlex.printStackTrace();
        }
        try {
            Statement stmnt = connection.createStatement();
            ResultSet rs = stmnt.executeQuery("Select * From commend where project_ref='"+project_ref+"';");
            if (rs.next()) {
                project_refField.setText(rs.getString("project_ref"));
                project_nameField.setText(rs.getString("project_name"));
                sales_engineerTextField.setText(rs.getString("sales_engineer"));
                ge700TextField.setText(rs.getString("ge700"));
                ge200TextField.setText(rs.getString("ge200"));
                ge100TextField.setText(rs.getString("ge100"));
                slave_analogTextField.setText(rs.getString("slave_analog"));
                slave_digitalTextField.setText(rs.getString("slave_digital"));
                slave_ipTextField.setText(rs.getString("slave_ip"));
                master_analogTextField.setText(rs.getString("master_analog"));
                master_digitalTextField.setText(rs.getString("master_digital"));
                networkingTextField.setText(rs.getString("networking"));
                interface1TextField.setText(rs.getString("interface1"));
                comwinTextField.setText(rs.getString("comwin"));
                specialsTextField.setText(rs.getString("specials"));
                generalTextField.setText(rs.getString("general"));
                additionalTextField.setText(rs.getString("additional"));
            }
        } catch (SQLException sqle) {
            sqle.printStackTrace();
        }
        project_refField.setEditable(false);
    }
 
    /** 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">
    private void initComponents() {
 
        jLabel1 = new javax.swing.JLabel();
        project_refField = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        project_nameField = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        sales_engineerTextField = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        ge100TextField = new javax.swing.JTextField();
        ge200TextField = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        ge700TextField = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        slave_analogTextField = new javax.swing.JTextField();
        slave_digitalTextField = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        slave_ipTextField = new javax.swing.JTextField();
        master_analogTextField = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        master_digitalTextField = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        networkingTextField = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        interface1TextField = new javax.swing.JTextField();
        comwinTextField = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        specialsTextField = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        generalTextField = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        additionalTextField = new javax.swing.JTextField();
        saveButton = new javax.swing.JButton();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(700, 600));
        setName("Form"); // NOI18N
 
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopdatabaseapplication.DesktopDatabaseApplication.class).getContext().getResourceMap(NewEntry.class);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N
 
        project_refField.setText(resourceMap.getString("project_refField.text")); // NOI18N
        project_refField.setMinimumSize(new java.awt.Dimension(600, 20));
        project_refField.setName("project_refField"); // NOI18N
        project_refField.setPreferredSize(new java.awt.Dimension(500, 20));
 
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N
 
        project_nameField.setText(resourceMap.getString("project_nameField.text")); // NOI18N
        project_nameField.setName("project_nameField"); // NOI18N
        project_nameField.setPreferredSize(new java.awt.Dimension(600, 20));
 
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N
 
        sales_engineerTextField.setText(resourceMap.getString("sales_engineerTextField.text")); // NOI18N
        sales_engineerTextField.setName("sales_engineerTextField"); // NOI18N
 
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N
 
        ge100TextField.setText(resourceMap.getString("ge100TextField.text")); // NOI18N
        ge100TextField.setName("ge100TextField"); // NOI18N
 
        ge200TextField.setName("ge200TextField"); // NOI18N
 
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N
 
        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N
 
        ge700TextField.setName("ge700TextField"); // NOI18N
 
        jLabel7.setFont(resourceMap.getFont("jLabel7.font")); // NOI18N
        jLabel7.setText("Edit Database Entry"); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N
 
        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N
 
        slave_analogTextField.setName("slave_analogTextField"); // NOI18N
 
        slave_digitalTextField.setName("slave_digitalTextField"); // NOI18N
 
        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N
 
        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N
 
        slave_ipTextField.setName("slave_ipTextField"); // NOI18N
 
        master_analogTextField.setName("master_analogTextField"); // NOI18N
 
        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N
 
        master_digitalTextField.setName("master_digitalTextField"); // NOI18N
 
        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N
 
        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N
 
        networkingTextField.setName("networkingTextField"); // NOI18N
 
        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N
 
        interface1TextField.setName("interface1TextField"); // NOI18N
 
        comwinTextField.setName("comwinTextField"); // NOI18N
 
        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N
 
        specialsTextField.setName("specialsTextField"); // NOI18N
 
        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N
 
        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N
 
        generalTextField.setName("generalTextField"); // NOI18N
 
        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N
 
        additionalTextField.setName("additionalTextField"); // NOI18N
 
        saveButton.setText(resourceMap.getString("saveButton.text")); // NOI18N
        saveButton.setName("saveButton"); // NOI18N
        saveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveButtonActionPerformed(evt);
            }
        });
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(63, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10)
                    .addComponent(jLabel11)
                    .addComponent(jLabel12)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14)
                    .addComponent(jLabel15)
                    .addComponent(jLabel16)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3)
                    .addComponent(jLabel6)
                    .addComponent(jLabel2)
                    .addComponent(jLabel17)
                    .addComponent(jLabel18))
                .addGap(35, 35, 35)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(ge100TextField)
                    .addComponent(ge200TextField)
                    .addComponent(ge700TextField)
                    .addComponent(sales_engineerTextField)
                    .addComponent(project_nameField, javax.swing.GroupLayout.Alignment.TRAILING, 0, 0, Short.MAX_VALUE)
                    .addComponent(project_refField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 457, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(slave_analogTextField)
                    .addComponent(slave_digitalTextField)
                    .addComponent(slave_ipTextField)
                    .addComponent(master_analogTextField)
                    .addComponent(master_digitalTextField)
                    .addComponent(networkingTextField)
                    .addComponent(interface1TextField)
                    .addComponent(comwinTextField)
                    .addComponent(specialsTextField)
                    .addComponent(generalTextField)
                    .addComponent(additionalTextField))
                .addGap(51, 51, 51))
            .addGroup(layout.createSequentialGroup()
                .addGap(247, 247, 247)
                .addComponent(jLabel7)
                .addContainerGap(250, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addGap(306, 306, 306)
                .addComponent(saveButton)
                .addContainerGap(315, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(18, 18, 18)
                        .addComponent(project_refField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(project_nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(sales_engineerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ge700TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ge200TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addComponent(ge100TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel8)
                    .addComponent(slave_analogTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel9)
                    .addComponent(slave_digitalTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel10)
                    .addComponent(slave_ipTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel11)
                    .addComponent(master_analogTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel12)
                    .addComponent(master_digitalTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel13)
                    .addComponent(networkingTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel14)
                    .addComponent(interface1TextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel15)
                    .addComponent(comwinTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel16)
                    .addComponent(specialsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel17)
                    .addComponent(generalTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel18)
                    .addComponent(additionalTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(saveButton)
                .addGap(73, 73, 73))
        );
    }// </editor-fold>
 
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {
    Connection connection = null;
    String url = "jdbc:odbc:commend";
    String username = "";
    String password = "";
    
    String temp,project_ref,project_name,sales_engineer,networking,interface1,comwin,specials,general,additional;
    long ge700,ge200,ge100,slave_analog,slave_digital,slave_ip,master_analog,master_digital;
    
    ge100 = ge200 = ge700 = slave_analog = slave_digital = slave_ip = master_analog = master_digital = 0;
    project_ref = project_refField.getText();
    project_name = project_nameField.getText();
    sales_engineer = sales_engineerTextField.getText();
    networking = networkingTextField.getText();
    interface1 = interface1TextField.getText();
    comwin = comwinTextField.getText();
    specials = specialsTextField.getText();
    general = generalTextField.getText();
    additional = additionalTextField.getText();
    
    try {
        temp = ge700TextField.getText();
        ge700 = Integer.parseInt(temp);
    }catch(NumberFormatException exp) {
        JOptionPane.showMessageDialog(null, "Invalid ge700.Give a number.","Invalid number",JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    try {
        temp = ge200TextField.getText();
        ge200 = Integer.parseInt(temp);
    }catch(NumberFormatException exp) {
        JOptionPane.showMessageDialog(null, "Invalid ge200.Give a number.","Invalid number",JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    try {
        temp = ge100TextField.getText();
        ge100 = Integer.parseInt(temp);
    }catch(NumberFormatException exp) {
        JOptionPane.showMessageDialog(null, "Invalid ge100.Give a number.","Invalid number",JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    try {
        temp = slave_analogTextField.getText();
        slave_analog = Integer.parseInt(temp);
    }catch(NumberFormatException exp) {
        JOptionPane.showMessageDialog(null, "Invalid slave_analog.Give a number.","Invalid number",JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    try {
        temp = slave_digitalTextField.getText();
        slave_digital = Integer.parseInt(temp);
    }catch(NumberFormatException exp) {
        JOptionPane.showMessageDialog(null, "Invalid slave_digital.Give a number.","Invalid number",JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    try {
        temp = slave_ipTextField.getText();
        slave_ip = Integer.parseInt(temp);
    }catch(NumberFormatException exp) {
        JOptionPane.showMessageDialog(null, "Invalid slave_ip.Give a number.","Invalid number",JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    try {
        temp = master_analogTextField.getText();
        master_analog = Integer.parseInt(temp);
    }catch(NumberFormatException exp) {
        JOptionPane.showMessageDialog(null, "Invalid master_analog.Give a number.","Invalid number",JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    try {
        temp = master_digitalTextField.getText();
        master_digital = Integer.parseInt(temp);
    }catch(NumberFormatException exp) {
        JOptionPane.showMessageDialog(null, "Invalid master_digital.Give a number.","Invalid number",JOptionPane.ERROR_MESSAGE);
        return;
    }
    
    
    
    
    try {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        connection = DriverManager.getConnection(url, username, password);
    }catch (ClassNotFoundException cnfex) {
        JOptionPane.showMessageDialog(null, "Driver Failed");
        System.exit(1);
    } catch (SQLException sqlex) {
        JOptionPane.showMessageDialog(null, "Unable To Connect");
        sqlex.printStackTrace();
    }
    try {
        String query = "delete * from commend where project_ref = '" + old_project_ref +"';";
        Statement stmnt = connection.createStatement();
        boolean res = stmnt.execute(query);
        query = "insert into commend values('" + project_ref + "','" + project_name + "','" + sales_engineer + "'," 
                            + ge700 + "," + ge200 + "," + ge100 + "," + slave_analog + "," + slave_analog + "," + slave_ip
                            + "," + master_analog + "," + master_digital + ",'" + networking + "','" + interface1 + "','"
                            + comwin + "','" + specials + "','" + general + "','" + additional + "');";
        System.out.println("Query:"+query);
        
        res = stmnt.execute(query);
        JOptionPane.showMessageDialog(null, "The field has now been edited.");
        System.out.println("Successfull");
        
        
        
    }catch (SQLException sqlex) {
        JOptionPane.showMessageDialog(null, "Cannot insert entry.");
        sqlex.printStackTrace();
    } 
 
    this.dispose();
    
    
}
 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
 
            public void run() {
                new EditEntry("").setVisible(true);
            }
        });
    }
 
    // Variables declaration - do not modify
    private javax.swing.JTextField additionalTextField;
    private javax.swing.JTextField comwinTextField;
    private javax.swing.JTextField ge100TextField;
    private javax.swing.JTextField ge200TextField;
    private javax.swing.JTextField ge700TextField;
    private javax.swing.JTextField generalTextField;
    private javax.swing.JTextField interface1TextField;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    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.JTextField master_analogTextField;
    private javax.swing.JTextField master_digitalTextField;
    private javax.swing.JTextField networkingTextField;
    private javax.swing.JTextField project_nameField;
    private javax.swing.JTextField project_refField;
    private javax.swing.JTextField sales_engineerTextField;
    private javax.swing.JButton saveButton;
    private javax.swing.JTextField slave_analogTextField;
    private javax.swing.JTextField slave_digitalTextField;
    private javax.swing.JTextField slave_ipTextField;
    private javax.swing.JTextField specialsTextField;
    // End of variables declaration
}

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 23716438
probably not the best way to learn :)  We often find students taking on too much intiially and getting swamped. We have a lot more success with our students getting them to start with simpler problems and build on them.

Saying that, how exactly do u want to change that code?

0
 
LVL 1

Author Comment

by:liamrichards
ID: 23716492
Well i just want to be able to edit the graphical layout of that code. BUt like i said i might be pulling on strings here, because I'm an absolut beginner at code, the only way I managed to change previous pieces of code (the graphical side) was because netbeans gave the design feature to do so.

WIth this, when you click edit on teh application....it pulls up an old looking GUI that i thought i changed. If you would liek i could email it to you.. ( am unable to post a zip or rar as its says there some forbidden files.
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 23716620
you need to look at layout managers

http://java.sun.com/docs/books/tutorial/uiswing/layout/using.html

try some of the examples in the tutorial to see how they work

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month13 days, 11 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question