Problems drawing images form another class

Ok as the title says I'm having trouble drawing images from a different class. I have a class that represents a plane and it has a draw' method that draws its .gif image.
public void draw (Graphics g)
g.drawImage(planepic , xPos, yPos, null)
then in my main class in the paint method i have
plane.draw(g);
I think my problem is the null for my image observer. I tried using null as my image observer and i got a error saying i can't make a static reference to a non static method.
I've done some research because i never really understood static but i still don't quite get it.
Also when I use this as my image observer i get a error in my plane object.
I also just tried passing and making a object for my main class and i still got the static error.
Any help is appreciated and thanks in advance

Ok as the title says I'm having trouble drawing
images from a different class. I have a class that
represents a plane and it has a draw' method that
draws its .gif image.
public void draw (Graphics g)
g.drawImage(planepic , xPos, yPos, null)
in my main class in the paint method i have
plane.draw(g);
I think my problem is the null for my image observer.
I tried using null as my image observer and i got a
error saying i can't make a static reference to a non
static method. Use a minimal implementation of the ImageObserver to be sure.
public class Plane implements ImageObserver
public boolean imageUpdate(
Image img,int infoFlags,int x,int y,int width,int height)
   switch(infoFlags)
      case ALLBITS:
                return false;
      case SOMEBITS:
                return true;
      default:
            return true;
I've done some research because i never really
understood static but i still don't quite get it.
Also when I use this as my image observer i get a
error in my plane object.
I also just tried passing and making a object for my
main class and i still got the static error.
Any help is appreciated and thanks in advanceWhen you call draw(g) from your other class you hand it a Graphics context that you instantiated somewhere else ie: in another class. Without a more complete example it is really impossible to determine your issue for sure,
but if I was to guess I would say you need to make sure that the Graphics context handed to the draw(Graphics) method was instantiated from a Component that was already visible. ie: Do a f
Frame.createImage() from your parent frame after iyou have already called setVisible(true); In other words I suspect you are making and Image from some other Component that is not yet visible. That however is a guess so if not the issue post the rest of the code or at least a minimal implementation that demonstrates this.
About static:
static means the class/variable is the same throughout ALL classes of that type and if changed in one instance it will change and thus be the same for all instances.
You CAN call static by referencing the base class Object without having to instantiate.
ie:given
public class SomeClass
static String name;
static String getName
   if(name == null)
      name = "DefaultName";
   return name;
}Thus you could call..
  String name = SomeClass.getName();As opposed to
SomeClass myClass = new SomeClass();
      myClass.getName();This can get you in trouble if you try to make a method that is static
that then tries to reference non static variables.
ie:
public class SomeClass
int x;
static String name;
SomeClass()
   x=0;
static String getName
   if(name == null)
      name = "DefaultName";
   x++;
   return name;
}In this case SomeClass.getName(); will throw and exception because it is trying to access[b] x  from a static context .
Hope that clears that up for you; if not post a more complete example.
Good Luck!
(T)

Similar Messages

  • Problems drawing image

    Im sorry for even askign this but i'm having problems drawing an image, no idea why its not working!!! I know that my Image object actually is the image because i can get it to display on a button, but i need to get it to display in the JPanel through the paintComponent() method, for some reason it wont do it. Thanks for the help.
    Here's my code
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class StatWindow extends JDialog{
        private StatPanel panel;
        public StatWindow(JFrame parent) {
            this(parent, null);
        public StatWindow(JFrame parent, String data){
            super(parent, "Stat", false);
            getContentPane().setLayout(null);
            panel = new StatPanel();
            getContentPane().add(panel);
            panel.setBounds(0, 0, 220, 220);
            setSize(300, 300);
            setVisible(true);
        class StatPanel extends JPanel{
            private Image diagram1;
            private Image diagram2;
            private Image diagram3;
            private Image diagram4;
            private Image diagram5;
            private Image diagram6;
            private Image diagram7;
            private Image diagram8;
            private Image diagram9;
            private Image diagram10;
            private Image diagram11;
            private Image diagram12;
            private Image diagram13;
            private Image diagram14;
            private Image diagram15;
            private Image diagram16;
            private Image diagram17;
            private Image diagram18;
            private Image diagram19;
            private Image diagram20;
            private Image diagram21;
            private Image diagram22;
            private Image diagram23;
            private Image diagram24;
            private Image diagram25;
            private Image diagram26;
            private Image diagram27;
            public StatPanel(){
                super();
                Image diagram1 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_01.jpg"));
                Image diagram2 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_02.jpg"));
                Image diagram3 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_03.gif"));
                Image diagram4 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_04.jpg"));
                Image diagram5 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_05.jpg"));
                Image diagram6 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_06.jpg"));
                Image diagram7 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_07.gif"));
                Image diagram8 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_08.jpg"));
                Image diagram9 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_09.jpg"));
                Image diagram10 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_10.jpg"));
                Image diagram11 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_11.gif"));
                Image diagram12 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_12.jpg"));
                Image diagram13 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_13.jpg"));
                Image diagram14 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_14.gif"));
                Image diagram15 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_15.gif"));
                Image diagram16 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_16.jpg"));
                Image diagram17 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_17.jpg"));
                Image diagram18 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_18.gif"));
                Image diagram19 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_19.jpg"));
                Image diagram20 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_20.jpg"));
                Image diagram21 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_21.jpg"));
                Image diagram22 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_22.gif"));
                Image diagram23 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_23.jpg"));
                Image diagram24 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_24.gif"));
                Image diagram25 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_25.jpg"));
                Image diagram26 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_26.jpg"));
                Image diagram27 = getToolkit().getImage(getClass().getResource("xpbn/media/stat/Diagram_27.jpg"));
                addMouseMotionListener(new MouseMotionHandler());
                addMouseListener(new MouseHandler());
                JButton b = new JButton(new ImageIcon(diagram1));
                getContentPane().add(b);
                b.setBounds(0, 0, 40, 40);
            class MouseMotionHandler extends MouseMotionAdapter{
                public void mouseMoved(MouseEvent e){
            class MouseHandler extends MouseAdapter{
                public void mousePressed(MouseEvent e){
            public void paintComponent(Graphics g) {
                super.paintComponent(g);
                Graphics2D g2d = (Graphics2D)g.create();
                g2d.drawImage(diagram1, 0, 0, this);
                g2d.dispose();
    }

    you have these declarations
    private Image diagram1;
    private Image diagram2;
    and in your constructor you have these
    Image diagram1 = getToolkit().getImage...
    Image diagram2 = getToolkit().getImage...
    the inclusion of the 'type' Image makes them local to the constructor

  • Calling a method within a class form another class(ViewController)

    I am creating an SQL project in XCODE. I have one view. My main view controller is loading the database to a table/array. I want to add another class (with no NIB) just to handle the display of the table in a UITableView. So, I added a skeleton cocoa touch class file to my classes folder to handle this function when parameters change.
    So, in my app delegate, the "applicationdidFinishLaunchingWithOptions" method loads my mainViewController and NIB.  On the "viewDidLoad" method in my mainViewController, I read a URL into an SQLite database and close the database.  Herein lies the problem: I want to call my new class (TableViewHandler) and pass it the array created in the mainViewController and use the array to populate the UITable.
    How do I call a class from within another class (which has no NIB) to populate the table?  Especially if my TableViewHandler has no "viewDidLoad", "viewDidAppear", etc.
    Regads,
    -Kevin

    This is what my exact problem.
    i've created a bean (DataBean) to access the database. i'm having a servlet program (ShopBook). now to check some details over there in the database from the servlet i'm in need to use a method in the DataBean.
    both ShopBook.java and DataBean.java lies in the package shoppack.
    in ShopBook i tried to instantiate the object to DataBean as
    DataBean db = new DataBean();
    it shows the compiler error, unable to resolve symbol DataBean.
    note:
    first i compiled DataBean.java, it got compiled perfectly and the class file resides inside the shoppack.
    when i'm trying to compile the ShopBook its telling this error.
    hope i'm clear in explaining my problem. can u please help me?
    thank u in advance.
    regards,
    Fazli

  • Problem getting arraylist from another class

    I am trying to call information about an arraylist from another class. I am using this code to call the size of an arraylist:
    import java.io.*;
    public class Test
        public static void main(String argv[]) throws IOException
    Echo03 thing = new Echo03();
    int y=thing.value();
    System.out.println(y);
    Echo03 thing2 = new Echo03();
    int x=thing2.percent.size();
    System.out.println(x);
    }from another file which starts like this:
    public class Echo03 extends DefaultHandler
    static ArrayList<String> percent = new ArrayList<String>();
    static ArrayList<String> text = new ArrayList<String>();
      int a;
    public int value(){
         return percent.size();
      public static void main(String argv[]) throws IOException
        {The second file is based on an example piece of code from the Java website. I havent posted the whole thing, but if it is relevant then please ask.
    Anyway when I run Echo03 by itself, the arraylist has a size of 2. But when I run it from the Test file, it says a size of 0. Is this because the data is not being transferred between the classes? Or is the Echo03 program not executing (and hence the arraylist is not filling up)?
    How can I fix this? I have tried 2 ways of calling the data (As seen in my Test file). Neither work.

    I didnt post the full bit of the code for the second one. Here it is:
    import java.io.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    import java.util.ArrayList;
    import java.awt.*;
    import javax.swing.*;
    public class Echo03 extends DefaultHandler
    static ArrayList<String> percent = new ArrayList<String>();
    static ArrayList<String> text = new ArrayList<String>();
      int a;
      public static void main(String argv[]) throws IOException
            if (argv.length != 1) {
                System.err.println("Usage: cmd filename");
                System.exit(1);
            // Use an instance of ourselves as the SAX event handler
            DefaultHandler handler = new Echo03();
            // Use the default (non-validating) parser
            SAXParserFactory factory = SAXParserFactory.newInstance();
            try {
                // Set up output stream
       out = new OutputStreamWriter(System.out, "UTF8");
                // Parse the input
                SAXParser saxParser = factory.newSAXParser();
                saxParser.parse( new File(argv[0]), handler);
    for (int b=0; b<percent.size();b++){
         System.out.println(percent.get(b+1));
            } catch (Throwable t) {
            System.exit(0);
        static private Writer  out;
        public void startElement(String namespaceURI,
                                 String lName, // local name
                                 String qName, // qualified name
                                 Attributes attrs)
        throws SAXException
            if (attrs != null) {
    StringBuffer sb = new StringBuffer (250);        
    for (int i = 0; i < attrs.getLength(); i++) {
                    nl();
                    emit(attrs.getValue(i));
              sb.append (attrs.getValue(i));
    String sf = sb.toString ();
    percent.add(sf);
    System.out.println(" String: "+sf); a++;
        public void characters(char buf[], int offset, int len)
        throws SAXException
             emit(" ");
            String s = new String(buf, offset, len);
            if (!s.trim().equals("")) {text.add(s); emit(s);}
    //===========================================================
        // Utility Methods ...
        //===========================================================
        // Wrap I/O exceptions in SAX exceptions, to
        // suit handler signature requirements
        private void emit(String s)
        throws SAXException
            try {
                out.write(s);
                out.flush();
            } catch (IOException e) {
                throw new SAXException("I/O error", e);
        // Start a new line
        private void nl()
        throws SAXException
            String lineEnd =  System.getProperty("line.separator");
            try {
                out.write(lineEnd);
            } catch (IOException e) {
                throw new SAXException("I/O error", e);
    }

  • Drawing images when your class is in a package.

    I have a class in a package. The image I want to draw is in the package, but when I draw it g.drawImage(img, 0, 0, this); it won't draw, even though the image is in the same directory as that class.
    Here is the code:
    package Game;
    import java.awt.*;
    public class SplashScreen extends Frame{
         splashPanel sp;
         public SplashScreen(){
              super("Splash");
              sp = new splashPanel();
              add(sp);               
    class splashPanel extends Panel{
         Image splash;
         public splashPanel(){
              super();
              splash = Toolkit.getDefaultToolkit().getImage("paddle1.gif");
              repaint();          
         public void paint(Graphics g){
              g.setColor(Color.black);
              g.fillRect(0,0,200,200);
              g.drawImage(splash, 0, 0, this);
              System.out.println("Image");
    }

    Still doesn't work.
    package Game;
    import java.awt.*;
    public class SplashScreen extends Frame{
         splashPanel sp;
         public SplashScreen(){
              super("Splash");
              sp = new splashPanel();
              add(sp);               
    class splashPanel extends Panel{
         Image splash;
         public splashPanel(){
              super();
              splash = Toolkit.getDefaultToolkit().getImage("splash.jpg");
              MediaTracker tracker = new MediaTracker(this);
              tracker.addImage(splash, 0);
              try{
                   tracker.waitForID(0);
              } catch (InterruptedException e){}
              repaint();          
         public void paint(Graphics g){
              g.setColor(Color.black);
              g.fillRect(0,0,200,200);
              g.drawImage(splash, 0, 0, this);
              System.out.println("Image");
    }

  • Java.lang.StackOverflowError problem, drawing images in applet :(

         * Paints the applet
        @Override
        public void paint(Graphics g)
            if(running && levelOne)
            g.setColor(Color.MAGENTA);
            g.drawString("HP Left: " + player.getHP(), 100, 10);
    //      g.drawString("Time Left: " + timer.getTime(), 170, 10);
            g.drawString("Score: " + player.getScore(), 30, 10);
            g.drawString("Required Score To Next Level: " + player.getScore() + "/3000", 100, 190);
            g.drawString("Level: 1", 30, 190);
            g.fillOval(x_pos - radius, y_pos - radius, 2 * radius, 2 * radius);
            if(start && storyStarted)
                try
                    update(g);
                    paintStory();
                catch(java.lang.StackOverflowError sofe)
                    System.exit(0);
            else if(start)
                g.drawImage(image, 0, 0, this);
                g.drawImage(gun, 200, 400, this);
         * Updates the paint() method and the applet
        @Override
        public void update(Graphics g)
            if(dbImage == null)
                dbImage = createImage(this.getWidth(), this.getHeight());
                dbG = dbImage.getGraphics();
            dbG.setColor(getBackground());
            dbG.fillRect(0, 0, this.getWidth(), this.getHeight());
            dbG.setColor(getForeground());
            paint(dbG);
            g.drawImage(dbImage, 0, 0, this);
        public void paintStory()
            getGraphics().drawImage(story1, 0, 0, this);
        }I know that my problem appears somewhere in the above written code, so if you would take a look, and try to help me fixing my problem! :D

    Vimsie wrote:
    I get a StackOverflowError, but the image isn't flickering!Err, the image is not flickering because there are no repaints happening anymore due to the StackOverflowError. This is hardly an argument for your approach.
    However, I have to admit I don't know how to solve your flickering problem. I've never used AWT but always SWING (but then I don't do applets).
    Maybe google can help?

  • Importing image to another class.

    In the view controller file.
    there is two methods, one is for opening the iphone photo library
    and the other one is didFinishPickingImage:editingInfo.
    after choosing the image, it will the bring the user to the SomeEdit file with .xib file
    in the someEdit file there is a UIImageView already.
    but the question is I don't know how to link the two files together.
    to show the image in the someEdit interface.
    Can anyone tell me what method I should add to let it link together?

    Hi,
    Take a look at this:
    http://www.alkanesolutions.co.uk/2013/04/19/embedding-base64-image-strings-inside-a-powershell-application/
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • How to reach a method of an object from within another class

    I am stuck in a situation with my program. The current situation is as follows:
    1- There is a class in which I draw images. This class is an extension of JPanel
    2- And there is a main class (the one that has main method) which is an extension of JFrame
    3- In the main class a create an instance(object) of StatusBar class and add it to the main class
    4- I also add to the main class an instance of image drawing class I mentioned in item 1 above.
    5- In the image drawing class i define mousemove method and as the mouse
    moves over the image, i want to display some info on the status bar
    6- How can do it?
    7- Thanks!

    It would make sense that the panel not be forced to understand its context (in this case a JFrame, but perhaps an applet or something else later on) but offer a means of tracking.
    class DrawingPanel extends JPanel {
      HashSet listeners = new HashSet();
      public void addDrawingListener(DrawingListener l) {
         listeners.add(l);
      protected void fireMouseMove(MouseEvent me) {
         Iterator i = listeners.iterator();
         while (i.hasNext()) {
            ((DrawingListener) i.next()).mouseMoved(me.getX(),me.getY());
    class Main implements DrawingListener {
      JFrame frame;
      JLabel status;
      DrawingPanel panel;
      private void init() {
         panel.addDrawingListener(this);
      public void mouseMoved(int x,int y) {
         status.setText("x : " + x + " y: " + y);
    public interface DrawingListener {
      void mouseMoved(int x,int y);
    }Of course you could always just have the Main class add a MouseMotionListener to the DrawingPanel, but if the DrawingPanel has a scale or gets embedded in a scroll pane and there is some virtual coordinate transformation (not using screen coordinates) then the Main class would have to know about how to do the transformation. This way, the DrawingPanel can encapsulate that knowledge and the Main class simply provides a means to listen to the DrawingPanel. By using a DrawingListener, you could add other methods as well (versus using only a MouseMotionListener).
    Obviously, lots of code is missing above. In general, its not a good idea to extend JFrame unless you really are changing the JFrames behavior by overrding methods, etc. Extending JPanel is okay, as you are presumably modifiying the drawing code, but you'd be better off extending JComponent.

  • I am using Lightroom 5 and am hapy about it, but recently I hav encountered a problem when trying to edit an image in another program, i.e. Elements. I used the clone tool, saved the result and went back to Lightroom to open the image there. I did find a

    I am using Lightroom 5 and am hapy about it, but recently I hav encountered a problem when trying to edit an image in another program, i.e. Elements. I used the clone tool, saved the result and went back to Lightroom to open the image there. I did find a second copy, but this is identic with the one I already had in Lightroom, and I can see noe result of the clone process.

    At the moment I would say it is uncertain whether Acrobat is completely ignoring the change, or whether the changes you are making aren't affecting the ink density. I have a suggestion for a test you could make to see which is the case.
    When editing in Photoshop just add a box or mark on the image, for your tests.
    - If this box does not appear in Acrobat, you know Acrobat is not seeing the edit
    - If this box does appear in Acrobat, you know the problem is that your tool for changing ink densities is not taking effect.

  • Calling method from another class problem

    hi,
    i am having problem with my code. When i call the method from the other class, it does not function correctly?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class Dice extends JComponent
        private static final int SPOT_DIAM = 9; 
        private int faceValue;   
        public Dice()
            setPreferredSize(new Dimension(60,60));
            roll(); 
        public int roll()
            int val = (int)(6*Math.random() + 1);  
            setValue(val);
            return val;
        public int getValue()
            return faceValue;
        public void setValue(int spots)
            faceValue = spots;
            repaint();   
        @Override public void paintComponent(Graphics g) {
            int w = getWidth(); 
            int h = getHeight();
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setColor(Color.WHITE);
            g2.fillRect(0, 0, w, h);
            g2.setColor(Color.BLACK);
            g2.drawRect(0, 0, w-1, h-1); 
            switch (faceValue)
                case 1:
                    drawSpot(g2, w/2, h/2);
                    break;
                case 3:
                    drawSpot(g2, w/2, h/2);
                case 2:
                    drawSpot(g2, w/4, h/4);
                    drawSpot(g2, 3*w/4, 3*h/4);
                    break;
                case 5:
                    drawSpot(g2, w/2, h/2);
                case 4:
                    drawSpot(g2, w/4, h/4);
                    drawSpot(g2, 3*w/4, 3*h/4);
                    drawSpot(g2, 3*w/4, h/4);
                    drawSpot(g2, w/4, 3*h/4);
                    break;
                case 6:
                    drawSpot(g2, w/4, h/4);
                    drawSpot(g2, 3*w/4, 3*h/4);
                    drawSpot(g2, 3*w/4, h/4);
                    drawSpot(g2, w/4, 3*h/4);
                    drawSpot(g2, w/4, h/2);
                    drawSpot(g2, 3*w/4, h/2);
                    break;
        private void drawSpot(Graphics2D g2, int x, int y)
            g2.fillOval(x-SPOT_DIAM/2, y-SPOT_DIAM/2, SPOT_DIAM, SPOT_DIAM);
    }in another class A (the main class where i run everything) i created a new instance of dice and added it onto a JPanel.Also a JButton is created called roll, which i added a actionListener.........rollButton.addActionListener(B); (B is instance of class B)
    In Class B in implements actionlistener and when the roll button is clicked it should call "roll()" from Dice class
    Dice d = new Dice();
    d.roll();
    it works but it does not repaint the graphics for the dice? the roll method will get a random number but then it will call the method to repaint()???
    Edited by: AceOfSpades on Mar 5, 2008 2:41 PM
    Edited by: AceOfSpades on Mar 5, 2008 2:42 PM

    One way:
    class Flintstone
        private String name;
        public Flintstone(String name)
            this.name = name;
        public String toString()
            return name;
        public static void useFlintstoneWithReference(Flintstone fu2)
            System.out.println(fu2);
        public static void useFlintstoneWithOutReference()
            Flintstone barney = new Flintstone("Barney");
            System.out.println(barney);
        public static void main(String[] args)
            Flintstone fred = new Flintstone("Fred");
            useFlintstoneWithReference(fred); // fred's the reference I"m passing to the method
            useFlintstoneWithOutReference();
    {code}
    can also be done with action listener
    {code}    private class MyActionListener implements ActionListener
            private Flintstone flintstone;
            public MyActionListener(Flintstone flintstone)
                this.flintstone = flintstone;
            public void actionPerformed(ActionEvent arg0)
                //do whatever using flinstone
                System.out.println(flintstone);
        }{code}
    Edited by: Encephalopathic on Mar 5, 2008 3:06 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Draw image between edges in another image

    HI
    i try to draw an image between a specified edges in another image
    can any one help me and provide me with a code that perform this task

    elsabry wrote:
    HI
    i try to draw an image between a specified edges in another imageHow are the 'edges' specified? It is easy to draw one image, then another over the top that has areas of transparency.
    can any one help me and provide me with a code that perform this taskWhat have you got so far? Note that these forums are not a 'code generation machine'.
    BTW - To help your reader, please put a single upper case letter at the start of every sentence, and a full-stop (or question mark, or exclamation mark) at the end. This helps the reader to quickly scan the text, looking for ways to help. You would not want to make it harder to help, would you?

  • Drawing from another class

    I have a class Score and in that lcass I have the following method:
      * Draw the score to the applet windows
      * @param g The graphics object
    public void draw(Graphics g, int x, int y)
      calculateScore();
      String stringScore = new Integer(usersScore).toString();
      g.drawString(stringScore, x, y);
    In my Applet class, Driver, I have a global graphics object:
    Graphics gObject;
    I initialize it in the paint method by sayingpublic void paint(Graphics g)
    gObject = g;
    But, inside the Applet when I call the method draw it doesn't work.
    Then I tried
    gObject = getGraphics(0But that didn't work either.
    Is it possible to draw to an applet from another class?
    Thanks.

    I just read one of you other postings on a similiar topic. In that thread everybody is assuming you are using Swing and are giving suggestions based on that assumption.
    In this thread it appears you are using AWT so I gave suggestions based on that assumption.
    It would be nice if you actually asked a clear question and stated what you are doing so people don't waste time guessing what the heck you are trying to do.
    Thats one reason why I always ask for demo code. So we don't waste time guessing.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • Is there a way to click on one image and activate the animation in another class?

    I'm using the ibooks.js library. So it'd need to .activate another class if using the ibooks-toggleable function.
    Thanks!

    Harold,
    I can't say how this compares to Word, since I don't use it, but you can open as many document at a time as you wish in Pages. Each will have its own window. Having too many open will slow your system and reduce Macbook battery life.
    Jerry

  • Another Problem with Oracle Forms 10G

    Hi Experts;
    Previously I posted here a problem was having with Oracle Form, when I tried to execute it (Internet Explorer has closed this webpage to help protect your computer. A malfunctioning or malicious add-on has caused Internet Explorer to close this webpage) .
    However, with the help of a good Buddy of this forum, I could solved the problem and my forms were running properly. But today, i don't know how it's giving me a new problem. When I choose Run Form, I get this error (website restore error. Internet Explorer has stopped trying to restore this website. It appears that the website continues to have a problem.)
    Any suggestion to solve this problem?
    Thanks for your help.
    Regards
    Al

    Hi Aamir;
    I didn't upate file, but I don't know how, but last sunday the google toolbar was installed. I removed it already yesterday, but now I got this problem, I don't know if the installation and then, removing this toolbar, updated any important file.
    The thing is, now I can not execute my forms.
    Regards;
    Al

  • How to add objects to panel in one class from another class

    Hi this is what i am trying to do. I have a drag and adrop tool working where the users and select objects on a small panel and drag them to another panel called the tpan. What i want to do is create another class, which creates objects and now i want to display these objects on the tpan. So say i have a class DisplayTpan(), this class is used to display the objects which have been dragged from the small panel, and objects on this panel have mouselisteners attached, so that these objects can be moved around on the tpan. I have created another class called creatObj(), and from this class i want to add objects to the tpan. The DisplayTpan class extends a Jpanel, would this be he case for the CreateObj() class? In the CreateClass i have made a call to DisplayTpan t = new DisplayTPan();
    t.add(object);
    But this does not add the object to the panel, any ideas on how it should be done?
    Problem number two i have is say, I have two objects created on that oanel, i now want to draw a line t connect the two objects, this is just simply a call to the drawLine function but how would it be possible to add a ,mouselistener to that line, so it can be extended moved around etc? Any help much appreciated thanks.

    Try to convert the PL/SQL code from Forms trigger into a PL/SQL library(.PLL),
    and then attach that PLL in your forms.
    Note that all Forms objects should be referenced indirectly, for example,
    you have to rewrite
    :B1.DEPT_CODE := :B2.DEPT_CODE;
    :B3.TOTAL_AMOUNT := 100;
    ==>
    copy('B2.DEPT_NO','B1.DEPT_NO');
    copy('100','B3.TOTAL_AMOUNT');
    This is the best way to share PL/SQL code among Oracle Forms.

Maybe you are looking for

  • Prevent creation of additional common objects at the  same time ...

    Context: A Super User group may require to be allowed to create and/or change queries in Production Would be possible to prevent creation of additional common objects like rectricted and calculated key figures and variables at the same time allowing

  • Converting the char into date format?

    Hi!!! Guru's    i am using std DS of SD 2LIS_11_VAITM, in that the date fields are in the the char format, so i wann show the difference of the to dates in Days into the report, can any body put some light on this thread. wil assign pts for sure than

  • How to set up Microsoft Office Communicator ?

    this app comes with Anna Upgrade to my N8 device and i know from previous topic that it used for a IM , but i don't know how to set it up.... and the user name and the password for what account ? .... and what's the CWA server URL? ..... and from whe

  • Running query based on other query result

    Hi Again Friends. first of all i am very much thankful for members who sent me prompt response and been helping for last 2 days.I am again with query,maybe a lame one. I want to run a query based on record return from previous query.FOr instance i ha

  • Query to find employees who are managers for 3 or more employees

    Hi, I am using emp table in scott schema for this query. select * from emp where empno in (select e.mgr from emp e, emp m where e.mgr = m.empno group by e.mgr having count(*) >= 3); It gives all employee details where he is manager for more than or e