A program has a little bug,let us solve it

compiler and run codes,you must see a bug,can you solve it?
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.util.Vector;
public class TestTable extends JFrame{
    static{
            String laf=UIManager.getSystemLookAndFeelClassName();
     try{
            UIManager.setLookAndFeel(laf);
        }catch(Exception exc){}
    Vector columnNames=new Vector();
    Vector data=new Vector();
    Vector part=new Vector();
   JTable table=null;
   public TestTable(){
      columnNames.add("fruit");
      columnNames.add("boolean");
      part.add("Applets");
      part.add(new Boolean(true));
      data.add(part);
      part.add("Oranges");
      part.add(new Boolean(false));
      data.add(part);
      table=new JTable(new MyModel());
      JScrollPane scroll=new JScrollPane(table);
      Container cp=getContentPane();
      cp.add(scroll);
      this.setSize(300, 200);
      this.setVisible(true);
      this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   class MyModel extends AbstractTableModel{
    int rowCount, columnCount;        
    public MyModel(){
        rowCount=data.size();
        columnCount=columnNames.size();
    public String getColumnName(int col) {
        return (String)columnNames.elementAt(col);
    public Class getColumnClass( int col) {
        return getValueAt(0, col).getClass();
    public int getColumnCount() {
        return columnCount;
    public int getRowCount() {
        return rowCount;
    public boolean isCellEditable(int row, int col) {
        return true;
    public void setValueAt(Object obj, int row, int col) {
         ((Vector)data.elementAt(row)).setElementAt(obj,col);
         fireTableCellUpdated(row, col);
    public Object getValueAt(int row, int col) {
        Vector vec=(Vector)data.elementAt(row);
        Object obj=vec.elementAt(col);
        return obj;
   public static void main(String[] args){
     new TestTable();
}

      part.add("Applets");
      part.add(new Boolean(true));
      data.add(part);
      part.add("Oranges");
      part.add(new Boolean(false));
      data.add(part);id say, rethink this piece. but since u kindly said "let us solve it", ill leave the rest to you.
i also dont know if a Vector is really needed here. its synchronized nature is needed if several threads access it parallel, but here an ArrayList would be faster id say.

Similar Messages

  • My iTunes program has broken letters, How can I solve the problem?

    I bought a new MacBook few days ago.
    I set up my MacBook and then set up ipod.
    On the first day, it had no problem.
    But on the next day, when I launched iTunes, all the letters were not english font, but they were Hebrew and other broken fonts.
    How can I solve this serious problem?

    Welcome to the Apple forums, Samuel.
    How can I solve this serious problem?
    Very simply.
    You have installed an application which has placed its own copy of the font "Lucida Grande" on the hard disk. This copy of Lucida Grande is causing a conflict with the Mac OS X version - Lucida Grande is provided and used by the Mac OS to display text in menu bars and on buttons.
    Open "Font Book" and locate the entry for Lucida Grande. You will see a black dot next to the name - this indicates that the font is duplicated.
    Click the triangle to show all instances of the font.
    Click on "Preview" in the menu bar and choose "Show Font Info" from the drop down.
    Click on one of the instances of Lucida Grande.
    In the info window, look at the entry for "Location". If it does NOT say System/Library/Fonts/Lucida Grande delete it.
    Do not, under any circumstances delete the font if the location shows up as:
    /System/Library/Fonts/Lucida Grande This is the Mac OS X system version.
    Message was edited by: Nick Holmes
    Message was edited by: Nick Holmes

  • HT4623 My email program has gone blank. When launched I just get a white frame with nothing in it. It's been fine for ages but now it's got a bug or something.Any ideas? I am up to date with software.Thanks david

    My email program has gone blank. When launched I just get a white frame with nothing in it. It's been fine for ages but now it's got a bug or something.Any ideas? I am up to date with software.Thanks david

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom

  • My Mail program has gone south on Leopard on my 27-month old Macbook. I can't send, even though the server details are correct. I tried reinstalling from the install DVD - but no go: no longer compatible, evidently.. What to do?

    My Mail program has gone south on Leopard on my 27-month old Macbook. I can't send, even though the server details are correct. I tried reinstalling the Mail program from the install DVD, but no go; apparently that two-year old Mail is no longer compatible with my up-to-date Leopard. I tried deleting the account (hotmail) from Mail and setting up a different account (Yahoo). After loading all the inbox two things happened: first, I still couldn't send, and second, when I closed the Mail window the whole inbox then disappeared and doesn't come back. Although I couldn't reinstall the Mail program from the install DVD, would it still be possible to reinstall the whole system from that DVD? If I do, will I lose files or will there be another problem since that DVD is now over two years old?
    Thanks for any suggestions; they will be much appreciated.
    P.S. I've just noticed that now I can't change the desktop picture: I go through the motions in Preferences, but the new picture doesn't appear on the desktop. Is there a systemic problem?

    You are waiting for an apology to something that happened over a year ago? Really? This is why there is a manager in the store. You have a problem with an employee you speak to the manager. Just like you did on the phone. You would have gotten your apology in July 2013.
    Here is the information about your upgrade fee.
    Upgrade Fee
    It is because when you have a problem you (customers) go running to the store and want to take up the time of the reps to fix it. Other carriers have third parties that deal with technical support and those locations are few and far between. VZW provides this directly through their stores. Also, when you subsidize a $650 and pay $200 VZW has to pay $400. Your monthly service fee doesn't begin to scratch the surface of paying that back. Not with all the money that is put into the network and its improvements.
    Then over a year later you get someone on the phone who apologized and offered to waive the fee on your phone and you didn't take it? That offer won't come down the pike again.
    One thing you should know is that all these employees are people and as such they sometimes come off cross. I doubt that you speak to everyone so sweetly all the time. Cut them a little slack and put this whole thing behind you after 15 months. Either upgrade with VZW or move on.

  • Nokia N8 - Little Bugs

    I know everyone has different things going on with their wonderful N8's frm like little bugs as i would like to put it...I recently received my Nokia N8 and i will say that i am happy with what i have accept for the fact that their are a few little things that i come across that irritate me sometimes. Now i know some people might dissagree but i will say this everyone that owns the phone is having some lil problem..
    Firmware Upgrade Suggestions:
    1). When double tapping on image in the photoviewer..(After tapping to zoom in the Screen goes blank..
    2).Please add a feature to add album art in the N8 like the N95 and 5800.
    3). Sometimes during texting or even just browsing the web - the phone goes back to the home menu out of  nowhere (and yess my fingers are nowhere near the exit or home button)
    4). Can you make an app for Facebook so that we dont have to log in first through OVI....
    5). Video loading during playback....Please fix that
    6). When in the music library i click the option GO TO MUSIC STORE (it just takes me back to the home screen)
    7). Can add back Video Ringtones... I miss those
    8). I dont like the lagg of 2 sec when tryting to go through the menu (and yess i have all applications closed)
    Thats all thanks

    I am unable to replicate the blank screen fault when double tapping 12mp images on my '3' UK dark grey N8. Maybe try saving to the memory card instead of internal memory?? Also there is no 2 second delay in the menu on mine or videos stopping, be sure not to close the menu and it comes up instantly! There must be something different about the 3 branded firmware, I can't find many glitches!!

  • C7280 - Cannot scan. Error message says another program has control over the device

    I opened the HP Device Manager to do a scan. I accepted the settings and the scan started. But part way through the scan, I stopped the scan as I realized that I wanted to change the resolution. I quit the Device Manager  and restarted it but when I did, I got an error message saying:
    "The function you have requested cannot be performed because another program has control over the device".
    I don't have anything else open and so I can't work out what program has control over the printer.
    C7280 Prtinter. Mac OSX 10.7.
    This question was solved.
    View Solution.

    I was thinking that if you stopped the process in mid-scan that there may be some background processes still running. Rebooting usually stops those processes.
    No, you will not have to do this each time.  Next time, though, it may be easier to just let the scan complete and the do another scan at whatever setting you want.
    Say thanks by clicking "Kudos" "thumbs up" in the post that helped you.
    I am employed by HP

  • What adobe program has dji phantom 2 vision plus lens profile in it?

    WWhat program has a lens profile for dji phantom 2 vision plus?

    The website says the newest versions of adobe lightroom and photoshop have a lens profile.
    Phantom 2 Vision+ - Features | DJI
    Photoshop elements doesn't support letting the user select lens profiles.

  • PL36 Batch "little" bug?

    Hello,
    I am trying to make an inventory transfer with a batch managed item.
    When pressing the Create button, batch selection window appears to select the batches to transfer. Here  I try to find some bach. So, I type the batch number in the Find field and then press TAB. When pressing TAB the following message appears and then SAP is closed:
    Microsoft Visual C++ Runtime Library
    Program:..... \SAP Business One.exe
    abnormal program termination
    Same thing happens in "Goods Issue" stock transaction.
    I think this could be a "little" bug of PL36 (2005A). The strange thing is that this is not happening in PL34, but now I cannt go back to PL34.
    I really dont know how to deal with this!
    I would appreciate your help!

    It is curious, however, that doing the same thing in PL34 does not make any error.
    I think it only occurs when arriving PL36 through upgrade (in my case, PL34). Otherwise, it seems to work properly.
    Thanks any way for your quick reply

  • I just switch from tape to digital. The video  has a little bounce when played on tv. I copyied the DVD to a folder

    I just switch from tape to digital. The video  has a little bounce when played on tv. I copyied the DVD to a folder, and burned it to a dvd.
    I can see in bounce at the bottom of the screen.

    David
    Premiere Elements 11, 12, or 13 on Windows 7, 8, or 8.1 64 bit....
    You could go back to the project and, in the Edit area, scale out the bouncing bottom edge. I am assuming that it will be visible there.
    Then do another burn to folder, and then take the saved folder's VIDEO_TS to DVD disc with your 3rd party software, presumed ImgBurn.
    If you want to scale width and height together, then leave the check mark next to Constrain Proportions in Applied Effects Tab/Applied Effects Palette/Motion Panel expanded. If you want to scale width and height separately, the remove the check mark next to Constrain Proportions in Motion Panel expanded.
    Please let us know the results. We might consider the Crop Effect also. (fx Effects/Transform/Crop with edits of it int Applied Effects Tab/Applied Effects Palette/Crop Panel expanded).
    Thank you.
    ATR

  • Latex+beamer : little bug in acroread to render blocks

    For all .pdf generated with pdflatex using beamer (for making slides), there is a little rendering problem in acroread.
    Please see :
    http://images.imagup.com/03/1212740471_Capture-2.png
    You can see an horizontal difference of 1 pixel on the left, between the header and the body of the block. This screenshot is in fullscreen.
    If I zoom in acroread, this difference disappears.
    The same screenshot, with evince :
    http://images.imagup.com/03/1212740636_Capture-4.png
    It doesn't have the one-pixel-difference problem (but it has a shadow bug).
    There is also a problem in acroread in shadow opacity :
    acroread : http://images.imagup.com/03/1212741150_Capture-5.png
    evince : http://images.imagup.com/03/1212741137_Capture-3.png
    Do you have a launchpad-like to report bugs? Or this is the right place to report bugs?

    Hello Romain,
    Could you please send the PDF file to me at gaurav at adobe dot com. I will investigate the issue reported by you.
    Thanks,
    Gaurav

  • Re I-Movie.  "Communication Error" is what I get when I try and send a clip from my Sony camera to the IMovie program in my IMAC 2008 Intel Chips.  The IMovie program has worked well for several years - up to now.  What has gone wrong?

    Re I-MOVIE.  I am getting a "Communication Error" when I try and send a clip to the IMovie
    program in my IMAC 2008 Intel Chip computer.  This is the first time in 3 years that the
    program has not worked.  What has gone wrong?

    Hi
    Have no idea - But if it is a new problem with exactly the same kind of material that was previously used. Then my trouble shooting guide might help.
    If You
    • used a new Camera - file codec might be a sort that don't work
    • Your main hard disk might get too filled up
    Else try
    Trouble
    When iMovie doesn't work as intended this can be due to a lot of reasons
    • iMovie Pref files got corrupted - trash it/they and iMovie makes new and error free one's
    • Creating a new User-Account and log into this - forces iMovie to create all pref. files new and error free
    • Event or Project got corrupted - try to make a copy and repair
    • a codec is used that doesn't work
    • problem in iMovie Cache folder - trash Cache.mov and Cache.plist
    • version miss match of QuickTime Player / iMovie / iDVD
    • preferences are wrong - Repair Preferences
    • other hard disk problem - Repair Hard Disk (Disk Util tool - but start Mac from ext HD or DVD)
    • External hard disks - MUST BE - Mac OS Extended (hfs) formatted to work with Video
    ( UNIX/DOS/FAT32/Mac OS Exchange - works for most other things - but not for Video )
    • USB-flash-memories do not work
    • Net-work connected hard disks - do not work
    • iPhoto Library got problems - let iPhoto select another one or repair it. Re-build this first then try to re-start iMovie.
    This You do by
    _ close iPhoto
    _ on start up of iPhoto - Keep {cmd and alt-keys down}
    _ now select all five options presented
    _ WAIT a long long time
    • free space on Start-Up (Mac OS) hard disk to low (<1Gb) - I never go under 25Gb free space for SD-Video (4-5 times more for HD)
    • external devices interferes - turn off Mac - disconnect all of them and - Start up again and re-try
    • GarageBand fix - start GB - play a few notes - Close it again and now try iMovie
    • Screen must be set to million-colors
    • Third-party plug-ins doesn't work OK
    • Run "Cache Out X", clear out all caches and restarts the Mac
    • Let Your Mac be turned on during one night. At about midnight there is a set of maintenance programs that runs and tidying up. This might help
    • Turn off Your Mac - and disconnect Mains - for about 20-30 minutes - at least this resets the FireWire port.
    • In QuickTime - DivX, 3ivx codec, Flip4Mac, Perian etc - might be problematic - temporarily move them out and re-try
    (I deleted the file "3ivxVideoCodec.component" located in Mac HD/Library/Quicktime and this resolved my issue.)
    buenrodri wrote
    I solved the problem by removing the file: 3ivxVideoCodec.component. after that, up-dated iMovie runs ok.
    Last resort: Trash all of iMovie and re-install it
    Yours Bengt W

  • I just run into an anoying little bug with SimpleDateFormat......

    Try run this code:
    Filename: Foo.java
    import java.util.*;
    import java.text.*;
    public class Foo {
      public static void main(String args[]) {
        DateFormat df = new SimpleDateFormat("dd.MM.yyyy");
        Date date = null;
        try {
          date = df.parse("31.12.2002");
        } catch (Exception e) {
          e.printStackTrace();
        System.out.println("Date initiated: "+date.toString());
        df = new SimpleDateFormat("yyyy-ww");
        System.out.println("Week expected is 2003-01");
        System.out.println("Rendered week : "+df.format(date));
    End of file
    Output from code:
    H:\>java Foo
    Date initiated: Tue Dec 31 00:00:00 CET 2002
    Week expected is 2003-01
    Rendered week : 2002-01
    Anyone know any workaround to get the expected result?
    I am sitting on a DW project that has met this anoying little bug, and I have posted this to the bug parade aswell, but I have no time to wait for a new release of the JDK :) Hope you can help
    My os:
    Windows 2000 SP 2
    My JDK version (cannot use 1.4):
    java version "1.3.1_04"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_04-b02)
    Java HotSpot(TM) Client VM (build 1.3.1_04-b02, mixed mode)
    Any help is appreciated.

    As Sun says, calculations using Date are ok for computers. but if you need to do things that people want to do with dates, use Calendar/GregorianCalendar. Here's a couple of examples
    import java.util.*;
    import java.text.*;
    public class Calendar2 {
        public static void main(String[] args) {
            Calendar cal = Calendar.getInstance(); // today as Calendar obj;
            cal.add(cal.MONTH, 6);
            // change to Date object for better format control;
            Date sixMonthsFromNow = cal.getTime();
            // create custom format;
            DateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
            // apply format and print;
            System.out.println(sdf.format(sixMonthsFromNow));
    import java.util.*;
    public class Calendar1 {
        public static void main(String[] args) {
            Calendar cal = Calendar.getInstance();
            for( int n = 0; n < 7; n++ ) {
                    System.out.println(cal.get(cal.DATE) + "/" + (cal.get(cal.MONTH) + 1) + "/" + cal.get(cal.YEAR));
                    cal.add(cal.DATE, 1);
    }

  • How can I avoid this message and the crash that follows? -"the program has unexpectedly stopped working and will close"

    I am working on some books that I have had no problem creating in Indesign  and this week, I was doing something and got an error message and had the program crash while I was working on something and lose my unsaved work. It happens all of a sudden and has been frustrating. Thought it was an installation issue, but this also happens on the newest version of CS6.
    The original files (“books”) were created in CS4.
    What I’m doing is copying a template for the appendix that was established in the first book into all subsequent books.
    Here is the process that I used on CS4 for the first 10 books –
    1.       open a file that already has the completed new appendix.
    2.       Open a file that needs the new appendix
    3.       Select the appendix pages from the pages menu in the completed file and “move” them to the new file.
    4.       Voila!
    When I started using CS5 this worked for one book. Now the last book is giving me an error message during step 3. So, I select the pages I want to move and click “move” and then I get a message that says “the program has unexpectedly stopped working and will close”. This is the same message I got with CS6.

    Same problem here. Firefox keeps freezing, sometimes for 5 minutes, then either starts working again really slowly or I get the plug-in error crash. This last time I copied what windows said about the error. This is the info:
    Problem signature:
    Problem Event Name: APPCRASH
    Application Name: plugin-container.exe
    Application Version: 1.9.2.3814
    Application Timestamp: 4c12b3be
    Fault Module Name: ntdll.dll
    Fault Module Version: 6.0.6002.18005
    Fault Module Timestamp: 49e03821
    Exception Code: c0000005
    Exception Offset: 00048b02
    OS Version: 6.0.6002.2.2.0.768.3
    Locale ID: 1033
    Additional Information 1: ca4b
    Additional Information 2: 0db6cc4f646c2246ddf8a462e3add7af
    Additional Information 3: 5b21
    Additional Information 4: e5b7e758762c24b02e09abea0b4585f4
    Don't know what it means or if it will help solve the issue, but thought I would share it.
    All I know is that I am about to do something I never thought I would, switch to Chrome.

  • I have a MacBook Pro 5,4 running OSX 10.6.8 and Safari 5.1.10. A website i like has a known bug with 5.1.10 and recommends I install a newer version of Safari or use Firefox or Chrome. Just looking for advice on the best approach. Thanks!

    I have a MacBook Pro 5,4 running OSX 10.6.8 and Safari 5.1.10. A website i like has a known bug with 5.1.10 and recommends I install a newer version of Safari or use Firefox or Chrome. Just looking for advice on the best approach. Thanks!

    Unfortunately, Safari cannot be updated past 5.1.10 on a Mac running v10.6.8.
    So, the options are to upgrade to a newer OS X or use Firefox or  Chrome.
    Be aware, Apple no longer support Snow Leopard v10.6 >  www.ibtimes.com/apple-kills-snow-leopard-os-x-106-no-longer-receives-security-u pdates-1558393
    See if your Mac can run v10.9 Mavericks >  OS X Mavericks: System Requirements
    If so, you can download and install Mavericks for free from the App Store.
    Read prior to upgrading >   Upgrading to 10.7 and above, don't forget Rosetta! | Apple Support Communities

  • I can't delete bookmarks page in my bookmarks list on toolbars, maybe there is a little bugs. Thx.

    I can't delete bookmarks page in my bookmarks list on toolbars, maybe there is a little bugs. Thx.

    A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

Maybe you are looking for