problem with jtable + timer

Hello I'm new to ce Java and I have a big problem and I need help et I try to update one JTable with a timer every 15 seconds, but When you upgrade is a random point le program crashes , je problado Autour and can not find How to do work, the filling method Treaty in the program which works well.
Here is the code for allows you to see and error.
Excuse my English because I'm not talking very well, thank you very much greetings


Java

Docking package;

Import Clases.orden;

import java.awt.Color;

java.awt.Component import;

import java.sql.SQLException;

import java.util.Calendar;

import java.util.Date;

import java.util.Timer.

java.util.TimerTask to import;

import java.util.logging.Level;

to import java.util.logging.Logger;

to import javax.swing.JLabel;

javax.swing.JTable import;

javax.swing.SwingConstants import;

Import javax.swing.table.DefaultTableModel;

javax.swing.table.TableCellRenderer import;

Import javax.swing.table.TableColumn;

SerializableAttribute public class liquidación extends javax.swing.JFrame {}

Main P = null;

public String valorBuscado = "";

Timer Timer = new Timer(); El timer that encarga administrar los repeticion tiempo

public int seconds; el valor del contador handle

Before date = new Date();

After date = new Date();

Orden o = new orden();

Suite int = 0;

public Liquidacion() {}

initComponents();

}

{LIQUIDACIÓN (main aThis)}

initComponents();

P = aThis;

try {}

Start (15);

} catch (Exception ex) {}

Logger.getLogger (Liquidacion.class.getName ()) .log (Level.SEVERE, null, ex);

}

}

class MiTarea extends TimerTask {}

public void run() {}

Orden o = new orden();

before = new Date();

Calendar calendar = Calendar.GetInstance (); get the date of hoy

Calendar.Add (Calendar.DATE,-20);

antes.setDate (calendar.get (Calendar.DATE));

antes.setMonth (calendar.get (Calendar.MONTH));

antes.setYear (calendar.get (Calendar.YEAR) - 1900);

After = new Date();

DefaultTableModel value;

value = new DefaultTableModel() {}

Class [] types = new class [] {}

java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class

};

canEdit Boolean [] = new boolean [] {}

false, false, false, false, false, false, false, false

};

@Override

Public Class getColumnClass (int columnIndex) {}

return types [columnIndex];

}

@Override

' public boolean isCellEditable (int rowIndex, int columnIndex) {}

return canEdit [columnIndex];

}

};

Object columns [] = {"NAVE/VIAJE", "PUERTO", "SHIP", "ARMADOR', 'ARRIVAL DATE',"DATE ZARPE"," USER A COMPLETE ","DIAS FALTANTES"};

for (Col of the object: columns) {}

value.addColumn (Col);

}

tablaRegistros.setModel (value);

try {}

tablaRegistros.setModel (o.ListarTabla1 ("", before, after, value));

} catch (SQLException ex) {}

System.out.println ("error :"); tabla

Logger.getLogger (Liquidacion.class.getName ()) .log (Level.SEVERE, null, ex);

}

} / / end of race)

} / / end SincronizacionAutomatica

public void Start (int pSeg) throws Exception {}

the una tarea al timer asignamos

Timer.Schedule (new MiTarea(), 0, pSeg * 1000);

} / / end

}

ce is the error


Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0 > = 0 = > or this Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 5 > = 5 ".

at java.util.Vector.elementAt(Vector.java:470)

at javax.swing.table.DefaultTableColumnModel.getColumn(DefaultTableColumnModel.java:294)

at javax.swing.plaf.basic.BasicTableHeaderUI.getHeaderHeight(BasicTableHeaderUI.java:733)

at javax.swing.plaf.basic.BasicTableHeaderUI.createHeaderSize(BasicTableHeaderUI.java:765)

at javax.swing.plaf.basic.BasicTableHeaderUI.getPreferredSize(BasicTableHeaderUI.java:796)

at javax.swing.JComponent.getPreferredSize(JComponent.java:1660)

at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:95)

at java.awt.Container.preferredSize(Container.java:1788)

at java.awt.Container.getPreferredSize(Container.java:1773)

at javax.swing.JComponent.getPreferredSize(JComponent.java:1662)

at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:723)

at java.awt.Container.layout(Container.java:1503)

at java.awt.Container.doLayout(Container.java:1492)

at java.awt.Container.validateTree(Container.java:1688)

at java.awt.Container.validate(Container.java:1623)

to javax.swing.RepaintManager$ 2.run(RepaintManager.java:679)

to javax.swing.RepaintManager$ 2.run(RepaintManager.java:677)

at java.security.AccessController.doPrivileged (Native Method)

in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:76)

at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:676)

to javax.swing.RepaintManager$ ProcessingRunnable.run (RepaintManager.java:1650)

at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)

at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)

at $200 (EventQueue.java:103) java.awt.EventQueue.access

in java.awt.EventQueue$ 3.run(EventQueue.java:688)

in java.awt.EventQueue$ 3.run(EventQueue.java:686)

at java.security.AccessController.doPrivileged (Native Method)

in java.security.ProtectionDomain$ 1.doIntersectionPrivilege(ProtectionDomain.java:76)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)

at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)

at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Try using javax.swing.Timer instead of java.util.Timer. Alternatively, you can use SwingUtilities.invokeLater to define the model.

Tags: Java

Similar Questions

  • I have installed Adobe Audition on my pc but I have a problem with the time and the effects of pitch appear unavailable

    I have installed Adobe Audition on my 64-bit pc but I have a problem with the time and the effects of pitch appear unavailable because... I can do?, installed on another PC laptop 64 bist and does not

    My guess is that you are in multitrack view and not editview

    These fx are destructive and only take effect when you change a single audio file in editview

  • Is anyone having problems with the Times and the Sunday Times App

    Im having problems loading from the Times and the Sunday Times app. Before I launch into a major description (I have Parkinson's disease, and typing is slow) is there a known issue with the application at the present time

    There has been a lot of problems with this app as soon as they have a clear, the other seems to appear.    Take a look at this link and it followed in areas where you are affected by.

    http://www.thesundaytimes.co.UK/Sto/multimedia/archive/00258/Helpguide_stripped _ _258975a.pdf

  • I have the problem with the time in my laptop

    Hello everyone,

    I have issue with the time, whenever I stop my laptop for 2-3 hours. He return to date 01/01/2006 12:00 AM

    What should I do?

    Hello

    Did your laptop more than a few years old?

    The symptom you describe occurs when the battery that powers the CMOS BIOS chip wears.

    The CMOS battery is responsible for providing voltage to the CMOS chip so that he remembers actually all parameters, including the time and date, that have been defined.

    Replacing the CMOS battery is pretty simple in a standard OEM desktop PC. Unplug the unit. Open the case locate the quarter size battery. Remove the old battery and replace it with a new one. Plug in power and start the PC and set the time and date and accept the default settings. That's about all there is to it.

    Replacing the CMOS battery in a laptop requires generally a bit of disassembly of sequential parts just to get to the battery. Not all laptops are, but most are like this.

    I recommend that you have the CMOS battery, replaced by a HP authorized repair center.

    Kind regards

    ERICO

  • Problem with the time in the calendar

    Hello.

    My problem is that I can't properly store the time in the calendar! What I'm saying.

    I get a date as a String form a JSON (ex: 2010-08-09 15:15) and I analyze! So far so good.

    But when I store an event in the calendar with the date and the time, it is saved as 2010/08/09 18:15 therefore to the time zone of the device. Any ideas how to get the time from string?

    I looked like this:

    public long convertDate (String date){
    
    return HttpDateParser.parse(date);
    
    }
    

    thnx in advance!

    We addressed this issue several times: here's a thread on the subject.

    http://supportforums.BlackBerry.com/T5/Java-development/convert-DateTime-to-user-s-local-DateTime/m-...

  • Problems with the time in Windows 7 (64-bit)

    The time on my computer is always off.  Even when I change the time to the exact time in my bios the weather is bad in Windows.  I chose the right time zone, but it's still 6 hours off.

    When I was first troubleshooting I could just sync the clock to the internet through the GUI, but after a reboot or two time, the weather was wrong, once again.  I was looking for something more permanent then I tried things like the time service restarts windows.  I followed these instructions then because this person was having a similar problem.  It was suggested to run these commands:

    net stop w32time

    w32tm /unregister

    w32tm /register

    net start w32time

    w32tm/Resync

    This helped temporarily, but now I have an error the command net stop time w32t.  CMD says "the time service Windows is not started."

    When I go to my services time service Windows is there but not started.  When I try to run it I get this error:

    Here is a picture...

    I hope this is enough information.  Thanks for the help!

    Hi EvanDinelli,

    To resolve this issue, follow these steps:

    Note:
    this section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article: back up the registry in Windows 7

    a. Click Start, type regedit in the search box and then click regedit.exe in the list programs.

    If you are prompted for an administrator password or a confirmation, type your password, or click on continue.
    b. Locate the following registry subkey and click on it:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TapiSrv

    (c) in the part of details, right-click ImagePath and then click on edit.

    d. in the value data box, type the following registry value, and then click OK:
    %SystemRoot%\System32\svchost.exe k NetworkService

    Note if NetworkService does not appear in the registry %SystemRoot%\System32\svchost.exe - k NetworkService value, the problem that is described in the "Symptoms" section may occur.
    e. exit the registry editor and then restart the computer.
    Note
    if you try to start the telephony service before you restart the computer, you may receive the following error message:

    Error 1290: Starting the service failed because one or more services in the same process have a service SID inconsistent type parameter. A service with service restricted SID type can only coexist in the same process with other services with a restricted SID type. If the type of SID for this service has been configured, you must restart the hosting process in order to start this service.

  • Problem with date & time - guard back to 2009

    The date and time on my laptop keeps returning to a 2009 a whenever I have shut down my computer. This has only started happening recently and I don't know what started to happen.  Is there a simple solution to do this, in addition to having to put every time that I re - start.

    > The date and time on my laptop keeps returning to a 2009 a whenever I have shut down my computer.

    This indicates that your CMOS battery is NOT. It's time to replace it.

    What is CMOS battery:

    http://www.computer-hardware-explained.com/CMOS-battery.html

    How to replace the CMOS battery
    http://www.computerhope.com/issues/ch000239.htm

    * ATTENTION: then the battery itself is very good cheap, be careful if you decide to replace yourself.
    It is better to have another friend who knows also computer be with you together.

    The safest way is to pay the Department store. But it will cost you.
    Your call.

  • A problem with a timer event works sometimes not

    Guys...

    I have this problem:

    I have a child added to step eacg 5 seconds and if this child still on stage after 5 seconds,'re going you to the next section...

    My problem is that sometimes it does not, which means that you can have this baby on the scene forever and nothing will happen... but sometimes it doesn't work properly...

    Are there errors in my code or what should I do?

    var miC4:Loader = new Loader();

    miC4.load (new URLRequest ("nivel1.jpg"));

    addChild (background1);

    background1. AddChild (miC4);

    If (! lives) {var life: int = 3 ;}}

    var enem1:Loader = new Loader();

    enem1. Load (new URLRequest ("1enemigo.png"));

    var enemy1Array:Array = new Array (enem1);

    var t1:Timer = new Timer (5000,1);

    var t2:Timer = new Timer (10500,1);

    recycleEnemy();

    function removeEnemy() {}

    background1.removeChild (enem1);

    recycleEnemy();

    }

    function touchListener(event:MouseEvent) {}

    enem1. RemoveEventListener (MouseEvent.CLICK, touchListener);

    removeEnemy();

    }

    function recycleEnemy (): void {}

    enem1.x = (50 + Math.Random () * (stage.stageWidth - 150));

    enem1.y = (50 + Math.Random () * (stage.stageHeight + -100));

    T1.addEventListener (TimerEvent.TIMER, addEnemy);

    T1. Start();

    T2.addEventListener (TimerEvent.TIMER, bang1);

    T2. Start();

    }

    function addEnemy(e:TimerEvent):void {}

    background1. AddChild (enem1);

    enem1.addEventListener (MouseEvent.CLICK, touchListener);

    enemy1Array.push (enem1);

    }

    function bang1(e:TimerEvent):void {}

    {if (enem1.stage)}

    -life;

    If (lives > = 0) {}

    T1. Stop();

    T2. Stop();

    removeChild (background1);

    gotoAndStop (5);

    }

    }

    Thank you very much!!!

    OK, so there are a number of issues.

    the first error is enemy1Array contains two duplicated objects ~ 5 seconds after entering this framework.  I don't know if it's a problem because I don't see where you're even using enemy1Array, but you must correct this error (if enemy1Array is used) or remove enemy1Array (if it is not used).

    the next problem is you can call recycleEnemy more than once and add the timers.  Flash will probably protect you from bad coding, but you shouldn't count on it.  When you call removeEnemy, you must stop these timers and remove listeners before adding another pair of headphones.  or simply reset the timers in removeEnemy and start them in recycleEnemy.  There is no need to add more than once these listeners.  they may be added in your conditional if(!lives).

    the next (and probably the most important) error is your declaration of removeChild (background1) that fails to remove enem1. so, when you re-enter this image you have an enem1 on stage that you can't kill and cannot refer to same.  Take it off when you remove the background1.

  • Another problem with countdown timer.  Don't know why

    Hi all

    I noticed on my 30 minutes to count down the seconds seem to ignore or hesitate at different intervals.  It seems to work for 30 minutes, but it will be displayed on a GIANT screen and the seconds of the movements is very obvious.  Someone would show me how please correct the code to a total accuracy of the calendar?  Not sure if I should add milliseconds.  (I don't want to show in the timer, just minutes and seconds 00:00.  Thanks in advance.

    Here is the code

    totalTime = 1800;

    Start from 30 minutes

    startTime = getTimer();

    function timer() {}

    timeLeft = (totalTime * 1000)-(getTimer () - startTime);

    seconds = Math.floor (timeLeft/1000);

    minutes = 0;

    While (seconds > 59) {}

    seconds = seconds-60;

    minutes = minutes + 1;

    }

    If (minutes < 10) {}

    minutes = String("0"+minutes);

    }

    If (seconds < 10) {}

    seconds = String ("0" + seconds);

    }

    Time_text. "Text = minutes +": "+ seconds;

    If (timeLeft < = 0) {}

    Time_text. Text = ("00:00");

    _root.gotoAndPlay (11);

    clearInterval (timer1);

    }

    }

    Timer1 = setInterval (timer, 1000);

    You walk a fine line with a 1 second interval.  Increase your sampling rate and you are less likely to ignore a value.  Here is an approach that samples at rate of the file.  Note that 'var' has been addded in many places.  You should always declare your variables without worrying that AS2 allows you to not have to.

    totalTime var = 1800;

    Start from 30 minutes

    startTime = getTimer() var;

    this.onEnterFrame = function() {}

    timeLeft var = (totalTime * 1000)-(getTimer () - startTime);

    var seconds = Math.floor (timeLeft/1000);

    var minutes = Math.floor (seconds/60);

    seconds = seconds % 60;

    If (minutes<10)>
    minutes = String("0"+minutes);
    }

    If (seconds<10)>
    seconds = String ("0" + seconds);
    }

    Time_text. "Text = minutes +": "+ seconds;

    If (timeLeft<=0)>
    delete this.onEnterFrame;
    Time_text. Text = ("00:00");
    _root.gotoAndPlay (11);
    }
    }

  • Problems with Time Capsule

    I have problems with our time Capsule. My husband and I have Macbook Pro (from 2012). We use a Time Capsule as our backup disk but not our wireless router (we use the router provided by our internet service provider). We have configured like this for over a year and it is usually worked fine. In the last month, we had problems with backups does not happen. Currently, computer of my husband has saved in about 2 weeks, and mine has not backed up in 2 days.

    It seems that our computers lose their link with time capsule. If I go to the finder, the shared drive appears under "shared", but if I click on it to connect I get a message that says "connection failed." Airport utility shows the time Capsule but has a yellow triangle next to it that says "device not found."

    If I unplug the Time Capsule and plug it in again, it reconnects. I did this earlier this evening and was able to access the shared drive and make a return to the top. But a few hours later, this subject has disappeared again. I tried to do this same thing - unplug, get the rear connection, only to lose it again a little later. Any thoughts on what could be the problem? The Capsule was bought the same time than computers.

    I guess what surprises me is that you had no problems up to this point.

    Your computer must connect directly to the Treasury Board. Ethernet or wireless... It will break things especially in the BONES later if you do not.

    Do you have recently move you to el capo... ?? That could have triggered the problem.

    I lost the link but in apple of one document stated finally that you connect directly the computer now... because of the bad DNS in the operating system.

    If I unplug the Time Capsule and plug it in again, it reconnects. I did this earlier this evening and was able to access the shared drive and make a return to the top.

    That's why you get this nonsense. He is able to find the backup if DNS is renewed due to reset... After a few hours it is lost again.

    What operating system do you use?

    My recommendation is to put on wireless and a link to the direct of TC...

    A TC Gen4 purchased in 2012 is now at least 3 years and let me tell also your reliable stage... you are now at the stage of growing decrepitude of old people. It might work correctly for a year or two... It can suddenly die tomorrow... but more likely will fade into the sunset.

  • iPad2 and problem with the SIM card after update

    even after the 9.3.1 last updated continuously having problems with SIM TIM card network.

    I changed and I tried with another SIM card but the problem remains.

    I did have all those problems with 9.2.1.

    Apple could intervene and solve these problems? Otherwise, I think it's better to make a return to the old 9.2.1.

    Thank you

    Do you see the network? and is it strong enough?

  • HP ENVy 4 1102tx: big problem with computer graphic card hp laptop

    MY computer laptop hp envy 1102tx running 64-bit win 8

    When I bought my laptop there were some problems with the display, she would get destorted occasionally. But over time, this problem became worse as

    1. display and sometimes audio would get very disttorted that seems to be the screen flashes, but if I run a game or high demanding software chart everything is normal.

    2. sometimes touchpad and some keyboard keys stop working

    I tried

    1 system restore using the recovery partition

    2 update screen adopting several times

    3. when I got my laptop the customer, what they came up with a temporary solution to a deactivation of the adopter display amd

    but adoptive parents to display like this switching is so boredom

    Is there a permanent thanks to this problem?

    When some people are updated there victory hp 8 machines 8.1 that they also get the screen black on startup, why is this? is this an inherent problem with the time between two different graphics cards?

    Hi @lima619

    Welcome to the HP support community! I see that you have some problems with your desire to 4. Try to install your driver high definition Audio Intelas it should be the graphics card that manages the basic functions. I'd also sure that your Catalyst Control Center is only the Setup for your high performance games and programs. This HP document will show you how do it.

    By system restore you did take back you to factory defects as in a collection or just go to a previous restore point? If you have a full recovery to factory settings then it seems like it might be a hardware problem with the keys / TouchPad if they start working again.

  • Problem with the rendering of JProgressBar in JTable

    I have some problems with the rendering of JProgressBar in JTable. In the case of several lines, when a progress bar is updated, and its text is changing, then he painted all the progress bars in this column.

    Here is my code I used to create the table:
    --------------------------------------------------------------------------------------
    JTable convertTable = new JTable(convertTableModel) {
    
                public Component prepareRenderer(TableCellRenderer renderer,
                        int rowIndex, int vColIndex) {
                    Component c = null;
                    if (renderer != null) {
                        c = super.prepareRenderer(renderer, rowIndex, vColIndex);
    
                        if (vColIndex == INDEX_CONVERT_STATUS) {
                            //System.out.println("c = "+c.getClass());
                            if(c instanceof JProgressBar) {
                                //System.out.println("inside = ");
                                c.setBackground(Color.BLUE);
                            }
                        }
                    }
                    return c;
                }
    
                public boolean isCellEditable(int rowIndex, int mColIndex) {
                    if (mColIndex == INDEX_CONVERT_SELECT) {
                        return true;
                    } else if (mColIndex == INDEX_CONVERT_STATUS) {
                        return false;
                    } else {
                        return false;
                    }
                }
    
                /*
                 * JTable uses this method to determine the default renderer/
                 * editor for each cell.  If we didn't implement this method,
                 * then the last column would contain text ("true"/"false"),
                 * rather than a check box.
                 */
                public Class getColumnClass(int c) {
                    if (getValueAt(0, c) != null) {
                        return getValueAt(0, c).getClass();
                    }
                    return null;
                }
            };
    --------------------------------------------------------------------------------------

    Then I applied on this table rendering engine

    ---------------------------------------------------------------------------------------
    // Applying JProgressBar Renderer for convert table
            TableColumn col = convertTable.getColumnModel().getColumn(INDEX_CONVERT_STATUS);
            ProgressBarRenderer progressBarRenderer = new ProgressBarRenderer();
            col.setCellRenderer(progressBarRenderer);
    ---------------------------------------------------------------------------------------

    Class code ProgressBarRenderer is as follows:
    ---------------------------------------------------------------------------------------
    public class ProgressBarRenderer extends JProgressBar implements TableCellRenderer {
    
        private Hashtable ht = new Hashtable();
    
        public ProgressBarRenderer() {
            super(0);
            this.setMinimum(0);
            this.setMaximum(100);
            this.setStringPainted(true);
            this.setBorderPainted(true);
    
            UIDefaults defaults = UIManager.getDefaults();
            Font font = new Font("Arial", Font.BOLD, 12);
            defaults.put("ProgressBar.font", font);
        }
    
        public void setRowEnabled(int row, boolean enabled) {
            ht.put(row, enabled);
        }
    
        public void setForeground(Color c, int row) {
            //System.out.println("setString ht = " + ht.size() + "  row= " + row + "  Selected= " + (Boolean) ht.get(row) + " color= " + c);
            if (ht.isEmpty()) {
                this.setForeground(c);
            } else if (ht.size() == 1) {
                this.setForeground(c);
            } else if ((Boolean) ht.get(row)) {
                this.setForeground(c);            
            } else {
                this.setForeground(c);
            }
        }
    
        public void setString(String s, int row) {
    
            //System.out.println("setString ht = " + ht.size() + "  row= " + row + " text= " + s);
            if (ht.isEmpty()) {
                this.setString(s);
            } else if (ht.size() == 1) {
                this.setString(s);
            } else if ((Boolean) ht.get(row)) {
                this.setString(s);
            } else {
                this.setString(s);
            }
    
        }
    
        @Override
        public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            
            //System.out.println("getTableCellRendererComponent = " + table);
            //System.out.println("Renderer ht = " + ht.size() + "  row= " + row + "  Selected= " + (Boolean) ht.get(row));
            
            if (ht.isEmpty()) {
                return this;
            } else if (ht.size() == 1) {
                return this;
            } else if ((Boolean) ht.get(row)) {
                return this;
            } else {
                return null;
            }
        }
    }
    ---------------------------------------------------------------------------------------

    I add the next line and rendered the progress column is follows:
       convertTableModel.addRow(new Vector());
       ((ProgressBarRenderer) convertTable.getCellRenderer(row, INDEX_CONVERT_STATUS)).setRowEnabled(row, false);
    ---------------------------------------------------------------------------------------

    When I add the first row, it works fine, but when I add the second row, he painted the entire column.

    Naturally, you will have problems if you set a string or a color of a table cell value when the class of the column is declared as integer. As I have already said, you need to spend some time with the tutorials.

    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Random;
    import javax.swing.*;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableCellRenderer;
    
    public class ProgressBarTableCellRendererExample {
    
      Random random = new Random();
      JTable table;
    
      public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
    
          public void run() {
            new ProgressBarTableCellRendererExample().makeUI();
          }
        });
      }
    
      public void makeUI() {
        table = new JTable(10, 1) {
    
          @Override
          public boolean isCellEditable(int row, int column) {
            return false;
          }
        };
        for (int i = 0; i < table.getRowCount(); i++) {
          table.setValueAt(0, i, 0);
        }
        table.getColumnModel().getColumn(0).
                setCellRenderer(new ProgressBarTableCellRenderer());
    
        JButton button = new JButton("Increment");
        button.addActionListener(new ActionListener() {
    
          public void actionPerformed(ActionEvent e) {
            increment();
          }
        });
    
        JFrame frame = new JFrame();
        frame.add(new JScrollPane(table), BorderLayout.CENTER);
        frame.add(button, BorderLayout.SOUTH);
    
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 400);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      }
    
      private void increment() {
        for (int i = 0; i < table.getRowCount(); i++) {
          Object value = table.getValueAt(i, 0);
          if (value instanceof Integer) {
            Integer oldValue = (Integer) table.getValueAt(i, 0);
            int newValue = Math.min(100, oldValue + random.nextInt(25));
            switch (newValue) {
              case 13: // and its multiples
              case 26:
              case 39:
              case 52:
              case 65:
              case 78:
              case 91:
                table.setValueAt("Failed", i, 0);
                break;
              case 100:
                table.setValueAt("Completed", i, 0);
                break;
              default:
                table.setValueAt(newValue, i, 0);
            }
          }
        }
      }
    
      private class ProgressBarTableCellRenderer
              extends JProgressBar implements TableCellRenderer {
    
        private TableCellRenderer stringRenderer =
                new DefaultTableCellRenderer();
    
        public Component getTableCellRendererComponent(JTable table,
                Object value, boolean isSelected, boolean hasFocus,
                int row, int column) {
          if (value instanceof Integer) {
            setValue((Integer) value);
            return this;
          } else {
            return stringRenderer.getTableCellRendererComponent(table,
                    value, isSelected, hasFocus, row, column);
          }
        }
        // Override void validate(), invalidate(), revalidate(), repaint()
        // and all overloads of firePropertyChange(...) as no-ops
        // for efficiency
      }
    }
    

    DB

  • I bought the new iphone 6 s more and I have not configured, I just opened the phone and charged, but after some time it stop by itself, is this normal or I have a problem with my phone?

    I bought the new iphone 6 s more and I have not configured, I just opened the phone and charged, but after some time it stop by itself, is this normal or I have a problem with my phone?

    You need to activate the phone. There is nothing that the phone can not be activated.

  • Problem with IMovie and Quick time

    Hey everybody,

    I am faced with an unexpected problem with Quicktime and I Movie, and I was wondering if someone had already known that:

    I want to create a film based on shots from my personal camera. I started to work with IMovie to create a sequence of opening and added his musical band. I exported the scenes in Quick Time format without any problem. However, when I merge the exported sequence of I film with shots of my video camera, the soundtrack is completely eliminated.

    I checked on the Internet and saw that there might be a problem of "Codecs". To avoid this, I exported the sequence IMovie with Codecs of same as one of my video camera files.

    Now, if I compare the files exported from I Movie and those of my video camera, they have identical characteristics. However, the soundtrack will always disappear when I merge them.

    Could someone please help me solve this problem?

    Thank you very much in advance.

    Concerning

    Could someone please help me solve this problem?

    Not only based on what you already said.

    I want to create a film based on shots from my personal camera. I started to work with IMovie to create a sequence of opening and added his musical band. I exported the scenes in Quick Time format without any problem. However, when I merge the exported sequence of I film with shots of my video camera, the soundtrack is completely eliminated.

    How would you"merge" files? (I.e. a "QuickTime" format is any form of data compatible with the platform of supply and the specific structure of QT incorporated into real employment that is stored in a container of MOV file on any of up to 99 tracks possible). Also, what app do you use for reading the file 'merged '? (For example, some media players ignore secondary audio tracks as a result of some methods of 'fusion' of files so it is important to know how the files are "merged," whether or not the audio data are "scattered" several tracks, and/or if the Media Player supports playback of multiple, sequential audio popular.)

    I checked on the Internet and saw that there might be a problem of "Codecs". To avoid this, I exported the sequence IMovie with Codecs of same as one of my video camera files.

    The specific codecs and settings using the specific version of iMovie? (The current Mac OS X operating systems have two X QT and 'classic' Qt integrated structure so it is important to know what structure is used here and how).

    Now, if I compare the files exported from I Movie and those of my video camera, they have identical characteristics. However, the soundtrack will always disappear when I merge them.

    As a general rule, you should review the file "merged" to determine why it does not play back correctly rather than comparing the characteristics of the source being merged files. The main problem here seems to be in your project workflow. That is, you seem to be when you perform an operation in two steps rather than edit several iMove multimedia files and then export the combined results in a video the video and audio tracks have been flattened and exported in standard compression formats with unified settings, features and the.

Maybe you are looking for