ABOUT getImage

how to use this function? where to find some example?

here is my source code
public class SpritDemo extends java.applet.Applet implements Runnable {
final int quantum = 10;
Image offScreenImage = null;
Graphics offScreenGraphics = null;
Dimension offScreenSize = null;
/** Initialization method that will be called after the applet is loaded
* into the browser.
public void init() {
Image img = null;
showStatus("loading iamges...");
String baseURL = getCodeBase().toString();
img = getImage(getCodeBase(),"dan.gif");
while(img.getHeight(this) == -1){
width = img.getWidth(this);
height = img.getHeight(this);
but it stops in the while
why does this happen?

Similar Messages

  • How to obtain date of creation if image is obtained using getImage()

    When Image is obtained using getImage() method , how to
    obtain date of creation or another header value if image is
    obtained using getImage method.

    Actually, some formats do indeed have creation or modification dates built in. e.g. http://www.w3.org/TR/PNG-Chunks.html#C.tIME. (Of course since most programs save a new copy of the file every time, the two dates are the same.) However, just because formats have this data doesn't mean it's reliable or even present. Your best bet is to pass creation dates in an Applet param tag for applets (assuming you were referring to Applet.getImage()) or to parse out a filename from a classloader URL and use a File object to check (assuming you were instead referring to Toolkit.getImage(URL)). That's the best answer I have without knowing more about what you are trying to accomplish.

  • GetImage() in JApplet

    Hi folks!
    Can anybody help me here - I'm trying to use the getImage() method of JApplet to load images into my Applet (the images required are dependent on info received from a JDBC / Network connection so I want to be selective about the images I load). I know the getImage() method only works during the execution of the Applet's init(). However I have looked on the JApplet FAQ in the tutorial and it states it can be called after init() has finished. Is this possible and, if so, how 'cos I can't get it to work?!? I will need to call getImage() from a method totally independent from init()...
    Any help would be appreciated...

    Hi,
    you can try the blow code. in any AWT or Swing component. But the image url must from the same server that applet's.
    java.awt.Toolkit.getDefaultToolkit().getImage(new URL("the image url"));

  • JDialog Problem: How to make a simple "About" dialog box?

    Hi, anyone can try me out the problem, how to make a simple "About" dialog box? I try to click on the MenuBar item, then request it display a JDialog, how? Following is my example code, what wrong code inside?
    ** Main.java**
    ============================
    publc class Main extends JFrame{
    public Main() {
              super();
              setJMenuBar();
              initialize();
    public void setJMenuBar()
         JMenuBar menubar = new JMenuBar();
            setJMenuBar(menubar);
            JMenu menu1 = new JMenu("File");      
            JMenuItem item = new JMenuItem("About");      
            item.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                  // About about = new About(this);
               // about.show();
            menu1.add(item);
         menubar.add(menu1);
    public static void main(String args[]){
         Main main = new Main();
    }** About.java**
    =============================
    import java.awt.*;
    import javax.swing.*;
    public class About extends JDialog{
         JPanel jp_top, jp_center, jp_bottom;
         public About(JFrame owner){
              super(owner);
              setDefaultCloseOperation( DISPOSE_ON_CLOSE );
              Image img = Toolkit.getDefaultToolkit().getImage(DateChooser.class.getResource("Duke.gif"));          
              setIconImage( img );
              setSize(500,800);
              Container contentPane = getContentPane();
             contentPane.setLayout(new BorderLayout());           
             contentPane.add(getTop(), BorderLayout.NORTH);
              contentPane.add(getCenter(), BorderLayout.CENTER);
              contentPane.add(getBottom(), BorderLayout.SOUTH);
              setResizable(false);
               pack();            
               setVisible(true);
         public JPanel getTop(){
              jp_top = new JPanel();
              return jp_top;
         public JPanel getCenter(){
              jp_center = new JPanel();
              return jp_center;
         public JPanel getBottom(){
              jp_bottom = new JPanel();
              jp_bottom.setLayout(new BoxLayout(jp_bottom, BoxLayout.X_AXIS));
              JButton jb = new JButton("OK");
              jp_bottom.add(jb);
              return jp_bottom;
    }

    Code looks reasonable except
    a) the code in the actionPerformed is commment out
    b) the owner of the dialog should be the frame
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
    see http://homepage1.nifty.com/algafield/sscce.html,
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

  • Error-1074360293 occured at IMAQdz GetImage.vi

    At first, my Labview program acquired 1-5 images and then this error message would pop:
    Error-1074360293 occured at IMAQdz GetImage.vi
    Possible reasons(s):
    NI-IMAQ-dx: (Hex 0xBFF6901B) Time Out
    After reading a bit about that error on the forum, I turned down my firewall. Now it goes much better, but the error message still appears from time to time (every 10-200 images depending of the time).
    Would someone have an idea to help?
    Thank you!

    Since you mention the firewall, I am going to assume that you are using a GigE camera.
    1. If you are using a network adapter that supports Jumbo Packets, you will need to access the advanced properties tab of the adapter, and turn on Jumbo Packet support.
    2. If you do not have a network adapter that supports Jumbo Packets, you will need to configure the camera in MAX to use a packet size <= 1024.  8000 is the default.
    3. If you want to not turn off your firewall, and if the camera suports it, you can enable Firewall Traversal.  You will need to click on "SHOW ALL ATTRIBUTES" in the Attributes tab, and look under the GeniCAM section.
    4. Make sure that any devices between your PC and your camera support jumbo packets as well (routers, switches, etc.)
    5. It would be best to use a CAT6 cable directly between the PC and the camera.
    Machine Vision, Robotics, Embedded Systems, Surveillance
    www.movimed.com - Custom Imaging Solutions

  • Question about variable declaration

    Hi all,
    I have a (in fact, two) question(s) about the declaration of variables inside of time-critical code, like render loops or similars.
    Does it really matter to use
    for (int k=0; k<1000; k++)
         for (int l=0; l<1000; l++)instead of
    int k;
    int l;
    for (k=0; k<1000; k++)
         for (l=0; l<1000; l++)concerning the speed of the app? What about doing this with non-basic types -> Objects, like to say Strings ?
    And are there any resources where I can find out more about that and other things like that ?
    Uhm, now it became three q's... Sorry to bother you ;-)
    Skippy

    whoo, maybe I got something totally wrong here.
    Does this mean that
    Image blah;
    for (int i=0; i<100; i++) blah = getImage("test"+i+".gif");will clean up a lot, because there are non-referenced Images and Strings?
    Hmm, anyone told me that
    for (int i = 0; i<100; i++)
    String test = "test"+i;
    System.out.println(test);
    }is disastrous code.
    Damn, ever thought to be a good Java programmer, but every day I get new thoughts I cannot solve these days...
    grmph
    Skippy

  • Question about loading and using Images.

    I know how to load an image and to draw it onto a canvas etc etc. However my question is to do with the efficiency of loading multiple images (possibly the same image!) and using them together. I have multiple objects, all instances of the same class, which all draw themselves onto a screen in different positions. However they all use the same 3 images (depending on an internal state).
    So if I create 5 of these objects and each object calls to load the same image using something along the lines of:
    url = this.getClass().getResource("MyImage.png");
    normalImage = Toolkit.getDefaultToolkit().getImage(url);Does this mean that in the memory there are 5 exactly the same copies of this image? Or does java do something clever and use one image that they would all reference? I suspect I will have 5 in memory but I wanted to ask about this before going and making an imageManager class where I load all the images and just use getMethods in that when drawing. I will not be preforming any transforms or anything on any of the images so they can all literally be the same image but simply drawn in multiple positions on the one canvas.
    (note: I am using active rendering to draw these images myself and then blit it to the screen ...).

    Use ImageIO rather than Toolkit--with Toolkit you need to use a MediaTracker to ensure you have your image loaded before you try to use it.
    If you load an image and then do this:
    MyImage1 = MyImage;
    MyImage2 = MyImage;
    MyImage3 = MyImage;
    There are 4 references to the Image in MyImage. If you don't specifically use a method that gives you a new Image, usually, you are getting a refrence to an image already loaded in memory.

  • Save me!! about JTree refresh!!

    Hello ereryone. I met a problem and I tried lots of method,such as reload(),validate(),revalidate(),but it seemed that they doesn't work.
    My gui is about: here is a JSplitpane,on the left part ,there is a panel(borderlayou) in it. A button in the panel's west and a JScrollPane in the panel's center. A JTree component in the JScrollPane.
    The wished fountion is when the program run, the tree would show the demanded disk file system(read config file to get the root file).when u click the button, a JFilechooser come out and u can choose another dir of the disk. when u click "ok", the tree should show the new file structure of the new dir.
    here are 2 java file.
    //myclass.java
    //myclass.java
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import javax.swing.plaf.basic.*;
    import javax.swing.ImageIcon;
    import java.awt.dnd.*;
    import java.awt.datatransfer.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    public class myclass extends JFrame implements WindowListener{
    private JFrame f=null;
    private JLabel labeladdress;
    private JLabel labelstatus;
    private JTree tree;
    private JSplitPane splitPane;
    private JEditorPane htmlPane;
    private JPopupMenu Popup=null;
    private DefaultTreeModel treeModel=null;
    private String str="";
    private boolean statusbarflag=true;
    private boolean addressbarflag=true;
    String currentpos;
    ImageIcon icon=new ImageIcon("icons/paste.gif");
    ReadAndWriteXML wp=new ReadAndWriteXML();
    public WebPageSave(Vector vec) throws FileNotFoundException, SecurityException,Exception{
    wp.address_Vector=new Vector();
    wp.readXMLFile("sys/workposition.xml");
    f=new JFrame("WebHunter");
    Container contentPane=(JPanel)f.getContentPane();
    contentPane.setLayout(new BorderLayout());
    JPanel panel=new JPanel();
    panel.setLayout(new BorderLayout());
    paneln.setLayout(new BorderLayout());
    contentPane.add(panel,BorderLayout.CENTER);
    contentPane.add(paneln,BorderLayout.NORTH);
    //&#28155;&#21152;JTree&#21644;JEditorPane
    //JTree tree=new JTree();
    initialtree(wp.address_Vector.get(0).toString());
    final JScrollPane scrollPanel=new JScrollPane(tree);
    final JPanel mainleft=new JPanel(new BorderLayout());
    JButton jchange=new JButton("change position");
    currentpos=wp.address_Vector.get(0).toString();
    //the button anonymous class
    jchange.addActionListener(new ActionListener(){   //change the dir
    public void actionPerformed(ActionEvent event){
    JFileChooser chooser=new JFileChooser(currentpos);
    chooser.setDialogTitle("choose ur position");
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int result=chooser.showDialog(f,"ok");
    if(result==JFileChooser.APPROVE_OPTION){
    int i=JOptionPane.showConfirmDialog(f,"make sure&#65311;","notice",JOptionPane.YES_NO_OPTION);
    if(i==JOptionPane.YES_OPTION){
    try{
    //ReadAndWriteXML wp=new ReadAndWriteXML();
    wp.address_Vector=new Vector();
    wp.readXMLFile("sys/workposition.xml");
    FileOperation u=new FileOperation();
    u.xcopy(wp.address_Vector.get(0).toString(),chooser.getSelectedFile().toString());
    u.delete(new File(wp.address_Vector.get(0).toString()));
    }catch(Exception e){
    e.printStackTrace();
    //write the new positon to the workposition.xml&#25991;&#20214;
    try{
    wp.writeXMLFile("sys/workposition.xml",chooser.getSelectedFile().toString());
    }catch (Exception e) {
    e.printStackTrace();
    ?????? //refresh tree
    try{
    ReadAndWriteXML wp=new ReadAndWriteXML();
    wp.address_Vector=new Vector();
    wp.readXMLFile("sys/workposition.xml");
    currentpos=wp.address_Vector.get(0).toString();
    //currentpos=chooser.getSelectedFile().toString();
    //initialtree(wp.address_Vector.get(0).toString());
    initialtree(chooser.getSelectedFile().toString());
    //JScrollPane scrollPanel=new JScrollPane(tree);
    //mainleft.add(scrollPanel,BorderLayout.CENTER);
    //tree.
    //mainleft.validate();
    JOptionPane.showConfirmDialog(f,"change positon successfully&#65281;","notice",JOptionPane.CLOSED_OPTION);
    }catch (Exception e1) {
    e1.printStackTrace();
    mainleft.add(scrollPanel,BorderLayout.CENTER);
    mainleft.add(jchange,BorderLayout.SOUTH);
    JScrollPane scrollPane2=new JScrollPane(htmlPane);
    splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,mainleft,scrollPane2);
    splitPane.setDividerSize(10);
    splitPane.setDividerLocation(180);
    panel.add(splitPane,BorderLayout.CENTER);
    panel.add(labelstatus,BorderLayout.SOUTH);
    f.pack();
    f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    f.setExtendedState(Frame.MAXIMIZED_BOTH);
    f.setIconImage(icon.getImage());
    //f.setBounds(0,0,1020,725);
    f.show();
    //f.addWindowListener(new WindowListenerHandle());
    f.addWindowListener(this);
    }//constructor over!!!
    public void initialtree(String s) throws FileNotFoundException,SecurityException,Exception{
    //ReadAndWriteXML treefile=new ReadAndWriteXML();
    //treefile.address_Vector=new Vector();
    //treefile.readXMLFile("sys/workposition.xml");
    //tree=new FileTree(s);
    //tree.revalidate();
    //((DefaultTreeModel)tree.getModel()).nodeStructureChanged((DefaultTreeModel)s);
    tree=new showDir().initTree(s);
    tree.revalidate();
    //DefaultTreeModel model=new DefaultTreeModel(tree.getModel());
    //treeModel=(DefaultTreeModel) tree.getModel();
    //tree.setModel(model);
    //treeModel.reload();
    tree.setEditable(true);
    //FileTree.java
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.util.*;
    public class FileTree extends JTree {
    private static DefaultTreeModel model;
    public FileTree(String path) throws FileNotFoundException, SecurityException {
    super((TreeModel)null); // Create the JTree itself
    // Use horizontal and vertical lines
    putClientProperty("JTree.lineStyle", "Angled");
    // Create the first node
    FileTreeNode rootNode = new FileTreeNode(null, path);
    model=new DefaultTreeModel(rootNode);
    // Populate the root node with its subdirectories
    boolean addedNodes = rootNode.populateDirectories(true);
    //model.nodeStructureChanged(rootNode);
    setModel(new DefaultTreeModel(rootNode));
    //(new DefaultTreeModel(rootNode))this.getModel().reload();
    //model.reload();
    // Listen for Tree Selection Events
    addTreeExpansionListener(new TreeExpansionHandler());
    // Returns the full pathname for a path, or null if not a known path
    public String getPathName(TreePath path) {
    Object o = path.getLastPathComponent();
    if (o instanceof FileTreeNode) {
    return ((FileTreeNode)o).file.getAbsolutePath();
    return null;
    // Returns the File for a path, or null if not a known path
    public File getFile(TreePath path) {
    Object o = path.getLastPathComponent();
    if (o instanceof FileTreeNode) {
    return ((FileTreeNode)o).file;
    return null;
    // Inner class that represents a node in this file system tree
    protected static class FileTreeNode extends DefaultMutableTreeNode {
    public FileTreeNode(File parent, String name)
    throws SecurityException, FileNotFoundException {
    this.name = name;
    // See if this node exists and whether it is a directory
    file = new File(parent, name);
    if (!file.exists()) {
    throw new FileNotFoundException("File " + name + " does not exist");
    isDir = file.isDirectory();
    // Hold the File as the user object.
    setUserObject(file);
    // Override isLeaf to check whether this is a directory
    public boolean isLeaf() {
    return !isDir;
    // Override getAllowsChildren to check whether this is a directory
    public boolean getAllowsChildren() {
    return !isDir;
    // For display purposes, we return our own name
    public String toString() {
    return name;
    // If we are a directory, scan our contents and populate
    // with children. In addition, populate those children
    // if the "descend" flag is true. We only descend once,
    // to avoid recursing the whole subtree.
    // Returns true if some nodes were added
    boolean populateDirectories(boolean descend) {
    boolean addedNodes = false;
    // Do this only once
    if (populated == false) {
    if (interim == true) {
    // We have had a quick look here before:
    // remove the dummy node that we added last time
    removeAllChildren();
    interim = false;
    String[] names = file.list(); // Get list of contents
    // Process the directories
    for (int i = 0; i < names.length; i++) {
    String name = names;
    File d = new File(file, name);
    try {
    FileTreeNode node = new FileTreeNode(file, name);
    if (d.isDirectory()) {
    //FileTreeNode node = new FileTreeNode(file, name);
    this.add(node);
    if (descend) {
    node.populateDirectories(false);
    addedNodes = true;
    if (descend == false) {
    // Only add one node if not descending
    break;
    else{   
    //FileTreeNode node = new FileTreeNode(file,name);
    this.add((MutableTreeNode)node);
    //model.reload();
    //model.nodeStructureChanged(node);
    //((DefaultTreeModel)parent.getModel()).nodeStructureChanged(node);
    } catch (Throwable t) {
    // Ignore phantoms or access problems
    // If we were scanning to get all subdirectories,
    // or if we found no subdirectories, there is no
    // reason to look at this directory again, so
    // set populated to true. Otherwise, we set interim
    // so that we look again in the future if we need to
    if (descend == true || addedNodes == false) {
    populated = true;
    } else {
    // Just set interim state
    interim = true;
    return addedNodes;
    protected File file; // File object for this node
    protected String name; // Name of this node
    protected boolean populated;// true if we have been populated
    protected boolean interim; // true if we are in interim state
    protected boolean isDir; // true if this is a directory
    // Inner class that handles Tree Expansion Events
    protected class TreeExpansionHandler implements TreeExpansionListener {
    public void treeExpanded(TreeExpansionEvent evt) {
    TreePath path = evt.getPath(); // The expanded path
    JTree tree = (JTree)evt.getSource(); // The tree
    // Get the last component of the path and
    // arrange to have it fully populated.
    FileTreeNode node = (FileTreeNode)path.getLastPathComponent();
    if (node.populateDirectories(true)) {
    ((DefaultTreeModel)tree.getModel()).nodeStructureChanged(node);
    public void treeCollapsed(TreeExpansionEvent evt) {
    // Nothing to do

    There is a method for reloading a tree
    Have a look at this:
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/tree/DefaultTreeModel.html#reload(javax.swing.tree.TreeNode)
    Hope I understood your problem and it helps.

  • Applet.getImage() but so sloooooowly...

    I've seen a couple of questions posted about this issue, but no resolution. Essentially, performance of Applet().getImage() is unacceptably slow. It happens on my machine, and others.
    I'm using PlugIn 1.3.1 in WinIE 5.5, and have the following simple JApplet:
    public class GoofyApplet extends JApplet
    public void init()
    Image img = getImage(getDocumentBase(), "goofy/mickey/rtb_down.jpg"); // a 4K .jpg
    JLabel lab = new JLabel("test", new ImageIcon(img), JLabel.CENTER);
    Container content = getContentPane();
    content.add(lab);
    validate();
    repaint();
    I run that, and have ample time to curse and fume. About 20-50 seconds.
    Note the docs for getImage:
    "This method always returns immediately, whether or not the image exists. When this applet attempts to draw the image on the screen, the data will be loaded. The graphics primitives that draw the image will incrementally paint on the screen."
    First of all, timing tests have shown that this definition of "immediately" is pretty flexible. In my last test, getImage took 38230 ms.
    I've been cruising around the Forums, looking for an answer to this question and have yet to find it. This is disturbing--I can't believe SUN would ship the plug-in with this kind of behavior--but does this mean there is no solution?
    Cheers,
    Jon

    You need to wait for the image to load in an applet. If you use the Swing version of ImageIcon it will do this automatically for you. Else, use the following methods:
    * Loads an image as a resource.
    * Note:  With Swing, could use ImageIcon instead of createImage()/MediaTracker.
    public Image loadImage(String imageName) {
       Image image = null;
       URL url = getClass().getResource(imageName);
       try {
          image = createImage((ImageProducer) url.getContent());
          if (image==null) throw new Exception();
          waitForImageToLoad(this,image);
       } catch (Exception e) {
          System.out.println("unable to load image: "+imageName);
       }//end try
       return image;
    }//end loadImage
    * wait for an image to completely load. Use in an applet.
    public static void waitForImageToLoad(Component component, Image image) {
       MediaTracker tracker = new MediaTracker(component);
       try {
          tracker.addImage(image, 0);
          tracker.waitForID(0);
       } catch (InterruptedException e) {
          //this should not occur
          e.printStackTrace();
       }//end try
    }//end waitForImageToLoad

  • About images on Landscape view...

    The images in tablet and phone version when you turn to landscape view the images are pixalated. Here I talk about this: http://forums.adobe.com/thread/1127032?tstart=0  I start thinking that is a bug.
    Thanks

    I tried something like that but it didnt work
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    import java.io.*;
    import java.awt.image.*;
    public class applet extends java.applet.Applet {
        private Image background;
        private ImageObserver obs;
        public void init()
            background = getImage(getCodeBase(),"background.jpg");
        public void paint(Graphics g)
            g.drawImage(background,10,10,400,400,obs);
    }this was what i found on google if there is any other way i would be appreciated if you share it with me?

  • Points and discussion about the concepts behind making a 2D game

    Hi all. I'm currently trying my hand at a 2D RPG style game. I have a few questions open for discussion, however, regarding the general points of implementation behind it.
    1. Tiles vs static background argument aside, am I right in the thinking the best way of implementing movement across a big background map is actually to move the background and other sprites in relation to the player, giving the illusion of player movement although he in fact never moves from the center of the screen? Is there a way of actually creating a large map, populating it with sprites, and then moving the player across it and panning the screen after him?
    2. Collision detection. If we go with the idea of moving everything in relation to the player rather than the player himself, woudln't this mean a large amount of calculations when collision detection occurs. Example, u want the player to stop moving when he hits a brick wall so you have to tell every entity sprite to stop moving in response to key presses (because remember, pressing up moves everything else up, not the player character).
    3. Isometric. Is the easiest way of implementing an isometric style game just to develop isometric graphics and sprites?
    4. Tiles. I've been doing a lot of reading into tiles but I'm not sure what's a better implementation: a tile system which consists of the entire background and things like houses split into tiles or a simple big background which can be scrolled around and is populated by house sprites which are all moved in relation to the player and their collision detections done individually. Tiles certainly seem like a nice innovation but I feel like the graphics suffer as a consequence and u end up with a 8bit NES looking game!
    I'm just getting to grips with the concepts behind a lot of game design and all of this are some interesting points which I thought would be insightful to discuss. Opinions please!
    Cheers.

    Everything I'm about to say is based off of a tile-based Maze game I made.
    1. Using a big background map is a bit lazy if you ask me, but graphically it would be easier to create a nice-looking game. You also have to think about memory. Let's say you manage to get an 800x600 background image at the size of 200kb with JPEG compression. That 200kb jpg image you use as a background is not 200kb when loaded into memory. I dont remember exactly how much bigger it gets in memory, so this next statement is probably wrong. But I heard that: 4bytes per pixel for the ARGB data, and there are 800x600 (480,000) pixels. That's 480000*4 (1920000) bytes if that statement is right. But it's probably wrong, so hopefully Abuse or someone will correct it :)
    2. Move EVERYTHING up? I think you're a little mixed up. When the background (and all objects with it) is scrolled, their actual X,Y data is not changed. It is simply drawn according to the scroll offset. The only thing that is being calclulated for movement is the character/scroll offset. Think of it as a camera. The entire world is not moving, just the location of where you're viewing it. Quick example:
    You have a Tree who's location is (10,10). If the scroll offset is (0,0), then that Tree will be drawn at (10,10). But let's say your character moves up 5 pixels. You say you want him centered, so the scroll offset also moves up 5 pixels, making the offset (0,-5). When it's time to draw again, that Tree can't be at the same place it was, because the character moved. If the character moved up, the Tree would appear as if it moved DOWN. So you'd draw it like:
    g.drawImage(tree.getImage(),tree.x-scrollOffsetX,tree.y-scrollOffsetY,null);With that math, the Tree is actually drawn at (10,15), which is lower than before the character moved. You don't actually loop through all of your objects and change each and every X and Y value, you just change the global scroll offset
    Speaking of collision detection, this is where TileMaps have a large advantage. In a TileMap, you don't have to check through each and every object in the world for collision. You can just grab the 4 surrounding tiles (north,west,east,south) from the Tile array. This means there are only 4 collision detections no matter where the character is in any situation on the map.
    If you used an image for background instead of tiles, you'd have to check each object in the world for collision because it's harder to tell how close it is to the character. One thing you could do is just grab all of the object currently visible on screen and check their collision, but, depending on where you are on the map, this could easily cause an inconsistent frame rate (you could be in a field of grass that has no collision or a forest of 50 trees each screen- LOTS of collision!).
    3. I dont got much to say about isometric :P
    4. an 8bit NES game, eh? That is the common misconception that you have to use images that are the same size of the tiles. Have you seen the game "The Legend of Zelda: Four Swords"? That's a tile-based game, but on several occasions you see trees that are 10 times bigger than the 20x20 tiles. They mixed it up, they used a TileMap for the basic ground, and put good looking large images on top. The large images (such as a large tree) uses 4 or 5 "base" tiles that are used for collision. That way the character will only collide with the bottom-half of the tree, giving the appearance of going "behind" the tree when the Y value is above the middle line of the tree. This is far away from looking like an 8bit NES game :)
    I hope that was more helpful than it was confusing, but I tend to babble, so.. anyway. Hope it helps :o

  • Adobe Bridge in Photoshop - How to install Bridge and camera raw? And what is it all about?

    Hi everyone! I am actually in love with this adobe photoshop. I used PSCS2 before, but later on upgraded to CS4. But I feel tired in upgrading to CS5.
    One time, I found a tutorial in youtube about camera raw, and would really want to use it. But I was wondering how to install the camera raw. I believe camera raw is a plugin? so I downloaded the plugin here, installed it in my PS. I downloaded a file Camera Raw.8bi and paste it on my C drive - C:\Program Files\Adobe\Photoshop CS4\Plug-ins\File Formats.
    I now am very confused, how will I open it? I do not have adobe bridge!  After I installed the camera raw, I opened my PS. I clicked the file>then browse in bridge. I had an error, it's "error 2 photoshop11 undefined". Which is what I thought, I might have done something wrong with installing it.
    My question is, do you still need adobe bridge installed in order to use camera raw?
    If yes, how does it work? How am I suppose to open camera raw?
    If no, how am I going to open camera raw without bridge?
    And also, where will I download adobe bridge? I cannot find one here for CS4, only adobe bridge for CS5. I am wondering, is it okay to install adobe bridge CS5 and use it with my PS CS4?
    I badly need help!

    WebDAV (Web-based Distributed Authoring and Versioning) is a set of extensions to HTTP/1.1.
    The main difference from FTP as far as I can see is that it allows you to edit documents on a remote web server.
    WebDAV was used by the Apple server - MobileMe but is not generally supported by hosting services.
    Using WebDAV you can mount a directory locally. This was how iDisk worked on your Mac and you could drag files onto it to upload them to the remote directory.
    With WebDAV, a number of users can share a directory which is why its used in local networks but presents security problems when using a remote server.
    If you are into file sharing rather than publishing, Dropbox or its new rival SugarSync are more appropriate.

  • A few days ago i bought the macbook pro in a Providence. In late Summer i will come back to my Country - Ukraine. I would like to know about a tax for my laptop. Can i return tax? Through the TAX FREE or return in airport? What should i do?

    A few days ago i bought the macbook pro in a Providence. In late Summer i will come back to my Country - Ukraine. I would like to know about a tax for my
    laptop. Can i return tax? Through the TAX FREE or return in airport? What should i do?

    You need to talk with the tax authorities in the countries to which you traveled and that of your home country. We are all end-users liek you and not Apple agents.

  • I am trying to use itunes, it will not open at all, have uninstalled and downloaded new software and 64bit for windows. i have an old ipod nano from about 5 years ago. anything i can do, even to view my purchases and watch/listen to music etc?

    ok i have a advent roma laptop with window 7. my itunes used to work fine, completely. every time i plugged in my ipod it was ok. recently my ipod was not working so i never bothered with itunes, however i have movies/tv prog that i purchased and would like to view them. i have an ipod nano from about 5 years ago, the problem with thet is, it switches on, but the circular control panel does nothing, all you can do is lock and unlock it - nothing else.
    i tried to download new version of itunes, then uninstalled my origonal version, incase it was corrupted etc, i then again tried to down load new version and also version that is windows 64bit. still when i select the downlaod to open as son as it is finnished nothing happens. and now my desktop shortcut has dissapeared. before when it was there, id double click it, nothing, right click to open it, nothing.
    im not the best technically minded but i just dont see what im doing wrong here, please help

    Perhaps it would be helpful for you to view the page source code of this page
    http://www.alanwork.com/
    As you can see, the submenu code links are immediately below the top level code, and are
    wrapped in their own  <UL> </UL> tag pairs.
    Hope that helps

  • Vendor payments and debts about an asset

    Dear sap colleages
    I need to know these information about an ASSET:
    Purchased orders,
    Items from purchase orders,
    which of these items i've received, i've paid (also date), i've not paid ( amount of debt related to asset)
    payments in advanced (date),
    wich of these payments have been cleared (clearing date) and wich not,
    who is the vendor,
    other expenses (such as delivery)
    the amount of taxes,
    invoices related and NOT RELATED TO purchase order
    payments without invoice
    Which transactions do i need to follow?
    or
    Which document flow?
    or
    Which tables? Wich keys?
    or
    Is there a standard report that can give me such information?
    Any documentation and/or code will be appreciated.
    I need to program a report to integrate all these information.
    Thanks and Kind Regards

    Hi,
    Refer to T.code AW01N - Asset Explorer .
    Additionally you cna also refer to SAP Standard reports in Asset Accounting
    Accounting - Financial Accounting - Fixed Assets - Information System - Reports on Asset Accounting
    Please let me know if you need more information.
    Assign points if useful.
    Regards
    Sridhar M

Maybe you are looking for

  • Can't get iTunes to add a (home) video to the library.

    Adding a video to iTunes.  "Help" (HA!) says to use Menu/File/Add File to Library or drag and drop, just like an audio file.  Neither works for me.  If I drag and drop, iTunes will create an empty playlist with the filename of the video; no file, jus

  • Portal rendering errors using IE10

    Hi, We've recently patched all of our SAP systems (portal and backend) and checked we're at the requisite level for IE10 support in the PAM. We're currently in the process of testing all of our applications for IE10 compliance and have identified two

  • Multiple installs of SAM on the same machine

    I am trying to install SAM for DEV and QA environments on the same server by doing separate installs. Has anyone tried to install multiple instances of SAM on the same machine? I've run into errors where the 2nd install will not recognize a new direc

  • Export under Rebate - No Bond

    Dear all, I have already created a pricing for exports with ED & Cess statistical as for exports we dont pay duty. When i go to create bond under rebate i am getting a error message  - Bond cannot be created under rebate. To my knowledge when we do e

  • Save pkg spec and body

    LO, When using the "save package spec and body", a single file (pls extension) is generated with package spec and package body, including '/' characters, which is what is expected. The trouble is that if you open this file back with SQL developer, a