Need some help with project - help is VERY appreciated!

This one has been driving me nuts for a few days. So basically, I have this constructor.
public SportStacker( String newName, int numTimes, int newID )
         name = newName;
         numTimesRecorded = 0;
         times = new double[ numTimes ];
         ID = newID;
      }The important thing here being that it sets ID = newID. That's in the SportStacker class. We also have a method in SportStacker named getID:
public int getID()
         return ID;
      }Okay, then we have another class, Contestant. In this class, we have an array of SportStacker objects. One method we had to create was to add a new contestant.
public void addCompetitor(String name, int numTimesRecorded)
         if(numCompetitors == competitors.length)
            increaseSize();
         SportStacker temp = new SportStacker(name, numTimesRecorded, IDtracker);
         competitors[numTimesRecorded] = temp;
         numCompetitors++;
         IDtracker++;
}Which I think is fine. However, the next one is addCompetitorTimes. It seems like it should be easy, but this part confuses me...in his instructions, he says: "This method should take in two parameters: an int representing the competitors ID and a double representing the time to be recorded. Then, search through competitors for the correct ID using the getID method provided in SportStacker..." This is what confuses me. One of the parameters taken in this method is the int representing his ID, and all getID will do is return what was last used in the constructor. It doesn't make any sense to me! Someone please help!

johnboy8282 wrote:
Minus the addTime part, just wanted to make sure I was doing this right first. Thanks so much for the help, your explanation helped me understand a lot!Using a for loop is clearer but yes your on the right track. Minor note, if the competitors array contains nulls then a runtime error will occur due to .getID() applied to a null object. This is easily avoidable.
public void addCompetitorTimes(int compID, double timeToRecord){
  for(int i=0; i<numCompetitors; i++){
    if(competitors.getID() == compID){
System.out.print("Add time stuff here...");
break; //Break from for loop, no need to check other IDs
}Mel                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Need some help with sound quality

    Hi guys, new here. I'm working on creating an album on my own. Bass and vocals are real, everything else is using software instruments. I have about 8 songs done, but the problem is I don't really know what I'm doing as far as recording and levels go.
    I'm using studio headphones and everything sounds fantastic through them, and even pretty good if I just hook up some earbuds, but when I bounce out a track and burn them to do a disc and play it in my car, it sounds awful. Suddenly the guitar is too low, drums are too loud.
    I really need some help here. I'm even willing to pay someone to get me on the right track. Using paypal or whatever.

    AecDuck wrote:
    Where's the fun in that? Maybe you have different motives, but I got into home recording because I like doing things myself, even if I have to learn the hard way. If you know enough to get good bass and vocal recordings and mix that with virtual instruments, then you are well on your way to making a decent sounding mix. Mixing in headphones can be very deceiving. Things simply sound different in headphones. You need some monitors, even if they are crappy because if you can get it to sound good in crappy monitors it will likely sound good on other speakers.
    The fun and experience comes from getting a good balance that sounds good in headphones, and in the monitors, and in your home stereo, and in your car stereo. Use the different audio systems as a reference. If the drums are too quiet in the car, bring them up a bit. If the bass is too loud in your headphones, put them down a bit.
    If you bring in your recordings to be mixed by somebody else, first of all you're going to end up paying hundreds, if not $1000+ dollars, even in a sub-par studio. Secondly, it's never going to sound how you want it to sound. It's going to sound how THEY want it to sound.
    I know it takes longer, and it's hard work, but you will have such a tremendous amount of satisfaction when your project is done knowing that YOU recording it, and YOU mixed it on YOUR equipment. It will be 100% yours.
    Where's the fun? How about the fun in interacting with another human being? How about the satisfaction in having another validate what you've been trying to produce?
    I don't think it's helpful to make generalizations about what type of experience the OP might have in getting professional help. I have had good experiences working with mixing engineers, and perhaps I have just been lucky, but I've been able to produce music that sounded how I wanted it to sound, but at a level beyond which my skill at the time would have been able to produce, AND I gained some insights to help me in the future.
    It IS satisfying to teach yourself a new skill. And it takes a lot of patience, trial and error, and you might miss the mark more often than you hit it. If you're in a rush, it might be a viable solution to contact some studios and see if you can work with them. Learning from others is perfectly acceptable.

  • Help request - Could need some help with a logo for my site

    Hi I'm working on a project and i have come across a huge problem.
    please check out my logo on this site:
    http://www.tuxxen.com
    I have no idea how i should make my logo and  it seems like i have no skills to make one either,  i have been trying for days to make one that look decent but it end up looking really really bad each time.
    Could really need some help to get a nice logo up, the site im working on is about fishing, the name of this site will be changed to: Absolut mete. So the logo need to have this name.
    I have managed to make the layout for my site but i cannot make a logo its a bit funny really but yeah...
    Any help are very much welcome!

    THANK YOU/___sbsstatic___/migration-images/migration-img-not-avail.png so the tolerance makes it not care so much about the gradations in color? what else is tolerence good for?
    I have a cleaner copy now after someone suggested GIMP, so played with it last night - though couldn't figure out transparency - that was clear on converter- just not cooperative till these wonderful directions.
    So now I know how to do it without messing with the pic, and with messing with it - both good lessons and got a bit brighter color out of the deal.
    many thanks for the straightforward and clear directions, they worked perfectly/___sbsstatic___/migration-images/migration-img-not-avail.png extra strars for you/___sbsstatic___/migration-images/migration-img-not-avail.png

  • Need some help with threads...

    Hello all,
    I am working on a project at work, and I am not the best programmer in the world. I have been trying to get my head around this for a couple of days and just cannot get it to work.
    I am writing an instrumentation control program that will have three threads. One is the GUI, one will receive control information and set up the hardware, and one will check the hardware status and report it to the GUI periodically. I plan on using the invokeLater() method to communicate the status to the GUI and change the status display in the GUI. Communication from the GUI to the controller thread and from the status thread to the controller thread I had planned on being piped input/output stream as appropriate. I have a control class and a status class that need to be communicated over these piped streams. In some trial code I have been unable to wrap the piped input/output streams with object input/output streams. I really need some help with this. Here is the main thread code:
    package playingwiththreads1;
    import java.io.*;*
    *public class PlayingWithThreads1 {*
    public static void main(String[] args) {*
    * PipedOutputStream outputPipe = new PipedOutputStream();*
    * ObjectOutputStream oos = null;*
    * ReceiverThread rt = new ReceiverThread(outputPipe);*
    // Start the thread -- First try*
    * Thread t = new Thread(rt);*
    t.start();*
    // Wrap the output pipe with an ObjectOutputStream*
    try*
    oos = new ObjectOutputStream(outputPipe);*
    catch (IOException e)*
    System.out.println(e);*
    // Start the thread -- Second try*
    //Thread t = new Thread(rt);*
    //t.start();*
    /** Send an object over the pipe. In reality this object will be a
    class that contains control or status information */
    try
    if (!oos.equals(null))
    oos.writeObject(new String ("Test"));
    catch (IOException e)
    try
    Thread.sleep(5000);
    catch (InterruptedException e)
    I read somewhere that it matters where you start the thread relative to where you wrap piped streams with the object streams. So, I tried the two places I felt were obvious to start the thread. These are noted in the comments. Here is the code for the thread.
    package playingwiththreads1;
    import java.io.*;
    public class ReceiverThread implements Runnable {
    private PipedInputStream inputPipe = new PipedInputStream();
    private ObjectInputStream inputObject;
    ReceiverThread (PipedOutputStream outputPipe)
    System.out.println("Thread initialization - start");
    try
    inputPipe.connect(outputPipe);
    inputObject = new ObjectInputStream(inputPipe);
    catch (IOException e)
    System.out.println(e);
    System.out.println("Thread initialization - complete");
    public void run()
    System.out.println("Thread started");
    try
    if (inputObject.available() > 0)
    System.out.println(inputObject.read());
    catch (IOException e)
    System.out.println(e);
    Through testing I have determined that no matter where I start the thread, the thread never gets past the "inputObject = new ObjectInputStream(inputPipe);" assignment.
    Could someone please help me with this? There are other ways for me to write this program, but this is the one that I would like to make work.
    Many thanks in advance,
    Rob Hix
    Edited by: RobertHix on Oct 6, 2009 3:54 AM

    Thanks for the help, but that did not work. I tried flushing the ObjectOutputStream and it is still hanging when initializing the thread.
    Here is a better look at the code since I was helped to figure out how to insert it:
    The main method:
    package playingwiththreads1;
    import java.io.*;
    public class PlayingWithThreads1 {
        public static void main(String[] args) {
            PipedOutputStream outputPipe = new PipedOutputStream();
            ObjectOutputStream oos = null;
            ReceiverThread rt = new ReceiverThread(outputPipe);
            // Start the thread -- First try
            //Thread t = new Thread(rt);
            //t.start();
            // Wrap the output pipe with an ObjectOutputStream
            try
                oos = new ObjectOutputStream(outputPipe);
                oos.flush();
            catch (IOException e)
                System.out.println(e);
            // Start the thread -- Second try
            Thread t = new Thread(rt);
            t.start();
            /* Send an object over the pipe.  In reality this object will be a
             * class that contains control or status information */
            try
                if (!oos.equals(null))
                    oos.writeObject(new String ("Test"));
                    oos.flush();
            catch (IOException e)
                System.out.pringln(e);
            try
                Thread.sleep(5000);
            catch (InterruptedException e)
    }The thread code:
    package playingwiththreads1;
    import java.io.*;
    public class ReceiverThread implements Runnable {
        private PipedInputStream inputPipe = new PipedInputStream();
        private ObjectInputStream inputObject;
        ReceiverThread (PipedOutputStream outputPipe)
            System.out.println("Thread initialization - start");
            try
                inputPipe.connect(outputPipe);
                inputObject = new ObjectInputStream(inputPipe);
            catch (IOException e)
                System.out.println(e);
            System.out.println("Thread initialization - complete");
        public void run()
            System.out.println("Thread started");
            try
                if (inputObject.available() > 0)
                    System.out.println(inputObject.read());
            catch (IOException e)
                System.out.println(e);
    }Does anyone else have and ideas?

  • Need some help with GUI development

    Hi ppl.. I am new to labview and I am currently involved in a testing equipment development. I need some help. firstly I need to know if multi-screen GUI (with icons and stuff)is possible in Labview. Secondly I need to interface the measurements to a database. Would it be possible to create just small executable to perform the measurement part alone and do the rest of database operation using VB. (or would it be advisable to do the whole lot in labview)
    the final sft should look something like this
    screen1 :setup screen... interface with database
    screen2 :actual test and test results
    screen3 :log file creation
    measurement is via daq board and i also need to send some control signals and set up TCP/IP for data transfer.

    Hello.
    I am not completely sure what you mean by "multi-screen", but I am pretty sure that doing the user interface using a tab control will work for you. I have attached an example VI which is a state machine (which in LabVIEW you do with a case structure inside a while loop). Notice how the configuration controls are in the first page of the tab control, associated with state 0 of the state machine, but in the block diagram, they are actually used in state 1 of the state machine. Instead of writing a very long description, I will let you take a look at the code (which I saved in LV 7.0 version). Let me know if you have questions or comments
    Attachments:
    MultiScreenStateMachineExample.vi ‏50 KB

  • Need some help with wine + midi

    Howdi guys!
    I need some help. I'd like to run an application which is only available for Windows and OSX, so my choice is wine. This application needs to send midi signals to the hardware it is supposed to control.
    In the product's forum there is a thread which shows how it can be done. But the newest releases of wine don't allow this, because it doesn't support jack anymore.
    I think basically it doesn't matter which application it is I run in wine, the question is, is it possible to send midi signals in and out through wine? If so, how? Might be that it's quite trivial, in my defense I have to say that I never worked with midi before.
    The soundcard I use is an Edirol UA-25 which is fully supported in Linux, midi works.
    Thanks for any ideas!
    edit: Forgot two things: I know I could try older versions of wine or running it in a virtual machine, but I want to avoid this.
    Last edited by Army (2012-04-27 07:15:33)

    For that app, you will probably be using the ALSA-midi interface. So, you shouldn't require Wine to have jack support. - In fact, that picture clearly shows that Wine is using ALSA-midi, but he is using jackd + a2jmidid (which exposes alsa-midi 2 jack-midi).
    As long as that software doesn't require a special driver, you should be able to use it. As for the specifics, i would imagine that you would start jackd, start a2jmidid and then start your application. - you also have to make sure your midi device is connecting before launching your app in wine - otherwise the device won't show up in your wine app. You also will need to select your midi interface in your application. After this, you should be able to connect your wine app (through the a2jmidi bridge) to your hardware.
    But if for whatever reason you can't get it too work ~ i do actually use a VM for updating firmware on 2 different audio devices (a soundcard and midi-controller) - and it works great. I am using VMware, but i would imagine virtualbox would work very similar..
    cheerz

  • Need some help with region position

    Hi,
    I need som help with regions position....
    Background:
    I have 2 regions, I will call them reg1, reg2 and reg3.
    reg1 = Page Template Body (2. items below region content), column 1, search region.
    reg2 = Page Template Body (2. items below region content), column 2, import file region.
    reg3 = Page Template Body (3. items above region content), column 1, search result, grid region, very wide.
    Issue with the position, the setup explained makes my layout like this
    reg1--------------------------------reg2
    ------------------reg3--------------------
    What I want:
    reg1-reg2
    ------------------reg3--------------------
    What am I doing wrong?
    Regards Daniel

    Daniel,
    this will also work:
    Region1 HTML table cell attributes
    width="10%"
    Region2 HTML table cell attributes
    align="left"
    without touching the page template.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • I Need Some Help With My Dreamweaver

    Hello, there i need some help with my dreamweaver i already made a forum about this but that one i maded didnt make sense soo i will make it more details in it soo i will tell you what i did i tell you what i downloed and all that just now but i tell you the things what it does i downloaded Adobe Design and Web Premium CS6 its a 30 day trial then and now i will tell you the details look below please
    Details
    Soo i opened my start menu then went on all programs then clicked on Adobe Design and Web Premium CS6 then i clicked on the dreamweaver CS6 then when i clicked on it i heard my computer shut down then it shuted down when i opened it straight away then it turns it self back on
    What did i do about this when it happened?
    I made a question so please can telll me what to do or what ever
    Why did i download it?
    i downloaded it because i am making a website and i want to use dreamweaver CS6 because i use notepad++ i do not like the notepad++ its harder and dreamweaver helps a bit i think because i watched a video of it
    What if you dont have an answer?
    Well, i will be very angry because i am making a good website its gonna be my frist publish website ever i made 20 websites but i never published them i deleted them because i wiped my computer
    What kind of Computer Do You have?
    System:
    Micfosoft windows xp
    Media Center Edition
    Version 2002
    Service Pack 2
    Computer
    ei-system
            intel(R)
    pentium(R) 4 CPU 3.20ghz
    3.20 ghz, 960 MB of RAM
    Btw i am using dreamweaver CS6 if you fogot and dont say add more details because there is alot off details there and if you help me i will show u the whloe code when i am done but leave ur emaill address below
    (C) Connor McIntosh

    No.
    Service Pack 3 just updates your OS. All of your files, folders and programs will still be there.
    You will start running into more problems like this the longer you stick with XP though. That particular OS is over 11 years old, service pack 3 hs been out for over 4 years.
    It may be time for a system upgrade. I personally went from XP to Windows 7 and I haven't looked back one bit.

  • New to Solaris administration - Need some help with some issues

    Hello all,
    I am a new to Solaris administration and need some assistance with a few things. I was going to make separate posts but decided it would be easy to keep track of in one. I really do not know much about the OS but I do have a little Linux background so that might help me out. I am going to number my problems to keep them sorted, so here we go.
    The machine:
    Sunfire V880
    4x 73GB HDs
    PCI dual fiber channel host adapter
    Attached RAID array:
    Sun StorEdge T3 Array with 9x 73GB HDs
    Sun DDS4 Tape Drive in a Unipack
    OS: Solaris 5.10
    Updates: Updated everything except 2 patches (Updating is a real pain isn't it? At least it seems that way to me.)
    1. So I might as well start with the update issues! These 2 updates will not install:
    -PostgreSQL 8.2 source code, (137004-02)
    Utility used to install the update failed with exit code {0}.
    -Patch for mediaLib in solaris, (121620-03)
    Install of update failed. Utility used to install the update is not able to save files. Utility used to install the update failed with exit code 4.
    No idea why the PostgreSQL update is not working, but the medialib patch seems to not have enough hard drive space.
    2. Where are all the drives? I don't know how to find the RAID box or the other 3 internal hard drives. When I installed the OS, I think I installed it on only one hard drive and that might be part of the reason why the medialibe update above says that I don't have enough space.
    3. I probably need more space for the OS and updates, is there a way to "add" space onto the hard drive that currently is running the OS?
    3. Once I see the other hard drives I wish to combine them to make a RAID 0 and RAID 5 array, how do I go about doing that?
    4. How can I find/see the tape drive?
    5. Does my swap space really need to be 64GB? I know the book I have read suggests it, but I only made it 5GB because it didn't seem to make sense to make it 64GB.
    Thank you in advance for the help. I know these are a lot of questions to ask but please go easy on me :)
    rjbanker
    Edited by: rjbanker on Mar 7, 2008 8:21 AM

    SolarisSAinPA*
    1.
    -PostgreSQL 8.2 source code, (137004-02)
    Utility used to install the update failed with exit code {0}.
    Exit code 0 means there were no errors. When you run showrev -p 137004-02, does your system show that the patch is installed? You can check the log for a particular patch add attempt in /var/sadm/patch/+patch_num_rev+1- A bunch of stuff shows up, here is a portion (I am not entirely sure what it means, there must be a least a page of stuff like this):
    Patch: 121081-08 Obsoletes: Requires: 121453-02 Incompatibles: Packages: SUNWc cccrr, SUNWccccr, SUNWccfw, SUNWccsign, SUNWcctpx, SUNWccinv, SUNWccccfg, SUNWcc fwctrl
    Patch: 122231-01 Obsoletes: Requires: 121453-02 Incompatibles: Packages: SUNWc ctpx
    Patch: 120932-01 Obsoletes: Requires: Incompatibles: Packages: SUNWcctpx
    Patch: 123123-02 Obsoletes: Requires: Incompatibles: Packages: SUNWccinv
    Patch: 121118-12 Obsoletes: Requires: 121453-02 Incompatibles: Packages: SUNWc smauth, SUNWppror, SUNWpprou, SUNWupdatemgru, SUNWupdatemgrr, SUNWppro-plugin-su nos-base
    2.
    Where are all the drives? I don't know how to find the RAID box or the other 3 internal hard drives. When I >installed the OS, I think I installed it on only one hard drive and that might be part of the reason why the >medialibe update above says that I don't have enough space.
    When you run format command, how many drives are listed? Identify your root drive (compare with output of df command you ran earlier) Please post here.2. Output of df-hk, looks like I ran out of room. Should I just go ahead and reinstall the OS?
    Filesystem size used avail capacity Mounted on
    /dev/dsk/c1t0d0s0 5.9G 5.4G 378M 94% /
    /devices 0K 0K 0K 0% /devices
    ctfs 0K 0K 0K 0% /system/contract
    proc 0K 0K 0K 0% /proc
    mnttab 0K 0K 0K 0% /etc/mnttab
    swap 42G 1.3M 42G 1% /etc/svc/volatile
    objfs 0K 0K 0K 0% /system/object
    /platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1
    5.9G 5.4G 378M 94% /platform/sun4u-us3/lib/libc_psr.so.1
    /platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1
    5.9G 5.4G 378M 94% /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1
    fd 0K 0K 0K 0% /dev/fd
    swap 42G 1.1M 42G 1% /tmp
    swap 42G 32K 42G 1% /var/run
    /dev/dsk/c1t0d0s7 46G 47M 46G 1% /export/home
    3. So I guess the general consensus is to reinstall the OS, is that correct?
    4. There is nothing in \dev\rmt, and unfortunately I don't have a tape to test it with!
    5. I guess 5GB will be ok for what we do.
    Alan.pae*
    1. I think the above text might explain why it failed, although I don't know how to correct it.
    2. Output of format:
    # mount
    / on /dev/dsk/c1t0d0s0 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=1d80008 on Mon Mar 10 10:56:51 2008
    /devices on /devices read/write/setuid/devices/dev=4dc0000 on Mon Mar 10 10:56:19 2008
    /system/contract on ctfs read/write/setuid/devices/dev=4e00001 on Mon Mar 10 10:56:19 2008
    /proc on proc read/write/setuid/devices/dev=4e40000 on Mon Mar 10 10:56:19 2008
    /etc/mnttab on mnttab read/write/setuid/devices/dev=4e80001 on Mon Mar 10 10:56:19 2008
    /etc/svc/volatile on swap read/write/setuid/devices/xattr/dev=4ec0001 on Mon Mar 10 10:56:19 2008
    /system/object on objfs read/write/setuid/devices/dev=4f00001 on Mon Mar 10 10:56:19 2008
    /platform/sun4u-us3/lib/libc_psr.so.1 on /platform/sun4u-us3/lib/libc_psr/libc_psr_hwcap1.so.1 read/write/setuid/devices/dev=1d80008 on Mon Mar 10 10:56:50 2008
    /platform/sun4u-us3/lib/sparcv9/libc_psr.so.1 on /platform/sun4u-us3/lib/sparcv9/libc_psr/libc_psr_hwcap1.so.1 read/write/setuid/devices/dev=1d80008 on Mon Mar 10 10:56:50 2008
    /dev/fd on fd read/write/setuid/devices/dev=50c0001 on Mon Mar 10 10:56:51 2008
    /tmp on swap read/write/setuid/devices/xattr/dev=4ec0002 on Mon Mar 10 10:56:52 2008
    /var/run on swap read/write/setuid/devices/xattr/dev=4ec0003 on Mon Mar 10 10:56:52 2008
    /export/home on /dev/dsk/c1t0d0s7 read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=1d8000f on Mon Mar 10 10:56:57 2008
    3. Judging by the above text I will be doing a reinstall huh?
    4. Actually I am not familiar with tape backups let alone solaris backup apps! Any suggestions? (Preferably free, have to cut down on costs.)
    5. No comment
    Thanks for the help, hope to hear from you again!
    rjbanker

  • Need some help: my itunes won't sync with my iphone anymore. Both softwares are up to date and I've reinstalled itunes. After I reinstall, it syncs. But then when I reboot my computer, it no longer syncs anymore and I have to keep reinstalling itunes. Tho

    Need some help: my itunes won't sync with my iphone anymore. Both softwares are up to date and I've reinstalled itunes. After I reinstall, it syncs. But then when I reboot my computer, it no longer syncs anymore and I have to keep reinstalling itunes. Thoughts???

    thought that it was possible to have the same iTunes library on any machine that was authorised, a kind of cloud-iTunes I guess. 
    That would convenient, but sadly it is not the case. Sorry!
    Either way your welcome and best of luck!
    B-rock

  • Please I need some help with a table

    Hi All
    I need some help with a table.
    My table needs to hold prices that the user can update.
    Also has a total of the column.
    my question is if the user adds in a new price how can i pick up the value they have just entered and then add it to the total which will be the last row in the table?
    I have a loop that gets all the values of the column, so I can get the total but it is when the user adds in a new value that I need some help with.
    I have tried using but as I need to set the toal with something like total
        totalTable.setValueAt(total, totalTable.getRowCount()-1,1); I end up with an infinite loop.
    Can any one please advise on some way I can get this to work ?
    Thanks for reading
    Craig

    Hi there camickr
    thanks for the help the other day
    this is my full code....
    package printing;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.text.DecimalFormat;
    public class tablePanel
        extends JDialog  implements Printable {
      BorderLayout borderLayout1 = new BorderLayout();
      private boolean printing = false;
      private Dialog1 dialog;
      JPanel jPanel = new JPanel();
      JTable table;
      JScrollPane scrollPane1 = new JScrollPane();
      DefaultTableModel model;
      private String[] columnNames = {
      private Object[][] data;
      private String selectTotal;
      private double total;
      public tablePanel(Dialog1 dp) {
        dp = dialog;
        try {
          jbInit();
        catch (Exception exception) {
          exception.printStackTrace();
      public tablePanel() {
        try {
          jbInit();
        catch (Exception exception) {
          exception.printStackTrace();
      private void jbInit() throws Exception {
        jPanel.setLayout(borderLayout1);
        scrollPane1.setBounds(new Rectangle(260, 168, 0, 0));
        this.add(jPanel);
        jPanel.add(scrollPane1, java.awt.BorderLayout.CENTER);
        scrollPane1.getViewport().add(table);
        jPanel.setOpaque(true);
        newTable();
        addToModel();
        addRows();
        setTotal();
    public static void main(String[] args) {
      tablePanel tablePanel = new  tablePanel();
      tablePanel.pack();
      tablePanel.setVisible(true);
    public void setTotal() {
      total = 0;
      int i = table.getRowCount();
      for (i = 0; i < table.getRowCount(); i++) {
        String name = (String) table.getValueAt(i, 1);
        if (!"".equals(name)) {
          if (i != table.getRowCount() - 1) {
            double dt = Double.parseDouble(name);
            total = total + dt;
      String str = Double.toString(total);
      table.setValueAt(str, table.getRowCount() - 1, 1);
      super.repaint();
      public void newTable() {
        model = new DefaultTableModel(data, columnNames) {
        table = new JTable() {
          public Component prepareRenderer(TableCellRenderer renderer,
                                           int row, int col) {
            Component c = super.prepareRenderer(renderer, row, col);
            if (printing) {
              c.setBackground(getBackground());
            else {
              if (row % 2 == 1 && !isCellSelected(row, col)) {
                c.setBackground(getBackground());
              else {
                c.setBackground(new Color(227, 239, 250));
              if (isCellSelected(row, col)) {
                c.setBackground(new Color(190, 220, 250));
            return c;
        table.addMouseListener(new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
            if (e.getClickCount() == 1) {
              if (table.getSelectedColumn() == 1) {
       table.setTableHeader(null);
        table.setModel(model);
        scrollPane1.getViewport().add(table);
        table.getColumnModel().getColumn(1).setCellRenderer(new TableRenderDollar());
      public void addToModel() {
        Object[] data = {
            "Price", "5800"};
        model.addRow(data);
      public void addRows() {
        int rows = 20;
        for (int i = 0; i < rows; i++) {
          Object[] data = {
          model.addRow(data);
      public void printOut() {
        PrinterJob pj = PrinterJob.getPrinterJob();
        pj.setPrintable(tablePanel.this);
        pj.printDialog();
        try {
          pj.print();
        catch (Exception PrintException) {}
      public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
        Graphics2D g2 = (Graphics2D) g;
        g2.setColor(Color.black);
        int fontHeight = g2.getFontMetrics().getHeight();
        int fontDesent = g2.getFontMetrics().getDescent();
        //leave room for page number
        double pageHeight = pageFormat.getImageableHeight() - fontHeight;
        double pageWidth =  pageFormat.getImageableWidth();
        double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
        double scale = 1;
        if (tableWidth >= pageWidth) {
          scale = pageWidth / tableWidth;
        double headerHeightOnPage = 16.0;
        //double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
        //System.out.println("this is the hedder heigth   " + headerHeightOnPage);
        double tableWidthOnPage = tableWidth * scale;
        double oneRowHeight = (table.getRowHeight() +  table.getRowMargin()) * scale;
        int numRowsOnAPage = (int) ( (pageHeight - headerHeightOnPage) / oneRowHeight);
        double pageHeightForTable = oneRowHeight *numRowsOnAPage;
        int totalNumPages = (int) Math.ceil( ( (double) table.getRowCount()) / numRowsOnAPage);
        if (pageIndex >= totalNumPages) {
          return NO_SUCH_PAGE;
        g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    //bottom center
        g2.drawString("Page: " + (pageIndex + 1 + " of " + totalNumPages),  (int) pageWidth / 2 - 35, (int) (pageHeight + fontHeight - fontDesent));
        g2.translate(0f, headerHeightOnPage);
        g2.translate(0f, -pageIndex * pageHeightForTable);
        //If this piece of the table is smaller
        //than the size available,
        //clip to the appropriate bounds.
        if (pageIndex + 1 == totalNumPages) {
          int lastRowPrinted =
              numRowsOnAPage * pageIndex;
          int numRowsLeft =
              table.getRowCount()
              - lastRowPrinted;
          g2.setClip(0,
                     (int) (pageHeightForTable * pageIndex),
                     (int) Math.ceil(tableWidthOnPage),
                     (int) Math.ceil(oneRowHeight *
                                     numRowsLeft));
        //else clip to the entire area available.
        else {
          g2.setClip(0,
                     (int) (pageHeightForTable * pageIndex),
                     (int) Math.ceil(tableWidthOnPage),
                     (int) Math.ceil(pageHeightForTable));
        g2.scale(scale, scale);
        printing = true;
        try {
        table.paint(g2);
        finally {
          printing = false;
        //tableView.paint(g2);
        g2.scale(1 / scale, 1 / scale);
        g2.translate(0f, pageIndex * pageHeightForTable);
        g2.translate(0f, -headerHeightOnPage);
        g2.setClip(0, 0,
                   (int) Math.ceil(tableWidthOnPage),
                   (int) Math.ceil(headerHeightOnPage));
        g2.scale(scale, scale);
        //table.getTableHeader().paint(g2);
        //paint header at top
        return Printable.PAGE_EXISTS;
    class TableRenderDollar extends DefaultTableCellRenderer{
        public Component getTableCellRendererComponent(
          JTable table,
          Object value,
          boolean isSelected,
          boolean isFocused,
          int row, int column) {
            setHorizontalAlignment(SwingConstants.RIGHT);
          Component component = super.getTableCellRendererComponent(
            table,
            value,
            isSelected,
            isFocused,
            row,
            column);
            if( value == null || value .equals("")){
              ( (JLabel) component).setText("");
            }else{
              double number = 0.0;
              number = new Double(value.toString()).doubleValue();
              DecimalFormat df = new DecimalFormat(",##0.00");
              ( (JLabel) component).setText(df.format(number));
          return component;
    }

  • I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated.

    I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated. Heres an image of before and after. The first image I use is a JPG 72dpi 1500px x1500px and I want to downsize it to 600x600px same res, but it keeps pixelating, this has never happened before. Any suggestions, thoughts?
    thanks!

    I wouldn't say pixelated; more like blurry.
    Like ConnectedCreative said, what steps are you using? Are you using "bicubic sharper" when resizing down?

  • Hi, can anyone help me out with this, I need some help on designing GUI for e-learning coursewares. Some tutorials or some helpful sites will do.

    I need some help with the GUI design.

    Have you tried the line inputs on the back of your FirePod? If you update its firmware (not sure if you will need to or not), I seem to remember hearing that the FirePod can run without FW connection, i.e. stand alone. In this mode with the outs from your mixer into line ins 1-2 (2nd from left on the back) it should work fine. I say should because I have never tried. However, these are used for returns from an external effects unit. I assume here, and the important word is assume, that there are two so that they can be used as a stereo send or as a mono send. Worth a try! Let us know how it goes.
    Best, Fred

  • Need some help with a remove function

    Design and code a program that will maintain a list of product names. Use a String type to represent the product name and an array of strings to implement the list. Your program must implement the following methods:
    Add a product to the list
    Remove a product from the list
    Display then entire list
    Find out if a particular product is on the list.
    You need to create a command command loop with a menu() function. The program must continue asking for input until the user stops.
    This is the assignment and this is what I have so far. I need some help writing the remove function.
    Thanks
    * Title: SimpleSearchableList.java
    * Description: this example will show a reasonably efficient and
    * simple algorithm for rearranging the value in an array
    * in ascending order.
    public class SimpleSearchableList {
         private static String[] List = new String[25]; //These variables (field variables)
         private static int Size; //are common to the entire class, but unavailable
         //except to the methods of the class...
         public static void main(String[] args)
              String Cmd;
              for(;;) {
                   Menu();
                   System.out.print("Command: ");
                   Cmd = SimpleIO.inputString();
                   if(Cmd.equals("Quit"))
                        break;
                   else if(Cmd.equals("Fill"))
                        FillList();
                   else if(Cmd.equals("Search"))
                        SearchList();
                   else if(Cmd.equals("Show"))
                        ShowList();
                   else if(Cmd.equals("Remove"))
                        Remove();
         //Tells you what you can do...
         public static void Menu()
              System.out.println("Choices..................................");
              System.out.println("\tFill to Enter Product");
              System.out.println("\tShow to Show Products");
              System.out.println("\tSearch to Search for Product");
              System.out.println("\tRemove a Product");
              System.out.println("\tQuit");
              System.out.println(".........................................");
         //This method will allow the user to fill an array with values...
         public static void FillList()
              int Count;
              System.out.println("Type Stop to Stop");
              for(Count = 0 ; Count < List.length ; Count++)
                   System.out.print("Enter Product: ");
                   List[Count] = SimpleIO.inputString();
                   if(List[Count].equals("Stop"))
                        break;
              Size = Count;
         //This method will rearrange the values in the array so that
         // go from smallest to largest (ascending) order...
         public static void SearchList()
              String KeyValue;
              boolean NotFoundFlag;
              int Z;
              System.out.println("Enter Product Names Below, Stop To Quit");
              while(true)
                   System.out.print("Enter: ");
                   KeyValue = SimpleIO.inputString();
                   if(KeyValue.equals("Stop")) //Note the use of a method for testing
                        break; // for equality...
                   NotFoundFlag = true; //We'll assume the negative
                   for(Z = 0 ; Z < Size ; Z++)
                        if(List[Z].equals(KeyValue)) {
                             NotFoundFlag = false; //If we fine the name, we'll reset the flag
              System.out.println(List[Z] + " was found");
                   if(NotFoundFlag)
                        System.out.println(KeyValue + " was not found");     
         //This method will display the contents of the array...
         public static void ShowList()
              int Z;
              for(Z = 0 ; Z < Size ; Z++)
                   System.out.println("Product " + (Z+1) + " = " + List[Z]);
         public static void Remove()
    }

    I need help removing a product from the arrayYes. So what's your problem?
    "Doctor, I need help."
    "What's wrong?"
    "I need help!"
    Great.
    By the way, you can't remove anything from an array. You'll have to copy the remaining stuff into a new one, or maybe maintain a list of "empty" slots. Or null the slots and handle that. The first way will be the easiest though.

  • Need some help with a Macally enclosure and a spare internal drive

    Need some help with a Macally enclousure
    Posted: Oct 1, 2010 10:55 AM
    Reply Email
    Aloha:
    I have a Macally PHR-S100SUA enclousure that does not recognise,my WD 1001fals hard drive. It has worked just fine with other internal drives, but not this one?
    This is a spare internal drive that I am trying to make an external drive to store back ups for a lot of data. But so far I can not get it recognized by the computer. Maybe I need different drivers?
    Any suggestions?
    Dan Page

    Hi-
    Drivers aren't typically needed for external enclosures.
    Macally has none listed for that enclosure.
    The same is true for the WD drive, internal or external; no drivers.
    With the exception of high end PM multi drive enclosures, I can't think of any that use drivers.
    How is the external connected?
    Have you tried different cables, different ports?
    Bad/damaged cables are fairly common.
    Have you verified connections inside of the enclosure?

  • Need some help with putting a folder in users directory

    I'm not sure how to do this, but what I want to do is put this file in C:/My Documents, but I need to be able to verify that C://My Documents exists, if not put it in C:/Program Files.
    Can any one help me out?
    try {
                        String[] contactArray = parseDatFile(fc.getSelectedFile());
                        Document document = createXMLDocument(contactArray);
                        saveToXMLFile(
                        document,
                        new File(
                        "C:/Program Files/xxx/",// looks for directory for list
                        "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"));
                    } catch (Exception exc) {
                        File f = new File("C:/Program Files/xxx/");// setting directory for list if not there
                        boolean yes = true;
                        yes = f.mkdir();// creating directory
                        try {
                            String[] contactArray = parseDatFile(fc.getSelectedFile());
                            Document document = createXMLDocument(contactArray);
                            saveToXMLFile(
                            document,
                            new File(
                            "C:/Program Files/xxx/",// used only if the directory didn't exist
                            "xxxxxxxxxxxxxxxxxxxxxxx"));

    Need some help with putting a folder in users directoryI recomend using System.getProperty( "user.home" ) not a hard-coded value.
    This will use the users home folder ( C:\My Documents ) on Win9X (I guess), C:\Documents and Settings\<current user> on Win2K +, and ~ on Unix-a-likes.

Maybe you are looking for