Java Resistor Database program
<p>I am a pretty new programmer in java, and am still a beginner. I am a lot better at electronic circuits, and need a little help on creating a program to store all of my resistors (and eventually other components) I have to a database so I can know the resistors I have. I am using JTable for the user interface editable table to store the values, but I am very stuck. I first want to know how to have buttons in the same frame as the table. One button will be for adding a new row (another resistor) and another button will be to save it to a file. I also want the column headers to be click-able to arrange the resistor by ohms and last i have 3 columns for resistance. One is ohms, one is k ohm and one is m ohm (1000 ohm = 1 k ohm, 1000 kilo ohm = 1 mega ohm) If the user inputs data for any of he 3 columns, I want the 2 others to auto-fill, so if 1 is entered on K ohm, .001 ohm, and 1000 M ohm.</p>

<p>Here is my code so far, it is not much of a start, but it has the basic table. Any information about how I can accomplish my code will be great.</p>

<pre><code>import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import java.io.*;
class Resistor
    extends     JFrame
 {
// Instance attributes used in this example
private JPanel      topPanel;
private JTable      table;
private JScrollPane scrollPane;
JButton jbnButton1, jbnButton2, jbnButton3;


    public Resistor()
{
    // Set the frame characteristics
    setTitle( "resistors" );
    setSize( 600, 200 );
    setBackground( Color.gray );
    setLocationRelativeTo(null);

    // Create a panel to hold all other components
    topPanel = new JPanel();
    topPanel.setLayout( new BorderLayout() );
    getContentPane().add( topPanel );

    // Create columns names
    String columnNames[] = { "Ω", "kΩ", "mΩ" ,"Tolerance", "qty","notes" };

    // Create some data
    String dataValues[][] =
    {
        { "", "", "","","","" }


    };



    table = new JTable( dataValues, columnNames );
      TableColumn eventColumn = table.getColumnModel().getColumn(5);
        eventColumn.setPreferredWidth(350);


    scrollPane = new JScrollPane( table );
    topPanel.add( scrollPane, BorderLayout.CENTER );
     table.setGridColor(Color.YELLOW);
            table.setBackground(Color.CYAN);
    }




public static void main( String args[] )
{


   Resistor mainFrame   = new Resistor();
    mainFrame.setVisible( true );


}
</code></pre>

<p>}</p>
