JTable  Edit Problem

Hi All
I dont want user to Edit the JTable..
How to do this ?
Thx in Advance
Vipin

you need to provide a readonly TableModel (isCellEditable has to return false)
Check this:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#data
Torsten

Similar Messages

  • Preventing JTree updates from uncompleted JTable edits

    Hello there!!
    I have an applet that displays an xml file in a JTree. Each node of the table represents specific elements of the xml file (some are not displayed by design). Also on the applet is a JTable that updates the displayed information depending on what node of the tree is clicked. The information displayed in the table includes names and values of attributes and names and values of xml elements not displayed in the JTree.
    I can edit values in the table and update that tree effectively, so that is not a problem.
    The problem I have is that if the user enters a value in the table, does not press enter and then clicks on another tree node, the entered value is copied into the new tree node. I would like to ignore all values if the user does not specifically press enter.
    I have seen some code examples in previous posts that partially work, but can't get the entered values to be totally ignored.
    I'm currently using the following code to handle the 'didn't press enter' bug.
            table.getEditorComponent().addFocusListener(
                    new java.awt.event.FocusListener(){
                public void focusGained(java.awt.event.FocusEvent e) {}
                public void focusLost(java.awt.event.FocusEvent e){
                    if ( table.getEditingRow() > -1 &&
                            table.getEditingColumn() > -1 ){
                        ((javax.swing.DefaultCellEditor)table.getCellEditor()).stopCellEditing();
            });So my question is: How do I prevent the value entered in the table cell from being copied to the newly clicked on tree node? Any assistance would be great.
    Thanks (even just for reading!)
    Simon
    PS. When are we going to see the back of the stupid censorship in this forum?

    Not too sure if this will help but here goes...
    Normally in a JTable, editing is automatically stopped when the enter key is pressed so there is no need to do anything special there. If you don't want editing to stop when the mouse is clicked elsewhere in the table, what you should do is call cancelEditing() instead of stopEditing() in your focusLost method.
    ;o)
    V.V.

  • JTable edited data doesn't appear in the same time

    Hi
    i have aserious problem JTable edited data doesn't appear in the same time imust tom minimize the frame and maximize it to see the table modified what is the reason?

    Quit multi-posting the same question every time. You asked this same question 3 hours ago:
    http://forum.java.sun.com/thread.jspa?threadID=729894
    The last time you posted the same question within two minutes of one another:
    http://forum.java.sun.com/thread.jspa?threadID=729202
    http://forum.java.sun.com/thread.jspa?threadID=729200
    Not only that, you never bother to reply to your postings to indicate whether the advice given was helpfully or not. This is commonly known as thanking people for the time spent helping your.
    Learn to use the forum correctly or you will be on your own in the future.

  • Font / text edit problem in photoshop CS6

    Hi there,
    I have a strange text edit problem in Photoshop CS6 running on Mavericks.
    Every time I use the text-tool in PS, write a sentence, mark it and change something like color, font size etc., the marked text vanishes.
    I have to "undo" the last step and the changed text appears again.
    Every time!
    I have a clean installed CS6 with no plugins and no other than system fonts installed.
    Everything on a new Mac Pro with OS X 10.9.5
    Any clues? Thanks.

    Do you have the latest updates for photoshop cs6?
    You can use Help>Updates from within photoshop cs6 to check if there are any available.
    Also, if you go to Help>System Info from within photoshop cs6, you can see the Photoshop Version in the top line.
    You should be on version 13.0.6
    See if turning off Dictation solves the issue.
    Go to System Preferences ---> Dictation and Speech -----> select OFF radio button .

  • Launch and edit problem from Dreamweaver to Fireworks

    > This message is in MIME format. Since your mail reader
    does not understand
    this format, some or all of this message may not be legible.
    --B_3266405159_588474
    Content-type: text/plain;
    charset="ISO-8859-1"
    Content-transfer-encoding: 8bit
    Hi
    Not sure if this is a Fireworks or Dreamweaver problem but
    here goes.
    I¹ve created a graphic in Fireworks CS3 on the Mac and
    Exported the HTML and
    related images. I open the HTML file in Dreamweaver CS3, all
    fine so far.
    Then I highlight the table and click the ŒEdit in
    Fireworks¹ button and it
    throws up a warning dialogue saying ŒCannot launch and
    edit. The Fireworks
    table could not be found in the HTML. Please export from
    Fireworks and
    re-import the HTML into Dreamweaver.¹
    What?!!
    I¹ve only just exported it from Fireworks! It¹s
    even got the Fireworks table
    code in the Code section, so what¹s going here?
    Has anyone else had this?
    Gaz
    --B_3266405159_588474
    Content-type: text/html;
    charset="ISO-8859-1"
    Content-transfer-encoding: quoted-printable
    <HTML>
    <HEAD>
    <TITLE>Launch and edit problem from Dreamweaver to
    Fireworks</TITLE>
    </HEAD>
    <BODY>
    <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN
    STYLE=3D'font-size:12.0px'>Hi<BR=
    >
    Not sure if this is a Fireworks or Dreamweaver problem but
    here goes.<BR>
    I&#8217;ve created a graphic in Fireworks CS3 on the Mac
    and Exported the H=
    TML and related images. I open the HTML file in Dreamweaver
    CS3, all fine so=
    far. Then I highlight the table and click the
    &#8216;Edit in Fireworks&#821=
    7; button and it throws up a warning dialogue saying
    &#8216;Cannot launch an=
    d edit. The Fireworks table could not be found in the HTML.
    Please export fr=
    om Fireworks and re-import the HTML into
    Dreamweaver.&#8217;<BR>
    What?!!<BR>
    I&#8217;ve only just exported it from Fireworks!
    It&#8217;s even got the Fi=
    reworks table code in the Code section, so what&#8217;s
    going here?<BR>
    <BR>
    Has anyone else had this?<BR>
    <BR>
    Gaz</SPAN></FONT>
    </BODY>
    </HTML>
    --B_3266405159_588474--

    > This message is in MIME format. Since your mail reader
    does not understand
    this format, some or all of this message may not be legible.
    --B_3266407908_747577
    Content-type: text/plain;
    charset="ISO-8859-1"
    Content-transfer-encoding: 8bit
    When you export the sliced graphics from Fireworks it places
    them into a
    table. In my instance the code says...
    <!-- fwtable fwsrc="Brands.png" fwpage="Page 1"
    fwbase="Brands.jpg"
    fwstyle="Dreamweaver" fwdocid = "325827661" fwnested="0"
    -->
    So it recognises Fireworks was the the graphics app and jumps
    back to it
    when you want to edit the image. Fireworks then displays (or
    should) a
    ŒDone¹ button over the window. You do your alts and
    press Done to update the
    HTML and graphics back in Dreamweaver automatically.
    That¹s the only table I was referring to Murray.
    On 4/7/07 3:02 pm, in article
    [email protected], "Murray
    *ACE*" <[email protected]> wrote:
    > Why would you be wanting to edit the table in a graphics
    editor, instead of
    > an HTML editor?
    --B_3266407908_747577
    Content-type: text/html;
    charset="ISO-8859-1"
    Content-transfer-encoding: quoted-printable
    <HTML>
    <HEAD>
    <TITLE>Re: Launch and edit problem from Dreamweaver to
    Fireworks</TITLE>
    </HEAD>
    <BODY>
    <FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN
    STYLE=3D'font-size:12.0px'>When =
    you export the sliced graphics from Fireworks it places them
    into a table. I=
    n my instance the code says...<BR>
    <BR>
    &lt;!-- fwtable fwsrc=3D&quot;Brands.png&quot;
    fwpage=3D&quot;Page 1&quot; fwba=
    se=3D&quot;Brands.jpg&quot;
    fwstyle=3D&quot;Dreamweaver&quot; fwdocid =3D &quot;32=
    5827661&quot; fwnested=3D&quot;0&quot;
    --&gt;<BR>
    <BR>
    So it recognises Fireworks was the the graphics app and jumps
    back to it wh=
    en you want to edit the image. Fireworks then displays (or
    should) a &#8216;=
    Done&#8217; button over the window. You do your alts and
    press Done to updat=
    e the HTML and graphics back in Dreamweaver
    automatically.<BR>
    That&#8217;s the only table I was referring to
    Murray.<BR>
    <BR>
    On 4/7/07 3:02 pm, in article
    [email protected], &quot;Murr=
    ay *ACE*&quot;
    &lt;[email protected]&gt; wrote:<BR>
    <BR>
    <FONT COLOR=3D"#0000FF">&gt; Why would you be
    wanting to edit the table in a =
    graphics editor, instead of <BR>
    &gt; an HTML editor?<BR>
    </FONT></SPAN></FONT>
    </BODY>
    </HTML>
    --B_3266407908_747577--

  • Premiere Pro 7.1 serious Multicam Editing problems

    Hello, I am posting here because the bug report I filed one week ago to Adobe didn't give a result -no response at all from the bug department.
    I have two serious Multicam Editing Problems.
    PC Configuration: Core i7950, Asus P6TD Deluxe, 12GB DDR3 1600MHZ, Quadro K4000, SSD for the system, Seagate Constellation 7200rpm for video editing.
    1. When multicam mode is on at the program monitor, I press play and the program doesn't respond at all. The timeline plays till the end and the program just doesn't let you do anything but wait until playback of the whole timeline is over. Then the program works again (no "not responding" message in Windows).
    2. Sometimes the waveform doesn't even appear at the multicam audio clip. I read in other forums that this problem is found specifically at Premiere Pro version 7.1 (October release).
    I would be grateful with your help.
    Thank you,
    Stavros Symeonidis

    The media is always a combination of HD .MOV (dSLR footage and .MTS (from my Sony Vg-30). However, I also tested it with .mpeg files created by "match sequence settings". GPU acceleration is always on, as I use nVidia Quadro K4000 with the latest drivers (331.82).
    I always create the multicam sequences manually and the problem occurs with any amount of camera angles.
    The problem was not solved by reinstaling Windows (7 and 8). In general, I have no other issue with my PC system, except from this specific one.
    It doesn't appear always, however it will definitely happen if you press twice or three times the letter L, to fast forward the preview of your Multicam Sequence.
    I remind you that this only happens when multicam monitor is toggled at the program monitor.
    Did all these help at all to even reproduce this situation?
    Thank you,
    Stavros Symeonidis

  • Make my JTable editable

    in mu Jtable when i click a cell and change the value inside, the JTable does NOT save the value, (when i come back to the Jtable i find the OLD value and not the new one),
    Please help me to make my JTable editable, so when i change the value in any cell this value is saved when i leave this cell...
    Thanks to any help

    >
    in my Jtable when i click a cell and change the value inside, the JTable does NOT save the value, Kindly show your code here...
    When i come back to the Jtable i find the OLD value and not the new one)you came back from where ? are you starting the application again or just switching between forms?
    Please help me to make my JTable editable, so when i change the value in any cell this value is saved when i leave this cell...Do u want to save values permanently ? and please share your code and let use know what exactly you wanna do.

  • How to set jtable editable?

    how to set jtable editable?

    Hi,
    Doubleclick on a particular cell to get the cellEditor for editing.
    Cheers :)
    Nagaraj

  • FC studio2 editing problems with western digital my book home for mac

    hi--bought a 1TB WD my book home for mac coupla years ago because it seemed like a good deal for so much space, and provided and eSATA hookup, too. Worked ok for a while. Now, with a growing Motion project that I bring into FC for overall color/levels/export adjustments, I'm getting a long-term beachball every time I try to do anything with it. Just did a complete reinstall of FC studio (after running Techtool pro 5 rebuild and optimizing files and volume), trashed the project and recreated it incase the file itself was corrupted, but the beachball keeps showing up once i try to get past a particular edit and play the file through -- something I haven't had problems with before. Have read this harddrive is a real POS/PIA for many because of its internal "sleep" setting and other weaknesses, and am thinking of cracking the drive out of its case and putting it into a plain eSATA/FireWire enclosure. Anybody else tried this or heard of it working? Money's a big issue right now (too many slow/no pay clients), so can't just run out and get a new drive and transfer w/out trying cheaper route first. Would appreciate feedback, cuz this is makin' me lose what little hair i got left!
    Message was edited by: jayvee56
    Message was edited by: jayvee56

    My question says: "Final Cut Studio 2 editing problems"; I formatted the drive for the mac when i bought it: journaled HFS+, Apple Partition Map; 2 partitions (and connected via eSATA); which has been working fine as is up till now. The sequence and settings are those in which I've worked on many projects for years with no problems up until now. I am also completely up-to-date with all my app and system updates. I did begin to wonder after posting if the reinstall might be the source of my problems, but it was the interminable beachball waits that prompted the reinstall in the first place.

  • Jtable's tablecell editing problem

    there are some jcomponets in a jframe(jtable, jtextfield, jbutton, eg.), i edit in a tablecell in the jtable first, then i click another tablecell , when the first tablecell's value i just edited has committed; but when i click on jtextfield (another jcomponent different from jtable ) instead of another tablecell , the editted value in the first tablecell isn't commited.
    how can i do if i want to commit the value in the first tablecell when i click on a jtextfield?

    i have found the answer ,
    table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

  • Pls Help :JTable Double Value Editing Problem

    hi friends
    as i am new to swings and Jtable pls help me if u can.
    in the code copied below when i start putting value into the Double column of JTable
    a ( .0 ) is appended at the end which is undesirable it should be like that only when the value is
    something like 22.99 and also i want to limit the double value's fractional part to be limited to 2 digits only.
    if this can be done in my Table model itself so that it will work everywhere i use this model
    Pls tell me what exactly do i need, a custom Cell Editor or Cell Renderer. and whether can i do it in the
    Table Model Defination class or whether i can only do it on the Jtable only.
    guys its so confusing.pls help
    if anyone can send a sample code for achieving this it would be of great help
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.text.*;
    public class TableProcessing extends JFrame implements TableModelListener
        JTable table;
        public TableProcessing()
            String[] columnNames = {"Item", "Quantity", "Price", "Cost"};
            Object[][] data =
                {"Bread", new Integer(1), new Double(1.11), new Double(1.11)},
                {"Milk", new Integer(1), new Double(2.22), new Double(2.22)},
                {"Tea", new Integer(1), new Double(3.33), new Double(3.33)},
                {"Cofee", new Integer(1), new Double(4.44), new Double(4.44)}
            DefaultTableModel model = new DefaultTableModel(data, columnNames);
            model.addTableModelListener( this );
            table = new JTable( model )
                //  Returning the Class of each column will allow different
                //  renderers to be used based on Class
                public Class getColumnClass(int column)
                    return getValueAt(0, column).getClass();
                //  The Cost is not editable
                public boolean isCellEditable(int row, int column)
                    if (column == 3)
                        return false;
                    else
                        return true;
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            JScrollPane scrollPane = new JScrollPane( table );
            getContentPane().add( scrollPane );
         *  The cost is recalculated whenever the quantity or price is changed
        public void tableChanged(TableModelEvent e)
            if (e.getType() == TableModelEvent.UPDATE)
                int row = e.getFirstRow();
                int column = e.getColumn();
                if (column == 1 || column == 2)
                    int    quantity = ((Integer)table.getValueAt(row, 1)).intValue();
                    double price = ((Double)table.getValueAt(row, 2)).doubleValue();
                    Double value = new Double(quantity * price);
                    table.setValueAt(value, row, 3);
        public static void main(String[] args)
            TableProcessing frame = new TableProcessing();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setLocationRelativeTo( null );
            frame.setVisible(true);
    }thank in advance
    jags

    No.
    But further to this try:
    public class MyCustomRenderer  extends javax.swing.table.DefaultTableCellRenderer
              private java.text.DecimalFormat FORMAT_DOUBLE;
              public MyCustomRenderer()
                      FORMAT_DOUBLE = new java.text.DecimalFormat("#, ##0.00");
              public java.awt.Component getTableCellRendererComponent(javax.swing.JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
                        //NB! you could also set foreground/background here to indicate positive/negative values...
                        if(value.getClass().equals(Double.class))//is this a double?
                                double d = ((Double)value).doubleValue();
                                d = (Double.isNaN(d)||Double.isInfinity(d))?0:d;
                                this.setText(FORMAT_DOUBLE.format(d));
                        else//not a double so let's toString() it...
                               this.setText(""+value);
    }then, using code pasted above, specify a new instance of this class as the default renderer in your
    table.....
    :)

  • JTable focus problems

    Hi,
    If anyone could help, that would be great. JTables are starting to drive me crazy.
    I have an editable JTable that I have created a CellEditor for. I found that if I am editing a cell and want to tab to the next cell, I have to hit the tab twice. I think it is because the focus was in the cell editor and it needs to get to the table. (If there's a solution to that problem, that would be helpful too).
    I got around that by adding a focus listener to the CellEditor which gives focus to the JTable whenever the CellEditor gains focus. (Does that make sense?) This way, hitting the tab once will move the selected cell. But now when I edit a cell, I don't see the cursor in the textfield becuase the table has focus and the cell editor doesn't anymore. The behavior is correct, but I need to be able to see the cursor. This is my current problem. Any ideas are greatly appreciated.
    Thanks!

    Hi all,
    1. For single key moment, use in the editor of all custom components the method
    public boolan isManagingFocus() {
    return true;
    2. For the immediate cursor on tab use swingutilities.invokelater....
    tblDetail
    .getColumnModel()
    .getSelectionModel()
    .addListSelectionListener(new javax.swing.event.ListSelectionListener() {
    public void valueChanged(javax.swing.event.ListSelectionEvent lse) {
    //Ignore extra messages.
    if (lse.getValueIsAdjusting())
    return;
    int iRow =
    tblDetail.getSelectedRow() >= 0
    ? tblDetail.getSelectedRow()
    : tblDetail.getEditingRow();
    switch (lsm.getMinSelectionIndex()) {
    case 0 :
    SwingUtilities.invokeLater(new FocusGrabber((JComponent) txtTranCode));
    getStatusBar().setStatusMsg1("Enter the Web Transaction Code.");
    if (iRow >= 0) {
    String sCode = (String) tblDetail.getValueAt(iRow, 3);
    if (sCode != null && !sCode.trim().equals("")) {
    txtTranCode.setText(sCode);
    } else {
    txtTranCode.setText("");
    break;
    thanx & regards,
    S.A.Radha.

  • JTable - JTextField (Problem in setClickCountToStart)

    Hi,
    I have a JTable and I am creating a text field using the following code...
    table.getColumn(columnNames[2]).setCellEditor(new DefaultCellEditor(new JTextField()));I am also using the following code so that I can start editing the field on single click.
    ( (DefaultCellEditor) table.getDefaultEditor(String.class)).setClickCountToStart(1); The problem is that it is not working (ie., i am not able to edit the field on single click, I am able to edit only on double click). Please help me.
    Thanks
    subbu

    I'm sure you've been asked for a SSCCE before. This question is no different. We can't tell what you are doing based on two lines of code.
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting

  • JTable header problem plz help me

    hi
    i want to insert JTable in JTextPane but I have two problems
    i can't do this so any help plz
    1- i want to insert table with header and allow the user to edit (write) on the table header when running the
    program
    2- i want to insert table without header but i want to make the table column still resizable

    hi
    i want to insert JTable in JTextPane but I have two problems
    i can't do this so any help plz
    1- i want to insert table with header and allow the user to edit (write) on the table header when running the
    program
    2- i want to insert table without header but i want to make the table column still resizable

  • JTable size problems due to layout/grid...how can I fix?

    This is my code. When the button "Modify Entries" is pressed, it shows a JTable that imports a file called, "entries.data". The items in this file can be read and saved using this program. The problem is that the table is so small when it first opens. How can I set all my buttons to the very bottom of the form and make the table take up more space at the top? It looks to me as if this layout is treating it with the same dimensions as the buttons'.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    import java.util.*;
    import java.io.*;
    public class CPT extends JPanel implements ActionListener
        protected JButton ModifyEntriesButton, ViewEntriesButton, SearchEntriesButton, SaveButton, BackButton;
        private final static String newline = "\n";
        private DefaultTableModel model;
        public CPT ()
            super (new GridLayout (10, 0));
            model = new PropertiesModel ("entries.data");
            ModifyEntriesButton = new JButton ("Modify Entries");
            ModifyEntriesButton.setVerticalTextPosition (AbstractButton.TOP);
            ModifyEntriesButton.setHorizontalTextPosition (AbstractButton.LEFT);
            ModifyEntriesButton.setToolTipText ("Click this button to modify database entries.");
            ModifyEntriesButton.setMnemonic (KeyEvent.VK_M);
            ModifyEntriesButton.setActionCommand ("ModifyEntries");
            ModifyEntriesButton.addActionListener (this);
            ViewEntriesButton = new JButton ("View Entries");
            ViewEntriesButton.setVerticalTextPosition (AbstractButton.CENTER);
            ViewEntriesButton.setHorizontalTextPosition (AbstractButton.LEFT);
            ViewEntriesButton.setToolTipText ("Click this button to add view all database entries.");
            ViewEntriesButton.setMnemonic (KeyEvent.VK_V);
            ViewEntriesButton.setActionCommand ("ViewEntries");
            ViewEntriesButton.addActionListener (this);
            SearchEntriesButton = new JButton ("Search Entries");
            SearchEntriesButton.setVerticalTextPosition (AbstractButton.BOTTOM);
            SearchEntriesButton.setHorizontalTextPosition (AbstractButton.LEFT);
            SearchEntriesButton.setToolTipText ("Click this button to search through all database entries.");
            SearchEntriesButton.setMnemonic (KeyEvent.VK_S);
            SearchEntriesButton.setActionCommand ("SearchEntries");
            SearchEntriesButton.addActionListener (this);
            SaveButton = new JButton ("Save");
            SaveButton.setVerticalTextPosition (AbstractButton.TOP);
            SaveButton.setHorizontalTextPosition (AbstractButton.RIGHT);
            SaveButton.setToolTipText ("Click this button to save database entries.");
            SaveButton.setMnemonic (KeyEvent.VK_S);
            SaveButton.setActionCommand ("Save");
            SaveButton.addActionListener (this);
            BackButton = new JButton ("Back");
            BackButton.setVerticalTextPosition (AbstractButton.BOTTOM);
            BackButton.setHorizontalTextPosition (AbstractButton.RIGHT);
            BackButton.setToolTipText ("Click this button to return to the main menu.");
            BackButton.setMnemonic (KeyEvent.VK_B);
            BackButton.setActionCommand ("Back");
            BackButton.addActionListener (this);
            add (ModifyEntriesButton);
            add (ViewEntriesButton);
            add (SearchEntriesButton);
        class PropertiesModel extends DefaultTableModel
            public PropertiesModel (String filename)
                addColumn ("Item Number");
                addColumn ("Description");
                addColumn ("Price");
                //Fill model with data from property file
                Properties props = readFile (filename);
                if (props != null)
                    Enumeration coll = props.keys ();
                    while (coll.hasMoreElements ())
                        String property = (String) coll.nextElement ();
                        String value = props.getProperty (property, "");
                        addRow (new Object[]
                            property, value
        private Properties readFile (String filename)
            try
                Properties props = new Properties ();
                props.load (new FileInputStream (filename));
                return props;
            catch (IOException ioe)
                return null;
        private boolean saveFile (String filename)
            try
                Properties props = new Properties ();
                for (int i = 0 ; i < model.getRowCount () ; i++)
                    props.put (model.getValueAt (i, 0), model.getValueAt (i, 1));
                props.store (new FileOutputStream (filename), null);
                return true;
            catch (IOException ioe)
                return false;
        public void actionPerformed (ActionEvent e)
            if ("ModifyEntries".equals (e.getActionCommand ()))
                removeAll ();
                add (new JScrollPane (new JTable (model)), BorderLayout.CENTER);
                add (SaveButton);
                add (BackButton);
                invalidate ();
                updateUI ();
            if ("ViewEntries".equals (e.getActionCommand ()))
                removeAll ();
                add (BackButton);
                invalidate ();
                updateUI ();
            if ("SearchEntries".equals (e.getActionCommand ()))
                removeAll ();
                add (BackButton);
                invalidate ();
                updateUI ();
            if ("Back".equals (e.getActionCommand ()))
                removeAll ();
                add (ModifyEntriesButton);
                add (ViewEntriesButton);
                add (SearchEntriesButton);
                invalidate ();
                updateUI ();
            if ("Save".equals (e.getActionCommand ()))
                if (saveFile ("entries.data"))
                    JOptionPane.showMessageDialog (null, "File saved successfully.");
                else
                    JOptionPane.showMessageDialog (null, "File could not be saved!");
        // Create the GUI and show it. For thread safety,
        // this method should be invoked from the
        // event-dispatching thread.
        private static void createAndShowGUI ()
            //Make sure we have nice window decorations.
            JFrame.setDefaultLookAndFeelDecorated (true);
            //Create and set up the window.
            JFrame frame = new JFrame ("Swisha Computer House");
            frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            JComponent newContentPane = new CPT ();
            newContentPane.setOpaque (true); //content panes must be opaque
            frame.setContentPane (newContentPane);
            //Display the window.
            frame.pack ();
            frame.setSize (300, 300);
            frame.setVisible (true);
        public static void main (String[] args)
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater (new Runnable ()
                public void run ()
                    createAndShowGUI ();
    }Hey, and if anyone knows how to get the first column's numbers from the file to show up in descending order (1 through to, say, 500), please let me know.
    Thank you for any help.

    It looks to me as if this layout is treating it with the same dimensions as the buttons'.Thats the way a GridLayout works.
    Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]How to Use Layout Managers. You can mix an match individual Layout Managers to get the effect desired.
    I would suggest you need to change your design. Your code for continually removing and adding components is not the best design. You should probably have a panel with all your buttons. Then you would have different panels for each of your sub functions. The display of these panels would be controlled by a Card Layout. The tutorial has working examples of this.
    You can't use a Properties file to save data from the table (at least not the way you are attempting to use it). I gave you a solution in your last posting.

Maybe you are looking for