Need help making pace invaders in java

So here is my code:
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.*;
import javax.swing.JFrame;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.net.URL;
import javax.imageio.ImageIO;
public class invaders extends Canvas {
public static final int Width = 800;
public static final int Height = 600;
public invaders() {
JFrame openspace = new JFrame("Space Invaders");
JPanel window = (JPanel)openspace.getContentPane();
setBounds(0,0,Width,Height);
window.setPreferredSize(new Dimension(Width,Height));
window.setLayout(null);
window.add(this);
openspace.setBounds(0,0,Width,Height);
openspace.setVisible(true);
openspace.addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
public void paint(Graphics graph) {
// graph.setColor(Color.red);
// graph.fillOval( Width/2-10, Height/2-10,20,20);
// spacealien = loadImage("spaceAlien.jpg");
// graph.drawImage(spaceAlien, 50, 50, this);
public static void main(String[] args) {
invaders spaceinvaders = new invaders();
I am trying to add pictures into the JFrame but I don't know how. I am following this tutorial http://www.planetalia.com/cursos/Java-Invaders/JAVA-INVADERS-04.tutorial but I get confused when they talk about how to add in an image.
This is their Code:
1 package version04;
2 /**
3 * Curso B?sico de desarrollo de Juegos en Java - Invaders
4 *
5 * (c) 2004 Planetalia S.L. - Todos los derechos reservados. Prohibida su reproducci?n
6 *
7 * http://www.planetalia.com
8 *
9 */
10
11
12 import java.awt.Canvas;
13 import java.awt.Dimension;
14 import java.awt.Graphics;
15 import java.awt.event.WindowAdapter;
16 import java.awt.event.WindowEvent;
17 import java.awt.image.BufferedImage;
18 import java.net.URL;
19
20 import javax.imageio.ImageIO;
21 import javax.swing.JFrame;
22 import javax.swing.JPanel;
23
24 public class Invaders extends Canvas {
25 public static final int WIDTH = 800;
26 public static final int HEIGHT = 600;
27
28
29 public Invaders() {
30 JFrame ventana = new JFrame("Invaders");
31 JPanel panel = (JPanel)ventana.getContentPane();
32 setBounds(0,0,WIDTH,HEIGHT);
33 panel.setPreferredSize(new Dimension(WIDTH,HEIGHT));
34 panel.setLayout(null);
35 panel.add(this);
36 ventana.setBounds(0,0,WIDTH,HEIGHT);
37 ventana.setVisible(true);
38 ventana.addWindowListener( new WindowAdapter() {
39 public void windowClosing(WindowEvent e) {
40 System.exit(0);
41 }
42 });
43 }
44
45 public BufferedImage loadImage(String nombre) {
46 URL url=null;
47 try {
48 url = getClass().getClassLoader().getResource(nombre);
49 return ImageIO.read(url);
50 } catch (Exception e) {
51 System.out.println("No se pudo cargar la imagen " + nombre +" de "+url);
52 System.out.println("El error fue : "+e.getClass().getName()+" "+e.getMessage());
53 System.exit(0);
54 return null;
55 }
56 }
57
58
59 public void paint(Graphics g) {
60 BufferedImage bicho = loadImage("res/bicho.gif");
61 g.drawImage(bicho, 40, 40,this);
62 }
63
64 public static void main(String[] args) {
65 Invaders inv = new Invaders();
66 }
67 }
68
I know there must be an easier way. Please help, thanks!!!!

One way to add an image to a user interface is to use a JLabel with an ImageIcon: [http://java.sun.com/docs/books/tutorial/uiswing/components/label.html]

Similar Messages

  • I need help making Adobe Edge animation appear correctly on iphones, ipads and android phones.

    I need help making Adobe Edge animation appear correctly on iphones, ipads and android phones. It currently looks fine on desktops and androids. I am using wordpress with a responsive theme (Canvas). I will need you to document The url is http://adamhtc.org.s183459.gridserver.com.

    Thanks George, interesting thought.  I looked on Adobe's site and they "advertise" fillable forms for the iPhone and Android markets, but on the Windows Phone tab, that is mysteriously missing.  lol    Maybe it will come later?   Meanwhile, I'll google to see if there are any PDF viewers that can handle it now.   Thanks for the reply.  :-)

  • My grandma is a new apple user and she needs help making an apple account.

    my grandma is a new apple user and she needs help making an apple account.

    She should call Apple support or visit the Genius Bar at an Apple store (make an appointment first at http://apple.com/retail). They will walk her through the process.

  • Need Help making a Screencast for IPHONE

    Hello there
    I need some serious help making a screencast for a client - for it's Iphone Apps -
    something similare to this
    http://www.newsluxe.com/chaumet-et-iphone.php
    but more sexy, with a animated background and a different type of cursor.
    Anyideas ?
    I really don't know where to start - I found leads however :
    Camtasia Studio , screenflow, ,
    Maybe you could help me filling the gaps.
    Thanks for your help !

    does anyone know how apple made these forums?
    I think they use Jive:
    http://www.jivesoftware.com/products/forums/
    The Apple way for users to add photos is the .Mac web gallery:
    http://www.apple.com/ilife/iphoto/#webgallery

  • Need help making a simple script for my webcam

    Hey everyone, fairly new to applescript programming. I just bought a usb camera for my macbook because I use it for video conferencing/playing around, and it is better quality than the built in isight. However, in order to use this camera I need to use drivers from a program called camTwist. This being said camTwist needs to be opened first and the usb camera must be selected from camTwist Step 1 list in order for any other application to use the camera. I just want to make a simple program that would open camTwist first, then select "webcam" from the list (double click it like I always have to in order to select it) in order to activate the driver, and then open photo booth which would then be using the camTwist driver in order to take pictures.
    I made a crude program but it does not automatically select "webcam" from the Step 1 list in camTwist:
    tell application "CamTwist" to activate
    delay 10
    tell application "Photo Booth" to activate
    that’s basically it. I set the delay to 10 seconds so that when camTwists boots up first I can manually select my webcam. HOWEVER, I would like to make a script that would boot up CamTwist first, select my webcam from the list automatically, and then open Photo Booth with the CamTwist webcam driver already selected.
    Don't know much about applescript so any help to make a working script to solve my problem would be greatly appreciated! Thanks!

    Solved my problem but now I need help with something else! First I used CamTwist user options to create user defined hot keys with the specific purpose to load the webcam. I chose Command+B. I tested it out in CamTwist and it worked. The program follows a logical order from there. First it loads CamTwist, then after a short delay it presses the hot keys in order to load the webcam from the video source list, then another short delay and Photo Booth is opened with the driver loaded from camTwist. Everything works Perfect! Here's the code:
    tell application "System Events"
    tell application "CamTwist" to activate
    delay 0.5
    --Press command+b which is a user defined hot key to load webcam
    key code 11 using command down
    end tell
    delay 0.5
    tell application "Photo Booth" to activate
    My Next question is, would it be possible with this same script to have both applications quit together. For example I always quit Photo Booth first, so when I quit photo booth is there a way to make CamTwist also quit and keep everything within the same script? Please let me know. This forum has been very helpful and lead me to a solution to my problem! Hoping I can solve this next problem as well! Thanks everyone.

  • I need help for printing service in Java

    Hello :
    I need to print some file from java program .
    I did every thing , but when i run the program : it didn't return any printer as print service from the system, although I install 2 printers in my system.
    by the way : i use Windows XP

    I was in a rush this morning and forgot my crystal ball. Please post your code and remember to use the code tags.

  • I need help making a square that scans across a screen.

    i'm trying to make a program that creates images of a square scanning across a black background.  so far all i have is a program that makes one image where i can alter the size of the square and its position.  I'm very very new to labview and i need help with the structure that would create all the images of the square scanning across and then shift down and scan across again.
    thank you very much,
    Joseph Sadler
    Attachments:
    Drawexample.vi ‏24 KB

    As Lynn found, there is a memory problem with the vi which didn't show up in my limited testing.
    Using Shift Registers with Picture Controls can cause problems.
    See this thread.
    Try the attached "mod" version.
    Then I got to thinking, why redraw the box (2x with "erase") - when you could just move a box around?
    (Note: I used a picture for the box, but you could use other objects.)
    The "mod1" version does it this way.
    steve
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    squarescan mod.vi ‏20 KB
    squarescan mod 1.vi ‏20 KB

  • I need help making a new Arch install ISO

    I have posted a couple of messages, but as yet no one seems to have responded, probably because they have not read them.
    I need help building a new ISO for Arch, to take account of dmraid.
    I can and have built ones that get so far, and clearly I am not that far away.
    All I need help with now is getting at the contents of the initial ramdisk (/isolinux/initrd.img) so I can make a new one with modifications, and if anyone can help, I need a hand working out how to use the kernel26.img that I will end up with on a system.
    Any help appreaciated.

    As far as I know this will be included in the next ISO release. I solved it by manually bringing the dmraid package to the install and wrote a guide on installing your root system on dmraid. However when the system crashes I have the slight inconvenience of having to install dmraid and manually mount the sets to do a recovery. I guess this is the part you want to get rid of aswell. I decided to wait until the next holy ISO.

  • Need help making this class Runnable.

    Hello,
    This class (see below) is working fine the way it is but I have a little problem, I need to execute aprox 500+ commands and each command takes between 30sec to 3 minutes to complete which translate into hours for the job to finish.
    I want to speed the process by multi-tasking and executing (possibly) all commands simultaniously by somehow making this class Threaded/Runnable (miltitasking). There must be something tricky about Runtime class and cannot figured it out.
    Your help would be highly appreciated.
    Regards,
    Ulises
    public class CmdTest {     
    public static void main(String[] args) throws java.io.IOException {
    String outFile = "./ds8300/lsvogrp.txt";
    PrintWriter bout = null;
    try {
    bout     = new PrintWriter(                         new FileWriter(new File(outFile)));     
    } catch (IOException e) {
         e.printStackTrace();
    Runtime run = Runtime.getRuntime();
    run.traceMethodCalls(true);
    Process proc2 = run.exec("cmd /c dscli -user user -passwd psw" + "lsvolgrp -l");
    BufferedWriter ot = new BufferedWriter(
    new OutputStreamWriter(proc2.getOutputStream()));
    BufferedReader br = new BufferedReader(
    new InputStreamReader(proc2.getInputStream()));
    BufferedReader er = new BufferedReader(
    new InputStreamReader(proc2.getErrorStream()));
    try {
    String s;
    while((s=br.readLine())!=null) {
         System.out.println(""+s);
         bout.println(s);
    while((s=er.readLine())!=null) System.out.println("ERR:"+s);
    bout.close();
    System.exit(0);
    }catch (Exception ie) { //catch (InterruptedException ie) {
    System.out.println("Interrupted:"+ie.getMessage());}
    }

    Seems like the same question you asked last year.
    http://forum.java.sun.com/thread.jspa?threadID=5181153&messageID=9705196#9705196
    The proper way to design software is to start at the beginning and design Classes. Not try to butcher that which is working.
    You're running work outside the JVM and this work might interfere with other, similar work (the multi-threading issue.)
    I'd start with paper and pencil and see what conflicts might arise.

  • Need help making ball move and bounce off of sides of JPanel

    I'm currently working on a program that creates a ball of random color. I'm trying to make the ball move around the JPanel it is contained in and if it hits a wall it should bounce off of it. I have been able to draw the ball and make it fill with a random color. However, I cannot get it to move around and bounce off the walls. Below is the code for the class that creates the ball. Should I possible be using multithreads? As part of the project requirements I will need to utilizes threads and include a runnable. However, I wanted to get it working with one first and than add to it as the final product needs to include new balls being added with each mouse click. Any help would be appreciated.
    Thanks
    import java.awt.Color;
    import java.awt.Graphics;
    import javax.swing.JPanel;
    public class Ball extends JPanel{
        Graphics g;
        int rval; // red color value
        int gval; // green color value
        int bval; // blue color value
        private int x = 1;
        private int y = 1;
        private int dx = 2;
        private int dy = 2;
        public void paintComponent(Graphics g){
            for(int counter = 0; counter < 100; counter++){
                // randomly chooses red, green and blue values changing color of ball each time
                rval = (int)Math.floor(Math.random() * 256);
                gval = (int)Math.floor(Math.random() * 256);
                bval = (int)Math.floor(Math.random() * 256);
                super.paintComponent(g);
                g.drawOval(0,0,30,30);   // draws circle
                g.setColor(new Color(rval,gval,bval)); // takes random numbers from above and creates RGB color value to be displayed
                g.fillOval(x,y,30,30); // adds color to circle
                move(g);
        } // end paintComponent
        public void move(Graphics g){
            g.fillOval(x, y, 30, 30);
            x += dx;
            y += dy;
            if(x < 0){
                x = 0;
                dx = -dx;
            if (x + 30 >= 400) {
                x = 400 - 30;
                dx = -dx;
            if (y < 0) {
                y = 0;
                dy = -dy;
            if (y + 30 >= 400) {
                y = 400 - 30;
                dy = -dy;
            g.fillOval(x, y, 30, 30);
            g.dispose();
    } // end Ball class

    Create a bounding box using the size of the panel. Each time you move the ball, check that it's still inside the box. If it isn't, then change it's direction. You know where the ball is, (x, y), so just compare those values to the boundary values.

  • Needing help making a Slideshow in Premiere 7

    Back in 2008 several contributors on this forum helped me make a slideshow using Photoshop Elements 6 and Premiere Elements 4, which I am forever grateful for. It was a long process as I had never made a slideshow before, but after much labor I created a wonderful slideshow of my Alaska photos with music. After a lot of reading I decided to upgrade to Elements and Premiere 7, which I was able to actually do for free.   I purchased the Muvipix.com Guide to Adobe Premiere Elements 7 as I was told this would be a great resource to help me out. Well, here I am two years later trying to make a slideshow again and still as confused as ever. I am trying to make the slideshow in Adobe Premiere Elements, as I was told last time it was easier to do it that way if I wanted to add music to it. I am just getting started and am already confused.
    My first question is: Am I best off making the slide show in Premiere Elements rather than Photoshop Elements? I want to add music to it.
    I have tried using both the book that came with the program and the Muvipix book and I am lost on step one.
    In the Adobe manual it says to deselect the Show Video and Show Audio buttons. Why do I need to deselect these?
    In the Muvipix book it tells me to select a number of clips amd then either right-click on them or click on the ">>" button to access the "Create Slideshow" too.  I can't find the ">>" button. How do I access the the "Create Slideshow" feature?
    I have a question about the stills that show up in the panel. Many actual photos appear in this panel. However, there are also a large group of boxes with two swirling arrows, one green and one red. Why are they there rather than actual photos? I have tried double clicking on a few and they all bring up the same photo folder from "my pictures." I am confused.
    Sorry if my questions seem very basic, but this is not what I do for a living. It is a once every couple of year hobby. Perhaps if I ever get it downpat I will do it more often.
    Thanks for any help you can give me. I am sure I will need a little more handholding. I have been looking for the last two years for a class on this program. I know that is what I need. However, none have been available in my area.

    Thanks for the response Steve. I am hoping it will be easier this time around.
    "If you're seeing empty boxes with swirling arrows in them instead of your photos in the Project panel, it means that the program no longer has access to the photos -- either because they were moved or the device that they were on (your camera?) was disconnected from the computer. You really need to copy these photos to your computer's hard drive if you're going to use them in a project"
    These photos were still on the harddrive. I checked in Photoshop Elements and they needed to get reconnected. Here is what I think happened. When I download my photos, they go into MY PICTURES. When I move them from where they automatically get placed by the program, into a folder of my choice, they seem to get "unconnected". I was able to reconnect them and now they appear in Premiere Elements. Thanks for the tip which actually led me to a solution.
    "There are actually at least four different ways to make a slideshow in Premiere Elements and Photoshop Elements. Each has advantages. Which method are you using? (In all cases, as I say in my book, you should make sure your photos are sized to no larger than 1000x 750 pixels in size before you begin.)"
    I am just starting and I was using Premiere Elements 7. I thought I was told back in 2008 on this forum it was easier to do it all in Premiere Elements if I wanted to add music rather than creating it in Photoshop Elements and then moving it to Premiere. As far as photo size, I am a real beginner here. I have no idea what size they are or where to look to find that out. All I know is that  my Alaska slideshow turned out great and did nothing about changing pixels. Where would I find out how to change pixel size?
    "It sounds like you're using the Create Slideshow tool in the Project media panel. (As I say in Chapter 1, you'll only be able to see the >> menus if you go to the Window drop-down menu and select Show Docking Headers.) You can also access this tool by selecting all of the photos you want to include in the Project panel and right-clicking on them."
    I did read about Show Docking Headers and did follow that instruction. That was the first thing I did, actually. However, when I am in Premiere ELements, I still don't see where I find the Create Slideshow tool that you mention on p. 59. I am a bit confused with this option. I can move the photos I want from the panel to the Timeline, but I am confused as to where the "Create Slideshow Tool" is located.
    Thanks again for your help.I know I will get this done, just very slowly.

  • Noob Needs Help Making Algorithm !!

    Hi, i just started talking java class at my university & my teacher just hit me with some
    home work which i have no idea how to do.
    This is the first question: (I think I just need a helping hand to get me started)
    Write an algorithm to compute the arrival time of a train, if you know the starting time and the distance to destination (in km). Assume that the average speed of the train is 60km/h. The start time is given as the hour (using 24h notation) and the minutes. For example, if the start time is 13:46, the user will input 13 and 46. Assume that the hour and minutes provided are valid values. The output will consist in two numbers, one for the hours and one for the minutes.
    Example: if the train travels 210 km, and the start time is 10:20, then the arrival time will be 13:50 (actually two numbers representing 13h and 50min).
    THANKS, FROM A DESPERATE NOOB

    slvr99 wrote:
    Assume that the average speed of the train is 60km/h.
    Example: if the train travels 210 km, and the start time is 10:20, then the arrival time will be 13:50 (actually two numbers representing 13h and 50min).The best approach for you I think is to turn the time of the day into minutes. In the example the time of the day is given as 10 hours and 20 minutes. That would be 10*60 + 20 = 620 minutes.
    Then the average speed is given as 60 km/h which translates to 60/60 = 1 km per minute. Each kilometer takes 1 minute (conveniently chosen speed isn't it -:). If the train travels 210 kilometers that will take 210 minutes.
    Now if you add the travel time of 210 minutes to the start time of 620 minutes you get the arrival time. It becomes 620+210 = 830 minutes.
    The final question is how to turn the arrival time given in minutes back to the hour:minute representation? Well how many full hours is 830 minutes. You can calculate that by doing an integer division of 830 with 60. The integer division will scrap the fractional par leaving only full hours. This is 830/60 = 13 hours. Finally the 13 hours represent 13*60 = 780 minutes which you should subtract from the 830 to get the minutes that didn't amount to a full hour. This is 830-780=50 minutes. So the arrival time will be 13 hours and 50 minutes, or 13:50.

  • Need Help making a navigation menu for a website

    Alright so I've been having some problems getting this to work correctly. I am making a navigation menu for a website and I'm trying to get when I hover over the main header a drop down appears animated of course below it. I also want when you highlight a specific text line for it to highlight blue along with a rectangle behind it to change to a lighter shade of red.
    Some of the problems  I have been running into is play and stop commands on mouseover and them not stopping when they should and getting the text to change color.
    Thanks for the help.
    Here are some screen grabs of what I am doing
    http://imgur.com/W2bZuF3
    http://imgur.com/W2bZuF3
    http://imgur.com/2GI3y71

    Your page's code is still a bit of a wreck.  Do you ever look at it?
    <html>
    <style type="text/css">#p7MBM_1 {
      width: 951px;
    You need a doctype first - I recommend HTML4.01 Transitional.  Open this (and other pages) in DW and use FILE | Convert > HTML 4.01 Transitional, then save.  But wait until you do the other changes recommended below before doing this.
    Add a <head> tag below the <html> tag.
    Add a <title> tag below the <head> tag.
    Add this below the <title> tag - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    Add </head> below this -
    <style type="text/css">
    <!--
    .style10 {font-family: "Goudy Old Style"}
    -->
    </style>
    You may want to change that font-family style to "Goudy Old Style, Geneva, Times, 'Times New Roman', serif", since Goudy is not web safe.
    Move <body> below that </head> you just added.
    That will clean your code up a bit.  Let's look at the page again when you have done these.

  • I need help making a pie chart

    Hello, hoping for some help with making a chart that will update as i continually input data
    I have a chart that has many columns logging details of win/loss records. I would like to make a pie chart that represents a set of columns and shows the ratio of wins for each of the columns.
    I will try and give some better details. There are 5 columns (j,k,l,m,n) and each represents a color. In each column there are check-boxes. 1 or more will be checked on each row. On the same row there is a tally of wins. each row represents a different day. What I am looking for is a pie chart that shows how many wins i have in each color.
    for example.
    nov 1st: 5 wins in color J
    nov 2nd: 2 wins in color k
    nov 3rd: 4 wins in colors m and n
    the pie chart will contain a total of 15 'wins' split up on the chart between each color....... 5(j) + 2(k) + 4(m) + 4(n). theoretically the J should take up 1/3rd of the pie and so on.
    I also have a total at the bottom of the colors column, but this will not show which color got the wins.
    Hopefully this makes some sense to understand and if I am very fortunate someone much smarter then me will be generous enough to help me out.
    Thank you very much, all help is appreciated.

    Hi Anthony,
    This table may be  what you want. I added a row at the top (you don't need that row. It is just may way of getting around the poor screen shots in this forum).
    I hid some columns, then I copied the table and pasted directly into this reply (I have had it with screen shots ).
    A
    F
    J
    K
    L
    M
    N
    Date
    Wins
    Colour J
    Colour K
    Colour L
    Colour M
    Colour N
    Nov 1
    1
    TRUE
    Nov 2
    1
    TRUE
    Nov 3
    2
    TRUE
    TRUE
    Checkboxes show as TRUE (not a tick) in this pasted table. But a tick = TRUE .
    Formula in F3 (Wins, Nov 1)
    =COUNTIF(J3:N3,"=TRUE")
    I hope this helps with your pie chart.
    Regards,
    Ian.

  • I need help making a program. It deals with BaseTime.

    Hey. Look im having a lot of trouble with a program. It is actually a program i have to make based on another program that i was given. it is called BaseTimeTest. here is the code of that program:
    import java.io.PrintStream;
    public class BaseTimeTest
         public static void main(String[]args)
              PrintStream out = System.out;
              BaseTime t0 = new BaseTime();
              out.println(t0);
              BaseTime t1 = new BaseTime(13,25,46);
              out.println(t1);
              BaseTime t2 = new BaseTime(6,0);
              out.println(t2);
              try
                   BaseTime tbad = new BaseTime(23,59,60);
                   out.println(tbad);
              catch(IllegalArgumentException e)
                   System.err.println(e.getMessage());
              long ctime = System.currentTimeMillis();
              ctime /= 1000;
              ctime %= BaseTime.SECONDS_PER_DAY;
              out.println(ctime);
              BaseTime t3 = new BaseTime((int)ctime);
              outprintln(t3);
              int h=t3.getHours()-5;
              if(h<0)h+=24;
                   out.println(h+":"+t3.getMinutes()+":"+t3.getSeconds());
              out.println(t3.getSecondsSinceMidnight());
              t3.setHours(12);
              t3.setMinutes(0);
              t3.setSeconds(0);
              out.println(t3);
              t2=new BaseTime(13,25,46);
              if(t1.equals(t2))
                   out.println(t1+"=="+t2);
              else
                   out.println(t1+"!="+t2);
              t2.setMinutes(37);
              out.println(t1+"?"+t2+"=>"+t1.compareTo(t2));
              out.println(t1+"diff"+t2+"=>"+t1.diff(t2));
              t1=new BaseTime(3,14,25);
              t2=new BaseTime(5,48,45);
              out.println(t1+"plus"+t2+"=>"+t1.plus(t2));
              out.println(t1+" + "+t2+"=>");
              t1.add(t2);
              out.println(t1);
    What i have to do is create the class which this program uses to run called BaseTime. I know that the java system already has a class named baseTime() but i have to make my own. I need to make get and set methods but i am asking all of you if you can give me some ideas and maybe even code samples. The help would be greatly appreicated. i'll reply to what you say but it maynot be right away as i am very busy.

    I need a setHours method, a setMinutes method, a
    setSeconds method, a getHours method, a getMinutes
    method, a getSeconds method, java.util.Calendar effectively has all these.
    a setSecondsSinceMidnight method, and a getSecondsSinceMidnight method. Not hard to come up with.
    I also need multiple BaseTime methods because i need to have
    overloaded methods because each method has to take in
    different arguments. One takes in no arguments, one
    takes in one argument, one takes in two arguments and
    one takes in three arguments. And what are these methods doing?
    I also need methods that convert milliseconds to seconds, one that
    converts minutes to seconds and one that converts
    hours to seconds. This is all pretty simple. I would extend GregorianCalendar or wrap a GregorianCalendar. Most of what you need is already there, and all you need to do is add the few other methods.
    getSecondsSinceMidnight - make a calendar representing midnight, get the milliseconds value for both, subtract, convert to seconds.
    setSecondsSinceMidnight - I would try setLenient(false), set the calendar to midnight, and then just set the seconds field. Might work.
    Conversion - simple arithmetic.
    Other methods - you didn't mention what they do.

Maybe you are looking for

  • Windows stops responding and closes when I try to print

    I have IE 9 on a vista 64 bit.  Recently I had some problems with print jobs staying in the que.  I resolved that and reinstalled the printer and drivers.  I have a photosmart 5514.  Ever since that day I can't print off a webpage.  Coupons, bank sta

  • How to deploy a .war file in jboss  using eclipse

    Hi, iam new to using eclipse as my ide. i have installed the jboss ide in it. i have a servlet and i would like to deploy the servlet in jboss through eclipse, can some one help me with this

  • Standard edition tuning

    Dear all, We have 11gr2 rac standard edition installed on solaris 10. Using statspack, we found that highly elapsed times queries are consuming cpu .We idenitifed the queries. but , how to tune this queries ?. In enterprise edition,we can use tuning

  • Web pages load SLOW on IPad: how to disable DNS prefetching; other ideas?

    Brand new IPad 16 GB WiFi + brand new Airport Extreme in bridge mode. Comparing IPad web page load speeds with side-by-side WinXP computer running IE8. Any web site will do: take www.apple.com if you want. Problem: IPad web pages generally load much

  • Replication of hierarchical levels labels from ECC to SRM

    Hi Gurus! I am working on SRM 5.0 in Classic scenario and ECC 6. We are trying to replicate data from ECC to SRM in order to retrieve the same organisational structure as the one existing in ECC in SRM. We succeed in replicating hierarchical levels f