Please do check my so far code and consider my problem..
thank you..
There are three classes. Run NamesGUI.
package namelist;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
public class NameEditor extends javax.swing.JFrame {
/** Creates new form NameEditor */
public NameEditor() {
initComponents();
}
public NameEditor(String Name) {
initComponents();
NameField.setText(Name);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
}
/** 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.
*/
private void initComponents() {
NameLabel = new javax.swing.JLabel();
NameField = new javax.swing.JTextField();
SaveBut = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Name Editor");
getAccessibleContext().setAccessibleName("Name Editor");
NameLabel.setText("Name: ");
NameField.setEditable(false);
NameField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NameFieldActionPerformed(evt);
}
});
SaveBut.setText("SAVE");
SaveBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SaveButActionPerformed(evt);
}
});
jLabel3.setText("Height");
jLabel4.setText("Weight");
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jLabel4)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel3)
.add(NameLabel))
.add(16, 16, 16)))
.add(17, 17, 17)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 138, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, jTextField2)
.add(org.jdesktop.layout.GroupLayout.LEADING, jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE))))
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
.add(127, 127, 127)
.add(SaveBut)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(NameLabel)
.add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(30, 30, 30)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(12, 12, 12)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel4)
.add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE)
.add(SaveBut)
.addContainerGap())
);
pack();
}
private void SaveButActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void NameFieldActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NameEditor().setVisible(true);
}
});
}
// Variables declaration - do not modify
javax.swing.JTextField NameField;
javax.swing.JLabel NameLabel;
javax.swing.JButton SaveBut;
javax.swing.JLabel jLabel3;
javax.swing.JLabel jLabel4;
javax.swing.JTextField jTextField1;
javax.swing.JTextField jTextField2;
// End of variables declaration
}
public class NamesGUI extends javax.swing.JFrame {
//Variables for managing the jTables
DefaultTableModel tableModel;
Vector rows,cols;
String[] colName1 = {"List of Names"};
ManageJTables mJT = new ManageJTables();
/** Creates new form ProsAgentGUI */
public NamesGUI() {
initComponents();
}
/** 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.
*/
private void initComponents() {
Panel = new javax.swing.JPanel();
ToolBar = new javax.swing.JToolBar();
ADD = new javax.swing.JButton();
EDIT = new javax.swing.JButton();
REMOVE = new javax.swing.JButton();
TScrollPane = new javax.swing.JScrollPane();
Table = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Names");
setBackground(new java.awt.Color(0, 51, 51));
Panel.setBorder(javax.swing.BorderFactory.createTitledBorder("List of Names"));
ToolBar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
ADD.setText("ADD");
ADD.setToolTipText("");
ADD.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
ADD.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ADDActionPerformed(evt);
}
});
ToolBar.add(ADD);
EDIT.setText("EDIT");
EDIT.setToolTipText("");
EDIT.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
EDIT.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
EDITActionPerformed(evt);
}
});
ToolBar.add(EDIT);
REMOVE.setText("REMOVE");
REMOVE.setToolTipText("");
REMOVE.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
REMOVE.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
REMOVEActionPerformed(evt);
}
});
ToolBar.add(REMOVE);
rows=new Vector();
cols= new Vector();
cols=mJT.addColumns(colName1, cols);
tableModel =new DefaultTableModel();
tableModel.setDataVector(rows,cols);
Table.setModel(tableModel);
TScrollPane.setViewportView(Table);
org.jdesktop.layout.GroupLayout PanelLayout = new org.jdesktop.layout.GroupLayout(Panel);
Panel.setLayout(PanelLayout);
PanelLayout.setHorizontalGroup(
PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
.add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
);
PanelLayout.setVerticalGroup(
PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(PanelLayout.createSequentialGroup()
.add(ToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE))
);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(29, Short.MAX_VALUE)
.add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}
private void EDITActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
NameEditor re = new NameEditor(Table.getValueAt(Table.getSelectedRow(),0).toString());
re.setVisible(true);
}
private void REMOVEActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mJT.deleteRow(Table.getSelectedRow(), rows, Table);
}
private void ADDActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mJT.addRow(rows, Table);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NamesGUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
javax.swing.JButton ADD;
javax.swing.JButton EDIT;
javax.swing.JPanel Panel;
javax.swing.JButton REMOVE;
javax.swing.JScrollPane TScrollPane;
javax.swing.JTable Table;
javax.swing.JToolBar ToolBar;
// End of variables declaration
}
public class ManageJTables {
/** Creates a new instance of ManageJTables */
public ManageJTables() {
}
//add columns to a jTable
public Vector addColumns(String[] colName, Vector cols)//Table Columns
{
for(int i=0; i<colName.length; i++)
cols.addElement((String) colName[i]);
return cols;
}
//Add Row in a jTable
public void addRow(Vector rows, JTable t) //Add Row
{
Vector r=new Vector();
r=createBlankElement();
rows.addElement(r);
t.addNotify();
}
//new empty vector, it will be used as new row for the jTable
public Vector createBlankElement()
{
Vector t = new Vector();
t.addElement((String) " ");
t.addElement((String) " ");
return t;
}
//delete Row from a jTable
void deleteRow (int index, Vector rows, JTable t)
{
rows.removeElementAt(index);
t.addNotify();
}
}
>
I found it.. it was not so hard afterall..
anyway, i quote the new code..
package namelist;
// Java core packages
import java.awt.event.*;
import java.util.*;
// Java extension packages
import javax.swing.*;
import javax.swing.table.*;
public class NamesGUI extends javax.swing.JFrame {
//Variables for managing the jTables
DefaultTableModel tableModel;
Vector rows,cols;
String[] colName1 = {"List of Names"};
ManageJTables mJT = new ManageJTables();
Hashtable h;
/** Creates new form ProsAgentGUI */
public NamesGUI() {
h = new Hashtable();
initComponents();
}
/** 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.
*/
private void initComponents() {
Panel = new javax.swing.JPanel();
ToolBar = new javax.swing.JToolBar();
ADD = new javax.swing.JButton();
EDIT = new javax.swing.JButton();
REMOVE = new javax.swing.JButton();
jButton1 = new javax.swing.JButton();
TScrollPane = new javax.swing.JScrollPane();
Table = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Names");
setBackground(new java.awt.Color(0, 51, 51));
Panel.setBorder(javax.swing.BorderFactory.createTitledBorder("List of Names"));
ToolBar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
ADD.setText("ADD");
ADD.setToolTipText("");
ADD.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
ADD.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ADDActionPerformed(evt);
}
});
ToolBar.add(ADD);
EDIT.setText("EDIT");
EDIT.setToolTipText("");
EDIT.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
EDIT.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
EDITActionPerformed(evt);
}
});
ToolBar.add(EDIT);
REMOVE.setText("REMOVE");
REMOVE.setToolTipText("");
REMOVE.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
REMOVE.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
REMOVEActionPerformed(evt);
}
});
ToolBar.add(REMOVE);
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
ToolBar.add(jButton1);
rows=new Vector();
cols= new Vector();
cols=mJT.addColumns(colName1, cols);
tableModel =new DefaultTableModel();
tableModel.setDataVector(rows,cols);
Table.setModel(tableModel);
TScrollPane.setViewportView(Table);
org.jdesktop.layout.GroupLayout PanelLayout = new org.jdesktop.layout.GroupLayout(Panel);
Panel.setLayout(PanelLayout);
PanelLayout.setHorizontalGroup(
PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(ToolBar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
.add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
);
PanelLayout.setVerticalGroup(
PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(PanelLayout.createSequentialGroup()
.add(ToolBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 34, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(TScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.addContainerGap(29, Short.MAX_VALUE)
.add(Panel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.out.println(h.toString());
}
public void updateNamesTable (int id, String na){
Integer i2 = new Integer(id);
Object o2 = (Object)i2;
if (h.containsKey(o2)){
Name a = (Name)h.get(o2);
a.name = na;
h.put(o2,a);
}
else {
Name aa = new Name();
aa.name=na;
h.put(o2,(Object)aa);
}
}
private void EDITActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String name = Table.getValueAt(Table.getSelectedRow(),0).toString();
int rowNum= Table.getSelectedRow();
Integer i = new Integer(rowNum);
Object o = (Object)i;
updateNamesTable (rowNum, name);
//public NameEditor(Name n, Hashtable h, int id)
NameEditor re = new NameEditor((Name)h.get(o), h, rowNum );
re.setVisible(true);
}
private void REMOVEActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mJT.deleteRow(Table.getSelectedRow(), rows, Table);
}
private void ADDActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mJT.addRow(rows, Table);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NamesGUI().setVisible(true);
}
});
}
// Variables declaration - do not modify
javax.swing.JButton ADD;
javax.swing.JButton EDIT;
javax.swing.JPanel Panel;
javax.swing.JButton REMOVE;
javax.swing.JScrollPane TScrollPane;
javax.swing.JTable Table;
javax.swing.JToolBar ToolBar;
javax.swing.JButton jButton1;
// End of variables declaration
}
////////////////////////////////////////////////////////////////////////////////////
public class NameEditor extends javax.swing.JFrame {
Hashtable h;
Name n;
int id;
/** Creates new form NameEditor */
public NameEditor() {
initComponents();
}
public NameEditor(Name n, Hashtable h, int id) {
this.h=h;
this.n=n;
this.id=id;
initComponents();
NameField.setText(n.name);
jTextField2.setText(n.weight);
jTextField1.setText(n.height);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
}
/** 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.
*/
private void initComponents() {
NameLabel = new javax.swing.JLabel();
NameField = new javax.swing.JTextField();
SaveBut = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Name Editor");
getAccessibleContext().setAccessibleName("Name Editor");
NameLabel.setText("Name: ");
NameField.setEditable(false);
NameField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NameFieldActionPerformed(evt);
}
});
SaveBut.setText("SAVE");
SaveBut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SaveButActionPerformed(evt);
}
});
jLabel3.setText("Height");
jLabel4.setText("Weight");
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jLabel4)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel3)
.add(NameLabel))
.add(16, 16, 16)))
.add(17, 17, 17)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 138, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(org.jdesktop.layout.GroupLayout.LEADING, jTextField2)
.add(org.jdesktop.layout.GroupLayout.LEADING, jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE))))
.add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
.add(127, 127, 127)
.add(SaveBut)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(NameLabel)
.add(NameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(30, 30, 30)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(12, 12, 12)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel4)
.add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 27, Short.MAX_VALUE)
.add(SaveBut)
.addContainerGap())
);
pack();
}
public void updateNameTable (){
Integer i2 = new Integer(id);
Object o2 = (Object)i2;
h.put(o2,n);
}
private void SaveButActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
n.height= jTextField1.getText();
n.weight = jTextField2.getText();
}
private void NameFieldActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NameEditor().setVisible(true);
}
});
}
// Variables declaration - do not modify
javax.swing.JTextField NameField;
javax.swing.JLabel NameLabel;
javax.swing.JButton SaveBut;
javax.swing.JLabel jLabel3;
javax.swing.JLabel jLabel4;
javax.swing.JTextField jTextField1;
javax.swing.JTextField jTextField2;
// End of variables declaration
}