Help adding to JLayeredPane

basically I need to create a panel with a background, then use JLayeredPane to put 2 other panel on top of each other over the background. The problem is that each panel will display properly by with the background but not all 3 together.
/* main gui class for the four score game.*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GuiMain extends JFrame
     //declare variables
     private JButton quit = new JButton("Quit");
     private JButton restart = new JButton("Restart");
     //panels
     private BoardPanel myBoard = new BoardPanel();
     private JPanel South = new JPanel();
     //embedded main class used for testing
     public static void main(String[] args)
          new GuiMain();
     /*no arg constructor which zeroes the bead array, creates a new window using the boxlayout manager,
      * creates the board, and adds the quit/restart buttons
     public GuiMain()
          super("Four Score");
          this.addComponentListener(new ResizeListener());
          setSize(640,480);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setLayout(new BorderLayout());
          myBoard.setBorder(BorderFactory.createLineBorder(Color.black));
          restart.addActionListener(new ResetListener());
          quit.addActionListener(new QuitListener());
          South.add(quit);
          South.add(restart);
          South.setBorder(BorderFactory.createLineBorder(Color.green));
          add(myBoard, BorderLayout.CENTER);
          add(South, BorderLayout.SOUTH);
          repaint();
          setVisible(true);
     //sends a new complete set of beads to the board
     public void updateBoard(int[][][] newBeads)
          myBoard.updateBoard(newBeads);
     //updates a specific bead then calls the updateboard method
     public void updateBead(int x, int y,int z, int color)
          myBoard.updateBead(x, y, z, color);
     //checks if a peg at a set of coordinates is full
     public boolean isFull(int x, int y)
          return myBoard.isFull(x,y);
     /* customer action listener for the reset button
      * resets the beads array to all zeroes (empty) and
      * sends the command "reset;" to the player
     private class ResetListener implements ActionListener
          public void actionPerformed(ActionEvent e)
               int[][][] beads = new int[4][4][4];
               for(int i = 0; i < 4; i++)
                    for(int j = 0; j<4; j++)
                         for(int k=0; k<4;k++)
                              beads[i][j][k] = 0;
               updateBoard(beads);
               sendCommand("reset;");
     /* customer action listener for the quit button
      * sends a "quit;" command to the player.
     public class QuitListener implements ActionListener
          public void actionPerformed(ActionEvent e)
               sendCommand("Quit;");
               System.exit(0);      //REMOVE AFTER TESTING
     public void sendCommand(String command)
          //so far unused as I still need to work out sending the commands to the appropriate place
     public class ResizeListener implements ComponentListener
          public void componentResized(ComponentEvent e)
               if(getWidth() != 640 || getHeight() != 480)
                    setSize(640,480);
          public void componentMoved(ComponentEvent e){}
          public void componentShown(ComponentEvent e) {}
          public void componentHidden(ComponentEvent e) {}
/* class which creates the actual game board
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class BoardPanel extends JPanel
     enum BeadStatus {EMPTY, WHITE, BLACK};
     //variables, basic x and y starting points for drawing the board.
     final int x = 100;
     final int y = 100;
     final int[] boardxPoints = {x,x+320,x+420,x+100};
     final int[] boardyPoints = {y,y,y+200,y+200};
     //array for the beads
     private int[][][] beads = new int[4][4][4];
     private PegButton[] pegs = new PegButton[16];
     public JPanel pegsPanel = new JPanel();
     public BeadLayer beadsPanel = new BeadLayer();
     JLayeredPane layers = new JLayeredPane();
      * no arg constructor which simply zeroes the bead array
     public BoardPanel()
          pegsPanel.setLocation(0,0);
          pegsPanel.setPreferredSize(new Dimension(630,480));
          pegsPanel.setOpaque(false);
          setOpaque(false);
          drawPegs();
          layers.setBorder(BorderFactory.createTitledBorder(
        "Test"));
          layers.add(pegsPanel, 1);
          beadsPanel.setLocation(0,0);
          beadsPanel.setPreferredSize(new Dimension(630,480));
          //layers.add(beadsPanel, new Integer(1));
          add(layers);
      * overriden paint component method which draws out the board, pegs, and beads
     public void paintComponent(Graphics g)
          super.paintComponent(g);
          g.setColor(Color.blue); //board background color
          g.fillPolygon(boardxPoints,boardyPoints, 4); //create the basic board shape
          drawGrid(g);
      * method to draw out the grid shape
     public void drawGrid(Graphics g)
          int p;
          int q;
          g.setColor(Color.cyan);
          //draw the vertical lines
          for(int i=0; i<5;i++)
               p=x+(i*80);
               g.drawLine(p,y,p+100,y+200);
          //draw the horizontal lines
          for (int j=0; j<4; j++)
               p=x+(j*25);
               q=y+(50*j);
               g.drawLine(p,q,p+320,q);
          g.drawLine(x+100,y+200,x+420,y+200);
      * draw out the 16 pegs in proper position
     public void drawPegs()
          int p = x;
          int q = y;
          int n;
          for(int i=0; i<4;i++)
               for(int j=0; j < 4; j++)
                    p = x+(j*80+40)+(i*25+12)-5;
                    q = y+(i*50+25)-80;
                    //g.fillRect(p,q,10,75);
                    //g.fillArc(p, q-5, 10, 10, 0, 180);
                    n =j+(i*4);
                    pegs[n] = new PegButton(i,j);
                    pegs[n].setLocation(p,q);
                    pegsPanel.add(pegs[n]);
     //updates the board by reading in a new bead array then repainting
     public void updateBoard(int[][][] beads)
          for(int i = 0; i < 4; i++)
               for(int j = 0; j<4; j++)
                    for(int k=0; k<4; k++)
                         this.beads[i][j][k] = beads[i][j][k];
          repaint(); //inheirited method which causes paintcomponent to be called again
     public void updateBead(int x, int y, int z, int color)
          beads[x][y][z] = color;
          repaint();
     //returns true if a peg is full
     public boolean isFull(int x, int y)
          if (beads[x][y][3] != 0)
               return false;
          return true;
import java.awt.*;
import javax.swing.*;
     public class BeadLayer extends JPanel
          enum BeadStatus {EMPTY, WHITE, BLACK};
          final int x = 100;
          final int y = 100;
          private int[][][] beads = new int[4][4][4];
          public BeadLayer()
               for(int i = 0; i < 4; i++)
                    for(int j = 0; j<4; j++)
                         for(int k=0; k<4; k++)
                              beads[i][j][k] = 1;
               repaint();
          //method which takes in a set of coordinates and a color then draws the bead at the correct position
          public void paintComponent(Graphics g)
               //reads through the bead array and calls the drawbead method where required
               for(int i = 0; i<4; i++)
                    for(int j = 0; j<4; j++)
                         for(int k=0; k<4;k++)
                              if(beads[i][j][k] == 1)
                                   drawBead(i,j,k,BeadStatus.BLACK,g);
                              else if(beads[i][j][k] == 2)
                                   drawBead(i,j,k,BeadStatus.WHITE,g);
          public void drawBead(int x, int y, int z, BeadStatus color, Graphics g)
               x = this.x+(x*80+40)+(y*25+12)-10;
               y = this.y+(y*50+25)-18-(18*z);
               if(color == BeadStatus.WHITE)
                    g.setColor(Color.WHITE);
               else
                    g.setColor(Color.BLACK);
               g.fillOval(x, y, 20, 18);
               g.setColor(Color.GREEN);
               g.drawOval(x, y, 20, 18);
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class PegButton extends JButton implements ActionListener
     private String coord;
     public PegButton(int x, int y)
          getCoord(x,y);
          this.setPreferredSize(new Dimension(10,75));
          this.setBorderPainted(false);
          addActionListener(this);
     public void getCoord(int x, int y)
          y+=1;
          switch(x)
               case 0: coord = "A"+Integer.toString(y)+".";
                         break;
               case 1: coord = "B"+Integer.toString(y)+".";
                         break;
               case 2: coord = "C"+Integer.toString(y)+".";
                         break;
               case 3: coord = "D"+Integer.toString(y)+".";
                         break;
     public void setLocation(int x,int y)
          if (y != 5)
               super.setLocation(x,y);
     public void paintComponent(Graphics g)
          g.setColor(Color.RED);
          g.fillRect(0, 7, 10, 75);
          g.fillArc(0, 0, 10, 15, 0, 180);
     public void actionPerformed(ActionEvent e)
          System.out.println(coord);
}

Multi-post: http://forum.java.sun.com/thread.jspa?threadID=5274611

Similar Messages

  • I need help adding a mouse motion listner to my game. PLEASE i need it for

    I need help adding a mouse motion listner to my game. PLEASE i need it for a grade.
    i have a basic game that shoots target how can use the motion listner so that paint objects (the aim) move with the mouse.
    i am able to shoot targets but it jus clicks to them ive been using this:
    public void mouse() {
    dotX = mouseX;
    dotY = mouseY;
    int d = Math.abs(dotX - (targetX + 60/2)) + Math.abs(dotY - (targetY + 60/2));
    if(d < 15) {
    score++;
    s1 = "" + score;
    else {
    score--;
    s1 = "" + score;
    and here's my cross hairs used for aiming
    //lines
    page.setStroke(new BasicStroke(1));
    page.setColor(Color.green);
    page.drawLine(dotX-10,dotY,dotX+10,dotY);
    page.drawLine(dotX,dotY-10,dotX,dotY+10);
    //cricle
    page.setColor(new Color(0,168,0,100));
    page.fillOval(dotX-10,dotY-10,20,20);
    please can some1 help me

    please can some1 help meNot when you triple post a question:
    http://forum.java.sun.com/thread.jspa?threadID=5244281
    http://forum.java.sun.com/thread.jspa?threadID=5244277

  • Need help adding schedule to xcode 4

    I need help adding a tour schedule for an iphone app building an app for 13 djs and they want thier tour schedules added these need to be updated monthly is there a way to add this????

    I don't know if this is the easiest way but it works for me. I connect the DVD player to my camcorder (so it's the 3 plugs yellow/red/white on one end and a single jack into the camera). Then I connect my camcorder to the computer (I think it's through a firewire port). Then I just play the DVD and the footage is digitized via the camcorder and I import it into iMovie 4 as it's playing. I believe the camcorder is just in VCR mode.
    I have also used this method to transfer VHS tapes onto DVDs via the camera by connecting the VCR to the camera.
    I haven't had much luck with movies over about 40 minutes on iMovie. But if it's home movies, there may be a logical break. Do maybe 20 minute segments (it's also really easy on iMovie to add a soundtrack if these are OLD films with no sound.
    As you can see, I'm low tech!
    Good luck!
    Powerbook G4   Mac OS X (10.3.9)  

  • Help adding Input language Russian on 8330

    I'm on Verizon Curve 4.3.
    Can anyone help adding Russian as input language?
    Thanks.
    Greg.
    Solved!
    Go to Solution.

    Verizon should have a multi launguage package on the website.
    If not you can go here:
    http://na.blackberry.com/eng/support/downloads/download_sites.jsp
    Make sure you get the same version that is on your phone currently so you ca maintain support.
    Let us know when you get it, and well help you load it.
    Thanks
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • Help adding new Macs to the household, creating shared drive for iTunes,

    I have a few questions:
    My husband and I recently both got MacBook Pros. Our former set-up was a iMac which backs up to a 500 G Time Capsule. We have a large iTunes library and iPhoto library on the iMac. The iMac is going to turn in to the kids computer. I would like to do the following:
    1. transfer photos to my MBP (#1). Will the Time Machine backup for the iMac become significantly smaller, making room for the soon to be larger backup of the MBP #1? Little confused how that is going to work.
    2. have shared access to iTunes library? basically it would be nice for all 3 computers to have the complete iTunes library, but I would also like to backup all 3 computers using Time Machine and don't want to have triplicates of the library. I was trying to figure out if the way to go is to put the iTunes on a shared drive on the Time Capsule, but is there a way for the 3 computers to 'sync' to the shared drive when new music is added? Finally, if the iTunes is within a shared drive does that mean it won't be backed up?
    Much appreciation and thanks to anyone who can help make sense of this.

    Update: Downloaded free version of Syncopation, and am hopeful this is going to some what solve my iTunes issue.
    New question would be: when creating the Time Machine backups for MBP#1 and MBP #2 can I NOT back up the iTunes folders? That would save approx. 36G on each of these backups, right? 72G total of the Time Capsule space. And the assumption is that with Syncopation, as long as the iMac iTunes is backed up then, you have everything.

  • Help adding new WLC to existing ACS

    Hi All,
    I need help with this.
    This network has a working WLC that authenticates wireless users against an ACS by MAC address. It works fine.
    I need to add a new WLC.
    I added the WLC, the APs connect to the WLC fine, but the users get limited connectivity and we've found out that is because the new WLC is getting authentication errors against the ACS.
    The configuration of the new WLC is exactly the same as the current working WLC and both controllers show as AAA clients on the ACS.
    I want to know if somebody can point me out in the right direction to solve this.
    There's connectivity fine between all devices (as far as PING goes), and there's no Firewall or filters in between.
    The difference I see on both WLCs is that on the working one (WLC1), under Security - AP Policies, we see the AP Authorization List with the MAC addresses/cert type/hash.  We don't get this information on the non-working WLC (attached document shows both)
    Also in the attached document, I'm sending the errors I get no the WLC2 controller.
    Any help is greatly appreciated.
    Federico.

    Federico,
    I didn't get you when you say that you see only One WLC under groupsetup/Mac address. Could you please elaborate this?
    Also, if you don't know see any NAR configured under shared profile component then check inside the group/user setup there must be either ip based or CLI/DNIS based NAR configured for WLC's and looking at failed attempts it seem that action is denied.
    HTH
    Regds,
    JK
    Do rate helpful posts-

  • Context sensitive help, adding mapping ID

    I am updating a HTML help project file and having trouble adding additional mapping ID's. The .chm file works fine within the application we are using using the original data. However when I add to the .h file to add additional mapping ID's, its not working (only on the new mapping ID's I added. When I use the CSH Test application, it works fine. Its when ever I add additional mapping ID's it does not work within the application. So far Adobe hasn't been able to figure it out.
    To Clarify:
    Original file looks like this: (these work fine within the application - outside of RoboHelp)
    Works fine with the CSH Test within Robohelp
    #define HIDD_ADMIN_REPORT_9G                               906      // 0x0000038a  906
    #define HIDD_ADMIN_REPORT_10A                              1000     // 0x000003e8  1000
    #define HIDD_ADMIN_REPORT_10B                              1001     // 0x000003e9  1001
    #define HIDD_ADMIN_REPORT_ELAPSED_HOLD      1101     // 0x0000044d  1101
    the values I have added: (these don't work within my application, but do work fine with the CSH Test within RoboHelp)
    #define HIDD_ADMIN_REPORT_9h                            131080
    #define HIDD_ADMIN_REPORT_9i                                131081
    #defineHIDD_ADMIN_REPORT_9J                                131082
    #define HIDD_ADMIN_REPORT_9k                                131083
    #define HIDD_ADMIN_REPORT_9L                            131084
    PART of my question is - what is the // 0x0000038a 906 - mean? when I export the file it doesn't add those values
    HELP !
    Thanks,
    Jim

    To answer your question, I'm not sure but it may explain why the call works in the CSH Tool but not from the application. It looks like some sort of hexadecimal value. Could you ask one of your developers to take a look and see if it rings a bell?

  • I added a persona, I've disabled and removed that persona, it keeps coming back. Going into tools does not help, adding a new persona does not help. I'm ready to give up on firefox!

    I added a persona, wanted a new one so disabled and removed the old one. I added a new persona, but the old one keeps coming back. Going into tools/add ons does no good because it is not even listed anymore but keeps coming back. I've shut down/restarted, I've searched for answers to this problem.

    The data that specifies which persona to display is stored as a pref in the prefs.js file in the Firefox Profile Folder.
    Did you try to rename or move the prefs.js file and a possible user.js file to see if that helps?
    Are you using the Personas Plus extension, because in that case you need to check the settings in that extension.
    You can use this button to go to the Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Open Containing Folder

  • Need help adding image to datagrid column

    Hi,
    Can anyone tell me how to add an image to a datagrid column?
    I have created a flex library project which contains a mxml component with a datagrid, an item renderer mxml component which rendered the image within the datagrid column depending on the value coming back from the database for that column and a folder 'assets' which hold all the images. When I add the library to my main project and call the mxml component with the datagrid an image place holder is visible in the datagrid column but not the image. However, if I take the image out of the library project and added to an 'assets' folder in the main project the image is displayed in the datagrid column.
    It looks like, even though the images are in the flex library project and only the flex library project is trying to display the images in the datagrid, the library project is looking in the main application project folder for the image.
    Does anyone know why this is happening and how to fix it?
    Thanks in advance for an help,
    Xander.

    I have tried embedding the images in my library but it still didn't work. Also I can't embed the image as I'm using the value of the column to complete the image name, for example in my mxml item renderer component I have the added the following code
    <mx:Image source="@Embed(source='assets/' + data.mycolumnvalue + '.png')" tooltip="{data.mycolumnvalue}"/>
    but nothing is displayed.

  • I need help adding an additional button to a web template

    Hello,
    I am trying to add an aditional button to a web template I inherited.  I am not a web person just trying to fill a gap at the company.
    If you look at my test server www.pondviewtech.com I want to add another button above the request demo one.  I have tried a bunch of things:  making the button smaller, adding a similar line to my index file as the same button, deleting the "Welcome to" text.  The best I could get was this www.pondviewtech.com/buttontest.html .  I have attached my buttontest.html file.  I couldn't figure out how to paste a few lines of code in this page.
    I didn't create the template so if it is a mess don't worry about my feelings.
    Thanks for any help or suggestions.

    Change this -
            <p><u>Welcome to Automated Compliance Solutions</u></p>
            <p><a href="contactacs.htm"><img src="button.png" width="266" height="56" border="0" align="right" /></a></p>
    to this -
            <p><u>Welcome to Automated Compliance Solutions</u></p>
            <p><a href="yourlink.htm"><img src="yourbutton.png" width="266" height="56" border="0" align="right" /></a></p>
            <p><a href="contactacs.htm"><img src="button.png" width="266" height="56" border="0" align="right" /></a></p>
    Be aware that my suggestion here is NOT valid XHTML, but since you are not a web developer, and the 'invalid' markup that I have suggested will not affect the rendering or operation of the page, I decided to keep it simple for you.  In my suggestion, "yourlink.html" refers to the page to which you want this button to link, and "yourbutton.png" refers to the filename of the button image (obviously you'd want to change this to correspond to the filename and extension of the image you have created).

  • Help adding current Date and Time stamp to file name

    I need help with my script adding current Date and Time stamp to file name.
    This is my file name = myfile.htm
    I would like to save it as = myfile.htm 8/29/2007 11:41 AM
    This is my script:
    <script>
    function doSaveAs(){
         if (document.execCommand){
              document.execCommand('SaveAs','1','myfile.htm')
         else {
              alert("Save-feature available only in Internet Exlorer 5.x.")
    </script>
    <form>
    <input type="button" value="Click here to Save this page for your record" onClick="doSaveAs()"
    </form>
    Thank you

    I agree, I guess I overlooked that!
    I would like to save it as = myfile 8/29/2007 11:41 AM .htm
    I need help with my script adding current Date and Time stamp to file name.
    This is my file name = myfile.htm
    I would like to save it as = myfile 8/29/2007 11:41 AM .htm
    This is my script:
    <script>
    function doSaveAs(){
    if (document.execCommand){
    document.execCommand('SaveAs','1','myfile.htm')
    else {
    alert("Save-feature available only in Internet Exlorer 5.x.")
    </script>
    <form>
    <input type="button" value="Click here to Save this page for your record" onClick="doSaveAs()"
    </form>

  • Need help adding video to a site

    Hi Everyone:
    I really need some help please. The owner of a site I am
    working on sent me a DVD with video's he has taken and wants them
    put on his site.
    The files are VIDEO_TS and are MPEG files. How can I add the
    video's to the site so that when I user clicks on the link, they
    are able to either view the site or download the video to watch
    later. I have other video's added to the site but I was able to
    copy them and safe them the way there were added. The owner sells
    products from the site I copied them from.
    The site I am working on is www.buggyworld.net. Most of the
    individual pages for the vehilces have videos on them and I am
    trying to add these new ones the same way. I have never done this
    before so really not sure how to. The videos that are already added
    at Windows Media Audio/Video Files and that is how I would like to
    convert this video to.
    Any help would be so greatly appreciated.. thank you
    Linda

    Best bet would be to make Flash video so that everyone who
    wants to (and has
    the Flash Player plugin) can see them. Do you have Flash?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Frank Branker" <[email protected]> wrote in
    message
    news:f4ph73$rcd$[email protected]..
    > What?s the size of your MPG file?
    >
    > It?s better if you convert your file to a wmv file
    format because it?s
    > important to keep your file size under 6 Megs. Do you
    have the software to
    > do
    > this?
    > Windows Movie maker might be able to do this you can
    find it in your
    > program
    > files on your computer.
    >
    > If not we will have to work with what you have and do a
    quick and dirty
    > but I
    > don?t advise that.
    >
    > Below is a list of tools you may want to consider
    owning.
    >
    > Ripping Software
    > This software will rip from a dvd to just about any
    format including WMV
    >
    http://www.imtoo.com/dvd-ripper.html
    >
    > Compressing software
    > Sorenson Squeeze Suite 4.5 is the industry-leading video
    encoding tool
    >
    http://www.sorensonmedia.com/pages/?pageID=2
    >
    >
    >

  • Need help adding AM/PM to my clock program

    Hi everyone
    I would be grateful if you could help me adding AM/PM to my clockDisplay program, been trying but i'm not very familiar with Java.
    Thanks
    I have used 2 classes:
    NumberDisplay and ClockDisplay
    the clock automatically convert hours after 12 noon such as 14:34 to 02:34 so all i need is to add PM and AM accordingly.
    NumberDisplay classs:
    public class NumberDisplay
        private int limit;
        private int value;
        public NumberDisplay(int rollOverLimit)
            limit = rollOverLimit;
            value = 0;
        public int getValue()
            return value;
        public String getDisplayValue()
            if(value < 10)
                return "0" + value;
            else
                return "" + value;
        public void setValue(int replacementValue)
            if((replacementValue >= 0) && (replacementValue < limit))
                value = replacementValue;
            else if ( (replacementValue>=limit) && (replacementValue>=0) )
               value=replacementValue-12;
        public void increment()
            value = (value + 1) % limit;
    }ClockDisplay class:
    public class ClockDisplay
        private NumberDisplay hours;
        private NumberDisplay minutes;
        private String displayString;    // simulates the actual display
        public ClockDisplay()
            hours = new NumberDisplay(12);
            minutes = new NumberDisplay(60);
            updateDisplay();
        public ClockDisplay(int hour, int minute)
            hours = new NumberDisplay(12);
            minutes = new NumberDisplay(60);
            setTime(hour, minute);
        public void timeTick()
            minutes.increment();
            if(minutes.getValue() == 0) {
                hours.increment();
            updateDisplay();
        public void setTime(int hour, int minute)
            hours.setValue(hour);
            minutes.setValue(minute);
             updateDisplay(); 
        public String getTime()
            return displayString;
        private void updateDisplay()
            displayString = hours.getDisplayValue() + ":" +
                            minutes.getDisplayValue();
    }As you see value=replacementValue-12; do the job.
    i tried do this:
    if(hours.setValue(hour)>=12)
    updateDisplayPm();
    else
    updateDisplay();
    and for
    private void updateDisplayPm()
    displayString = hours.getDisplayValue() + ":" +
                            minutes.getDisplayValue() + "PM";but it didnt work.
    so should iwrite if statemnt in NumberDisplay class and refer it to ClockDisplay or i can do something in clockDisplay.
    Looking forward to hear from you
    thanks

    solved
    public class NumberDisplay
        private int limit;
        private int value;
        private boolean isam;
        public NumberDisplay(int rollOverLimit)
            limit = rollOverLimit;
            value = 0;
        public int getValue()
            return value;
          public boolean getAm()
                 return isam;
        public String getDisplayValue()
            if(value < 10)
                return "0" + value;
            else
                return "" + value;
        public void setValue(int replacementValue)
            if((replacementValue >= 0) && (replacementValue < limit))
                value = replacementValue;
                isam=true;
            else if ( (replacementValue>=limit) && (replacementValue>=0) )
               value=replacementValue-12;
               isam=false;
        public void increment()
            value = (value + 1) % limit;
    public class ClockDisplay
        private NumberDisplay hours;
        private NumberDisplay minutes;
        private String displayString;    // simulates the actual display
        private NumberDisplay amCheck;
        public ClockDisplay()
            hours = new NumberDisplay(12);
            minutes = new NumberDisplay(60);
            updateDisplay();
        public ClockDisplay(int hour, int minute)
            hours = new NumberDisplay(12);
            minutes = new NumberDisplay(60);
            setTime(hour, minute);
        public void timeTick()
            minutes.increment();
            if(minutes.getValue() == 0) {
                hours.increment();
            updateDisplay();
        public void setTime(int hour, int minute)
            hours.setValue(hour);
            minutes.setValue(minute);
           updateDisplay(); 
        public String getTime()
            return displayString;
        private void updateDisplay()
            if(hours.getAm())
            displayString = hours.getDisplayValue() + ":" +  minutes.getDisplayValue() + "AM";
            else
             displayString = hours.getDisplayValue() + ":" +  minutes.getDisplayValue() + " PM";
    }

  • Need help adding audio to a slideshow in iDVD. I don't see my playlists.

    I'm a relatively new Mac user & am trying to create my first DVD ever. I'm just learning as I go. I'm trying to create a slideshow with about 400 pictures to show at a "Going Away" Party. I've created a playlist to go along with it, but when I click on Audio & then on iTunes, it pulls up all of my songs in my whole library, but doesn't show my playlists anywhere. When I click on "help" it tells me that I should be able to go to Audio, click on iTunes, click on "library", & then find my playlist. However, I don't see "library" under iTunes. Help!

    +but is it possible to make many different slideshows on the DVD but somehow have it play automatically from one to the other+
    No. You can do that in DVD Studio Pro.
    Here's a couple of examples of how I did these projects a couple of years ago:
    *Mediterranean 2003 cruise*
    I had over 1000 images from a Mediterranean cruise. I broke them down in to 24 Albums in iPhoto (fewer than 99 images each). In iDVD, I created 6 Folders which created sub-menus. Main Menu buttons (folders/slideshows) such as Barcelona, French Riviera, Florence, Rome, Naples, Malta. Then I added each of the corresponding 24 iPhoto Albums to those 6 slideshows, thereby creating 24 total slideshows on sub-menus. Takes some planning. All slideshows had transitions and music.
    *Ireland 2004 iDVD Project*
    Nearly 800 images dragged into iDVD as organized folders from the hard drive. Transitions on each image, and menus, sub-menus, and sub-sub menus. The sub-menus are created by clicking on the Folder icon on the iDVD interface.
    Main Menu has 6 buttons: Downpatrick, Antrim Coast, Letterkenny, Sligo, Trim, and Extras. Behind each button are additional buttons ranging from 3 to 6 buttons. The Extras button goes fairly deep. When you click on Extras, it gives you 3 choices on a new menu. The "B&Bs" button opens a new menu with 5 buttons. The "Movies" button opens a new menu with 4 buttons. If you click on the "Irish Music" button, you open a new menu with 2 buttons. At that point, you are at a "sub-sub-sub menu."
    Music was on most of the slideshows. Some movies converted to QT DV from Canon S400 digicam .AVI files (iDVD 4). Now convert to H.264 with QuickTime 7. Images are original 4MP (2MB) JPEG images from the same digicam. This DVD project is around 4GB with all pictures as DVD-ROM content.

  • Need help adding Arch to Grub

    I am trying to dual boot Arch Linux and Ubuntu. When I try to boot there is no option for Arch. I have added it to the menu.lst file in ubuntu. Arch is installed on sdb1 according to sudo fdisk -l  I need help!

    Fdisk -l
    Disk /dev/sda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xb38ab38a
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1        9544    76662148+  83  Linux
    /dev/sda2            9545        9729     1486012+   5  Extended
    /dev/sda5            9545        9729     1485981   82  Linux swap / Solaris
    Disk /dev/sdb: 40.9 GB, 40992473088 bytes
    255 heads, 63 sectors/track, 4983 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x0002eb1f
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1   *           1        4891    39286926   83  Linux
    Disk /dev/sdc: 250.0 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x000ea9be
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1               1       30401   244196001    7  HPFS/NTFS
    I think Arch is on the 40GB partition
    Menu.lst
    # menu.lst - See: grub(8), info grub, update-grub(8)
    #            grub-install(8), grub-floppy(8),
    #            grub-md5-crypt, /usr/share/doc/grub
    #            and /usr/share/doc/grub-doc/.
    ## default num
    # Set the default entry to the entry number NUM. Numbering starts from 0, and
    # the entry number 0 is the default if the command is not used.
    # You can specify 'saved' instead of a number. In this case, the default entry
    # is the entry saved with the command 'savedefault'.
    # WARNING: If you are using dmraid do not use 'savedefault' or your
    # array will desync and will not let you boot your system.
    default        0
    ## timeout sec
    # Set a timeout, in SEC seconds, before automatically booting the default entry
    # (normally the first entry defined).
    timeout        0
    ## hiddenmenu
    # Hides the menu by default (press ESC to see the menu)
    hiddenmenu
    # Pretty colours
    #color cyan/blue white/blue
    ## password ['--md5'] passwd
    # If used in the first section of a menu file, disable all interactive editing
    # control (menu entry editor and command-line)  and entries protected by the
    # command 'lock'
    # e.g. password topsecret
    ## password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
    # password topsecret
    # examples
    # title        Windows 95/98/NT/2000
    # root        (hd0,0)
    # makeactive
    # chainloader    +1
    # title        Linux
    # root        (hd0,1)
    # kernel    /vmlinuz root=/dev/hda2 ro
    # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
    ### BEGIN AUTOMAGIC KERNELS LIST
    ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
    ## by the debian update-grub script except for the default options below
    ## DO NOT UNCOMMENT THEM, Just edit them to your needs
    ## ## Start Default Options ##
    ## default kernel options
    ## default kernel options for automagic boot options
    ## If you want special options for specific kernels use kopt_x_y_z
    ## where x.y.z is kernel version. Minor versions can be omitted.
    ## e.g. kopt=root=/dev/hda1 ro
    ##      kopt_2_6_8=root=/dev/hdc1 ro
    ##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
    # kopt=root=UUID=ce3a864f-3f72-480b-96b3-54516b307170 ro
    ## default grub root device
    ## e.g. groot=(hd0,0)
    # groot=ce3a864f-3f72-480b-96b3-54516b307170
    ## should update-grub create alternative automagic boot options
    ## e.g. alternative=true
    ##      alternative=false
    # alternative=true
    ## should update-grub lock alternative automagic boot options
    ## e.g. lockalternative=true
    ##      lockalternative=false
    # lockalternative=false
    ## additional options to use with the default boot option, but not with the
    ## alternatives
    ## e.g. defoptions=vga=791 resume=/dev/hda5
    # defoptions=quiet splash
    ## should update-grub lock old automagic boot options
    ## e.g. lockold=false
    ##      lockold=true
    # lockold=false
    ## Xen hypervisor options to use with the default Xen boot option
    # xenhopt=
    ## Xen Linux kernel options to use with the default Xen boot option
    # xenkopt=console=tty0
    ## altoption boot targets option
    ## multiple altoptions lines are allowed
    ## e.g. altoptions=(extra menu suffix) extra boot options
    ##      altoptions=(recovery) single
    # altoptions=(recovery mode) single
    ## controls how many kernels should be put into the menu.lst
    ## only counts the first occurence of a kernel, not the
    ## alternative kernel options
    ## e.g. howmany=all
    ##      howmany=7
    # howmany=all
    ## specify if running in Xen domU or have grub detect automatically
    ## update-grub will ignore non-xen kernels when running in domU and vice versa
    ## e.g. indomU=detect
    ##      indomU=true
    ##      indomU=false
    # indomU=detect
    ## should update-grub create memtest86 boot option
    ## e.g. memtest86=true
    ##      memtest86=false
    # memtest86=true
    ## should update-grub adjust the value of the default booted system
    ## can be true or false
    # updatedefaultentry=false
    ## should update-grub add savedefault to the default options
    ## can be true or false
    # savedefault=false
    ## ## End Default Options ##
    title        Ubuntu 9.04
    uuid        ce3a864f-3f72-480b-96b3-54516b307170
    kernel        /boot/vmlinuz-2.6.28-11-generic root=UUID=ce3a864f-3f72-480b-96b3-54516b307170 ro quiet splash
    initrd        /boot/initrd.img-2.6.28-11-generic
    quiet
    #title        Ubuntu 9.04, kernel 2.6.28-11-generic (recovery mode)
    #uuid        ce3a864f-3f72-480b-96b3-54516b307170
    #kernel        /boot/vmlinuz-2.6.28-11-generic root=UUID=ce3a864f-3f72-480b-96b3-54516b307170 ro  single
    #initrd        /boot/initrd.img-2.6.28-11-generic
    #title        Ubuntu 9.04, memtest86+
    #uuid        ce3a864f-3f72-480b-96b3-54516b307170
    #kernel        /boot/memtest86+.bin
    #quiet
    # (0) Arch Linux
    title  Arch Linux 
    root   (hd1,0)
    kernel /vmlinuz26 root=/dev/sda3 ro
    initrd /kernel26.img
    ### END DEBIAN AUTOMAGIC KERNELS LIST
    title Arch
    rootnoverify (hd0,1)
    chainloader +1

Maybe you are looking for

  • Web service security

    Hi My development environment is netbeans 6.9 and glassfish v2 server. I have developed my web service from wsdl file and is working fine over http. I want to make this over secure connection over https ssl. I am following this tutorial http://downlo

  • Why does eye dropper Lab show a different value than the Lightness channel?

    Can someone help me understand how the L in Lab color in the eye dropper tool maps to the actual Lab Lightness channel?  Both are on a scale of 0-100, but they clearly show different values.  Here's a video that show what I mean (note that if I compl

  • The difference of sinad.vi between Sound & Vibration Toolkit and Singal Processing Toolkit

    Hi, I'm confused with the the difference of sinad.vi between Sound & Vibration Toolkit and Singal Processing Toolkit. When the input waveform is single tone, the output is almost the same, but raises much discrepancy while a certain distribution of t

  • I can't find Premiere Pro on app manager

    Why is my Creative Cloud app not finding Premiere Pro? I just bought the membership specifically for that program, since it was advertised as a part of the package.

  • Passing cookies to urlservices

    I have been evaluating the urlservices portlet, and have a question. Is it possible to pass cookies to the url? In particular I am trying to access a perl script on a server that depends upon a cookie for it to work. If this is not yet implemented, i