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) {
        int index = data.size() - 1;
        fireTableRowsInserted(index, index);
    public void removeRow(int index) {
        fireTableRowsDeleted(index, index);
    public void removeAllRows() {
        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.

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...

  • 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!

    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);
       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());  
                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"
       tablemodel.addColumn(nameOfColumn, new java.util.Vector());   Joao
    Message was edited by:

  • 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.....

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

  • 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
    how can i add my components into dcomcnfg.exe?

    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.

  • 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
    Insert itno style_m
    Insert itno style_m
    Insert itno style_m
    Insert itno style_m
    Insert itno style_m
    Note : The Master may have any number of childs.
    I want to display like this..
    Master child1, child2, child3, .......(dynamic)
    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.
         MAX(DECODE(r, 1, child, NULL)) || ' ' || MAX(DECODE(r, 2, child, NULL)) || ' ' || MAX(DECODE(r, 3, child, NULL)) children
              ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r
    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.
            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;
            INTO    v_count
            GROUP BY
            FOR i IN 1..v_count
                    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;
    PL/SQL procedure successfully completed.
    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: es
    To install exiftool:
    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?

  • 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, 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

    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)?
    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 ( ), or ask this question at the JDeveloper forum at ? (This what I am doing now ;-))
    Sandra Muller
    JHeadstart Team
    Oracle Consulting"
    Anyone knowing the answer or am I asking for an enhancement?

    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?

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

Maybe you are looking for

  • Fields for selection in FPCJ : Bank details not showing for Postal Order

    Hi Sap Gurus, I have a requirement in which while recieving the payment from FPCJ of type postal order i am not able to enter the bank details. which are available for Cheque payments. In our system the fields to determine the bank account and bank d

  • Changing *typeface* in Mail's Fonts & Colors preference pane?

    I want to change the font for my message list and mailboxes, but the Fonts & Colors preference pane only allows me to select the font family (e. g., Gill Sans) and not the font typeface (e. g., Book) that falls under it. If I go to Format > Show Font

  • Why I can purchase music only from a local store?

    It's like crazy, you want to support your favourite artists, no pirate stuff, but Apple says NO. In our european local store the offer is SO TRIMMED. (Can't be comparted, seriously.) WHY? Is my money not as good as US citizen's ones? Am I a second ca

  • Passing a range of dates from Visual Composer 7.0 to Bex Analyzer

    Dear Experts,          I created a button in my Visual Composer model that has the following settings: System action:  Hyperlink Apply to:  Self Hyperlink address:  "...QUERY=BMMSEG_C01_SAS_Q0001&BI_COMMAND_1-BI_COMMAND_TYPE=SET_SELECTION_STATE&BI_CO

  • Not enough server storage is available to process this command

    Windows XP Pro x32 Connecting to Windows 8.1 Pro x64 I am trying to map a share on a Windows 8.1 Pro x64 machine (Surface Pro 3 512GB) to a drive letter on a Windows XP Pro x32 machine.  I get an error saying: Not enough server storage is available t