How can I add a row into a JTable with JButton

Hi all. I have the following code:
package gui;
import db.*;
import javax.swing.table.AbstractTableModel;
import java.util.ArrayList;
public class FoundersTable extends AbstractTableModel{
    private static final int COLUMNS = 8;
    private String columnNames[] = {"��� ����", "���", "�������", "�������", "���������", "��������",
            "����� �� ����������", "������ �� ����, �����"};
    private ArrayList data;
    public FoundersTable(){
        data = new ArrayList();
    public int getRowCount() {
        return data.size();
    public int getColumnCount() {
        return columnNames.length;
    public String getColumnName(int colIndex) {
        return columnNames[colIndex];
    public Object getValueAt(int rowIndex, int columnIndex) {
        return ((ArrayList)data.get(rowIndex)).get(columnIndex);
    public void setValueAt(Object value, int rowIndex, int columnIndex) {
        ((ArrayList)data.get(rowIndex)).set(columnIndex, value);
        fireTableCellUpdated(rowIndex, columnIndex);
    public void addRow(ArrayList neueZeile) {
        data.add(neueZeile);
        int index = data.size() - 1;
        fireTableRowsInserted(index, index);
    public void removeRow(int index) {
        data.remove(index);
        fireTableRowsDeleted(index, index);
    public void removeAllRows() {
        data.clear();
        fireTableRowsDeleted(0, 0);
    public boolean isCellEditable(int rowIndex, int columnIndex) {
        return true;
}Now in my MainJFrame class I have one button for additing and one button for removing a selected row. How can I add/remove rows with this two buttons.
Thanks

No my question is how can I add and remove rows WITH buttons My point was the code is the same. You use the addRow(...) method. Why did you write an addRow(...) method if you aren't going to use it?
I don't understand your problem. Do you not know how to write an ActionListener?

Similar Messages

  • How can I add 3ds Model into After Effects with animation and camera rotation?

    Hi all!
    I'm on my way to my final project of Multimedia Animation of my bachelor last year.
    I have good knowledge of After Effects & 3ds Max.
    I want to do a short movie with aliens being shot down.
    So, my question is: How can I import my 3ds model with the animation(keyframes) into After Effects AND rotate the whole character and it's animation as I move the camera?
    for example, having a alien being shot down at the same time I'm recording with the HD camera around, that means that I have to define planes and angles, the problem is that I'm not parenting the character correctly with the plane.

    Element doesn't do pre-anaimted objects, so that would be the limiting factor. Of course it could still be handy for otehr scene elements. On that note, using AtomKraft and exporting the model as an Alembic file with animation might also be something to look into...
    Mylenium

  • How can I add new row/column into existing jTable?

    Hi add!
    Can you help me how can I add new row/column into existing jTable?
    Tnx in adv!

    e.g
    Create two buttons inside the Table ( "Add New Row" ) and ("Add new Column")
    their handlers are:
    add new row:
    //i supose u already have
    DefaultTabelModel tablemodel = new DefaultTableModel(rowdata, columnNames);
    //and   
       JTabel jtable = new JTable(tablemodel);
    // Handler (row)
    jbtAddRow.addActionListener(new ActionListener(){
       public void actionPerformed(ActionEvent e) {
          if(jtable.getSelectedRow() >= 0 )
              tablemodel.insertRow(jtable.getSelectedRow(), new java.util.Vector());  
           else  
                tablemodel.addRow(new java.util.Vector());
        });to add new columns its the same but inside actionPerformed method:
    ask for e.g "Whats the name for the new column"
    then,
       tablemodel.addColumn(nameOfColumn, new java.util.Vector());   Joao
    Message was edited by:
    Java__Estudante

  • How can I add advertisement code into flash game?

    hi mates,
    just want to ask about loading advertisement code!
    How do you add the advertisement code (adsense) into flash games??
    my site Funny Games have over 5k games but they are getting from others sites thus I have no original files. How can I add more code into the current files?

    Unless the games were pre-made to allow you to specify some variables in the page code or some external file, you won't be having any luck... you cannot add code to the games unless you have the source files, which you apparently don't have.

  • How can i add Custom fields into the

    Dear Experts
    We have Ecc6.0 system,
    How can i add Custom fields into the Infotype Screen(PA30),i heard that we do it by PM01 Tcode.
    But in PM01 i am unable to find the enhance infotype tab.
    How can i do it ....pls help.....
    Regards
    Sajid

    Hi,
    Do it thru the third tab : Single Screen.
    There write down the infotype number (e.g. 0022) and say generate objects.
    Regards,
    Dilek

  • How can i add my components into dcomcnfg.exe?

    I have created a component a  out-process Server and  registered but I can't find it in
    dcomcnfg.exe.
    how can i add my components into dcomcnfg.exe?

    chenkuan,
    Sorry but you have posted to a forum that deals exclusively with questions/issues about customizing and programming Microsoft Project, a planning and scheduling application. I suggest you delete this post and find a forum appropriate for your issue.
    John

  • How can I display the rows into columns.

    How can I display the rows into columns. I mean
    Create table STYLE_M
    (Master varchar2(10), child varchar2(10));
    Insert itno style_m
    ('MASTER1','CHILD1');
    Insert itno style_m
    ('MASTER2','CHILD1');
    Insert itno style_m
    ('MASTER2','CHILD2');
    Insert itno style_m
    ('MASTER3','CHILD1');
    Insert itno style_m
    ('MASTER3','CHILD2');
    Insert itno style_m
    ('MASTER3','CHILD3');
    Note : The Master may have any number of childs.
    I want to display like this..
    Master child1, child2, child3, .......(dynamic)
    MASTER1 CHILD1
    MASTER2 CHILD1 CHILD2
    MASTER3 CHILD1 CHILD2 CHILD3
    Sorry for disturbing you. Please hlp me out if you have any slution.
    Thanks alot.
    Ram Dontineni

    Here's a straight SQL "non-dynamic" approach.
    This would be used if you knew the amount of children.
    SELECT
         master,
         MAX(DECODE(r, 1, child, NULL)) || ' ' || MAX(DECODE(r, 2, child, NULL)) || ' ' || MAX(DECODE(r, 3, child, NULL)) children
    FROM
         SELECT
              master,
              child,
              ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r
         FROM
              style_m
    GROUP BY
         master
    MASTER     CHILDREN                        
    MASTER1    CHILD1                          
    MASTER2    CHILD1 CHILD2                   
    MASTER3    CHILD1 CHILD2 CHILD3             Since you said that the number of children can vary, I incorporated the same logic into a dynamic query.
    SET AUTOPRINT ON
    VAR x REFCURSOR
    DECLARE
            v_sql           VARCHAR2(1000) := 'SELECT master, ';
            v_group_by      VARCHAR2(200)  := 'FROM (SELECT master, child,  ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r FROM style_m) GROUP BY master';
            v_count         PLS_INTEGER;
    BEGIN
            SELECT
                    MAX(COUNT(*))
            INTO    v_count
            FROM
                    style_m
            GROUP BY
                    master;
            FOR i IN 1..v_count
            LOOP
                    v_sql := v_sql || 'MAX(DECODE(r, ' || i || ', child, NULL))' || ' || '' '' || ';
            END LOOP;
                    v_sql := RTRIM(v_sql, ' || '' '' ||') ||' children ' || v_group_by;
                    OPEN :x FOR v_sql;
    END;
    PL/SQL procedure successfully completed.
    MASTER     CHILDREN
    MASTER1    CHILD1
    MASTER2    CHILD1 CHILD2
    MASTER3    CHILD1 CHILD2 CHILD3I'll point your other thread to this one.

  • HT204655 How can I add gps information into my pictures?

    How can I add gps information into my pictures?
    I understand Photos doens't have this feature.
    Só how could I do it with an external application. Is it possible? Can I even use iPhoto with the same library (since they share stuff) to do it?

    Photos does not support to add location information yet.
    Add the GPS before you import the photos to Photos. I hope this will change with the next release.
    You could ,for example, first import to iPhoto, add the locations, batch change the titles and captions, do all the things that are not yet supported in the new Photos, then export the photos from iPhoto and import them to Photos.
    Or use the free exiftool, if you like the Terminal.
    See:  http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html#geotagging_exampl es
    To install exiftool: http://www.sno.phy.queensu.ca/%7Ephil/exiftool/install.html
    Other convenient apps are Jetphoto Studio, Geotagalog, there are many more ..
    I use Jetphoto Studio, but it is not free.

  • How can I add a hyperlink to a PDF with OSX 10.9? The "Help" article says to use the "add link" feature under "edit." It's not there.

    How can I add a hyperlink to a PDF with OSX 10.9? The "Help" article says to use the "add link" feature under "edit." It's not there. I could add links w/ the previous OS. Time sensitive project.

    Which application are you using?
    Clinton

  • How can I merge 2 tracks into one track with iTunes 11?  I used to do it with iTunes/Advanced/Join Tracks, but iTunes 11 does not have an "Advanced" button.

    How can I merge 2 tracks into one track with iTunes 11?

    Thanks for your reply, Jim.  I imported a CD that I had burned previously with the 2 tracks of sound effects that I had downloaded from the internet (MP3 files), but I did not see an option to join the tracks when I imported the CD.  In the upper right corner there were three buttons: Options, CD Info, and Import CD.  When I click on Options, the drop-down menu has two choices: "Get Track Names"  and "Submit CD Track Names".   I cannot find an option to Join Tracks.  Help!

  • How can I add jar files into the namespace in code?

    My friends:
    I need to add jar files into my namespace dynamicly in my code.But the jar files might be repeated, I am not sure.so, i wonder how can I add them into my namespace, ignoring the repeated files?
    This is my code:
    URL[] urlArrayA = new URL[5];
    urlArray[0] = sample1;
    urlArray[1] = sample2;
    URL[] urlArrayB = new URL[5];
    urlArrayB[0] = sample3;
    urlArrayB[1] = sample4;
    URLClassLoader urlClassLoaderA = URLClassLoader.newInstance(urlArrayA);
    URLClassLoader urlClassLoaderB = URLClassLoader.newInstance(urlArrayB);
    how can i visit classes in urlClassLoaderA from classes in urlClassLoaderB?

    could anyone please answer the question for me ? thank you...

  • How can if add multiple addresses into Contacts

    In OS 10.9.5 how can if add multiple addresses from from a tab separated file into contacts.
    I have a txt file with fields separated by tab and each and each record terminated a return,
    Importing using file>import tries to put all the data onto a single card
    Help

    Contacts – Import/Export

  • How can you add a where clause using "OR" with applied ViewCriteria?

    [JDeveloper 10.1.3 SU4]
    [JHeadstart 10.1.3 build 78]
    I am using JHeadstart, but have a question probably more in the ADF area. On the JHeadstart forum I asked:
    "I am overriding JhsApplicationModule's advancedSearch in order to be able to search in childtables. I created transient attributes, display those in advanced search and in the overridden method I check if any of these are filled by the user and create a where clause like 'EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>)'. I add this whereclause using ViewObject.setWhereClause.
    So far so good and it works. However, if the user selects 'Result matches any criteria', combining setWhereClause and the normal advancedSearch QueryByExample implementation using ViewCriteriaRow do not provide the desired result, since the ViewCriteria and the setWhereClause are AND-ed together, which is fine if the user selects the (default) "Results match all criteria" (everything is AND-ed) but not the "Result matches any criteria", since then every criterium is OR-ed together, except for the setwhereclause criteria and the set of ViewCriteriaRows, they are AND-ed.
    I looked if I could specify that a WhereClause will be OR-ed to existing applied ViewCriteria, but no luck. Do I have to rewrite also advancedSearch's ViewCriteria implementation and write an entire setWhereClause implementation to be able to "OR" every criterium? Or any other suggestions? Can I look at the entire Where clause and rewrite it (after applyCriteria and setWhereClause are called on the VO)?
    Toine"
    Sandra Muller (JHeadstart Team) told me today: "This sounds like a JDeveloper/ADF issue that is not related to JHeadstart. The question is: how can you add a where clause using "OR" if there are already one or more ViewCriteria applied?
    To simplify the test case, you could create a simple ADF BC test client class in a test Model project without JHeadstart (in the test class, use bc4jclient + Ctrl-Enter), in which you first apply a few ViewCriteriaRows to a View Object and also add a where clause.
    Can you please log a TAR at MetaLink ( http://metalink.oracle.com/ ), or ask this question at the JDeveloper forum at http://otn.oracle.com/discussionforums/jdev.html ? (This what I am doing now ;-))
    Thanks,
    Sandra Muller
    JHeadstart Team
    Oracle Consulting"
    Anyone knowing the answer or am I asking for an enhancement?
    Toine

    Hi,
    Can you SET your whereclause as follows ?
    ('Y' = <isAnd>
    and EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> AND <another column in childtable> LIKE '<value supplied by user>))
    OR ('N' = <isAnd>
    AND EXISTS (SELECT 1 FROM <childtable> WHERE <column in childtable> = <column in EO's table> OR <another column in childtable> LIKE '<value supplied by user>))
    )

  • How can I add my podcasts into an ipod shuffle?

    I have an ipod shuffle (4th G). I am trying to listen to my podcats on the go, but I am unable to add them into the ipod.
    I tried the automatic function. I also tried creating a playlist and then syncing it to the shuffle. But neither worked. Under the device tab I only have a music option, therefore I can't add podcasts manually either. Does anybody know how to do it?

    READ the article from which the question was posted.  It explicitly details exactly how to accomplish what you asked.

  • How can I add web counter into my Muse page?

    Normally with Dreamweaver I added the right code right before the end of body tag. How can I solve this problem with Muse?

    Hi,
    If you have the code for the web counter, you can add it to your Muse site using Insert HTML feature.
    Regards,
    Aish

Maybe you are looking for

  • Component in BOM with Split Valuation

    Hi all, Can anyone tell me how to assign component in BOM for which split valuation is activated. Example: Material ABC has two source 1) Domestic and 2) Import Now for production material ABC is used in following ratio: Domestic 10 kg Imported   5 k

  • How to edit the Servicve Level Report?

    Folks, Our customer would like to have a Service Level Report (SLR) from the Solution MAnager. However the first chapter on page 1 called "Solution Landscape Alert Overview" (with some EWA alert warnings) must be deleted from the SLR. How can we edit

  • Stempel Sammlung erstellen bzw. Import von mehreren Stempeln gleichzeitig

    Hallo Community, ich habe mir verschiedene Benutzerdefinierte Stempel erstellt in Adobe Acrobat Standard X. Diese möchte ich nun nach einer neu Installation wieder importieren aber nicht das ich alle einzeln anwählen muss sondern das ich alle gleicht

  • PDF application that can copy and paste

    Hi, is there a PDF reader that I can use to read iBooks and then be able to copy and paste certain sections? I have PDF reader pro but it does not have the copy/paste feature and I'm not able to find anything else suitable. Please can you advise? Tha

  • I am not able to open the iCloud calendar on the web

    I am not able to open the icloud Calendar on the web