Implementation of DragManager in extended Panel class

Hi,
I'm facing a problem during implementation of DragManager in
extended Panel class. I've a component which is extending the Panel
class where I've attached four Images with their corresponding
dragging features.
Say, the four images' x positions as these: x1 = 10, x2 = 20,
x3 = 30, x4 = 40. After adding the DragManger class and
implementation of dragging feature to those Images, the dragging is
works fine. But, the problem is, when I'm dragging x1 image, the
imageProxy associated to x1 starts showing from exactly the x1
position, but also all the three images' (x2, x3, x4) imageProxy
starts dragging from x1 position only! When the expected result is,
the x2 imageProxy shud starts drag from x2 x position itself, and
for other x3 imageProxy from x3 position and x4 is their also.
Except the x1 image, all the other three's imageProxy are not
starts from their respective image x position.
Anyone can give any idea.. how to overcome this?
tnks.
ASB

What are the:
DragManager.doDrag(initiator, ds, event, imageProxy, x, y,
1.0);
x and y parameters in your drag manager's doDrag method? They
should be calculated from the point of mouse click that would
event.localX and event.localY.
ATTA

Similar Messages

  • Implementing Runnable interface  Vs  extending Thread class

    hi,
    i've come to know by some people says that Implementing Runnbale interface while creating a thread is better option rather than extending a Thread class. HOw and Why? Can anybody explain.?

    Its the same amount of programming work...
    Sometimes it is not possible to extend Thread, becuase your threaded class might have to extend something else.
    The only difference between implementing Runnable and extending Thread is that by extending Thread, each of your threads has a unique object associated with it, whereas with Runnable, many threads share the same object instance.
    http://developerlife.com/lessons/threadsintro/default.htm#Implementing

  • Performance wise which is best extends Thread Class or implement Runnable

    Hi,
    Which one is best performance wise extends Thread Class or implement Runnable interface ?
    Which are the major difference between them and which one is best in which case.

    Which one is best performance wise extends Thread Class or implement Runnable interface ?Which kind of performance? Do you worry about thread creation time, or about execution time?
    If the latter, then don't : there is no effect on the code being executed.
    If the former (thread creation), then browse the API Javadoc about Executor and ExecutorService , and the other execution-related classes in the same package, to know about the usage of the various threading/execution models.
    If you worry about, more generally, throughput (which would be a better concern), then it is not impacted by whether you have implemented your code in a Runnable implementation class, or a Thread subclass.
    Which are the major difference between them and which one is best in which case.Runnable is almost always better design-wise :
    - it will eventually be executed in a thread, but it leaves you the flexibility to choose which thread (the current one, another thread, another from a pool,...). In particular you should read about Executor and ExecutorService as mentioned above. In particular, if you happen to actually have a performance problem, you can change the thread creation code with little impact on the code being executed in the threads.
    - it is an interface, and leaves you free to extend another class. Especially useful for the Command pattern.
    Edited by: jduprez on May 16, 2011 2:08 PM

  • Panel class not adding to main panel...

    I have a panel class that has a borderlayout which is to be nested in another panel with a borderlayout. I'm not sure what I'm doing wrong. Here is my code for the problematic classes:
    1st: Panel that needs to be added:
    public class SizePanel extends JFrame
         private JPanel sizePanel;
         private JPanel selectedSizePanel;
         private JList sizeList;
         private JScrollPane scrollPane;
         private JTextField selectedSize;
         private JLabel sizeLbl;
         private String[] sizes = {"Starter", "Standard", "Better", "Best" };
         public SizePanel()
              setLayout(new BorderLayout());
              buildSizePanel();
              buildSelectedSizePanel();
              add(sizePanel, BorderLayout.CENTER);
              add(selectedSizePanel, BorderLayout.SOUTH);
              pack();
              setVisible(false);
         private void buildSizePanel()
              sizePanel = new JPanel();
              sizeList = new JList(sizes);          
              sizeList.setSelectionMode(
                        ListSelectionModel.SINGLE_SELECTION);          
              sizeList.addListSelectionListener(
                        new ListListener());     
              sizeList.setVisibleRowCount(4);     
              scrollPane = new JScrollPane(sizeList);     
              sizePanel.add(scrollPane);
         private void buildSelectedSizePanel()
              selectedSizePanel = new JPanel();          
              sizeLbl = new JLabel("Price: ");     
              selectedSize = new JTextField(9);     
              selectedSize.setEditable(false);     
              selectedSizePanel.add(sizeLbl);
              selectedSizePanel.add(selectedSize);
         private class ListListener implements ListSelectionListener
              public void valueChanged(ListSelectionEvent e)
                   String selection = (String) sizeList.getSelectedValue();
                   selectedSize.setText(selection);
    }2nd: My code for adding it to the main panel:
    public HouseCalcGUI() {
            setTitle("McKeown's Real Estate Program");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setLayout(new BorderLayout());
            greetingPnl = new GreetingPanel();
            featuresPnl = new FeaturesPanel();
            sizePnl = new SizePanel();
            stylePnl = new StylePanel();
            buildButtonPanel();
            add(greetingPnl, BorderLayout.NORTH);
            add(stylePnl, BorderLayout.EAST);
            add(featuresPnl, BorderLayout.CENTER);
            add(sizePnl, BorderLayout.WEST);
            add(buttonPanel, BorderLayout.SOUTH);
            pack();
            setVisible(true);
        }

    Hey, guess what I just did...? BANGED MY HEAD AGAINST THE WALL. Your ingeniousness is in the form of my stupidity. Thank you though. Here are your dukes...What I did was take some sample program from my text to make my program.

  • Implements interface method at the derived class

    Hi all.
    I have a class (Derived) that extends another class (Base).
    In the base class (Base) there is a method f() with its implementation.
    In the interface (C) there is also f() method exactlly like in the base class (Base).
    The derived class (Derived) is implements the interface (C).
    My question is:
    Do i have to implement the method f() in the derived class (Derived) ?

    My guess is that you probably have to, even if it's just to call the parent's method.
    This all sounds pretty sketchy. Why don't you just make the BASE class implement your interface?

  • Not able to pass values to variables in extended Tree class

    Hi,
    I have a as class that extends from Tree, additionally this
    custom class defines
    new class level variables as follows:
    public class MyTree extends Tree {
    public var arrayColl:ArrayCollection;
    and i call this tree from mxml as follows:
    <customTree:MyTree
    arrayColl={list}
    xmlns:customTree="../../.*"/>
    Though my 'list' collections is not null, when i place an
    alert in the constructor of extended tree class
    it shows as null.
    Please advice.
    Thanks,
    Lucky

    below is the canvas:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:mx="
    http://www.adobe.com/2006/mxml">
    <mx:Script>
    <![CDATA[
    import mx.collections.IViewCursor;
    import mx.collections.ArrayCollection;
    import com.citi.ascript.TreeData;
    import mx.controls.Alert;
    import com.citi.ascript.CitiTree;
    public var availableTreeDataColl:ArrayCollection;
    public var selectedTreeDataColl:ArrayCollection;
    public var treeData:TreeData;
    public var srcTree:CitiTree;
    public var availableTreeDataArray:Array = [{a:1},
    {b:2},
    {c:3}
    public function formTreeData():void {
    var tempColl:ArrayCollection = new
    ArrayCollection(availableTreeDataArray);
    availableTreeDataColl = new ArrayCollection();
    for (var i:int=0; i<tempColl.length; i++) {
    var tempTreeData:Object = tempColl
    treeData = new TreeData();
    treeData.a = tempTreeData.a;
    treeData.b = tempTreeData.b;
    treeData.c = tempTreeData.c;
    availableTreeDataColl.addItem(treeData);
    ]]>
    </mx:Script>
    <mx:VBox>
    <mx:Label text="Drag &amp; Drop the analysis sections
    that you would like to include in the report" width="450"
    height="20"/>
    <mx:HBox id="treeContainer"
    creationComplete="formTreeData();">
    <customTree:MyTree treeList={availableTreeDataColl} //
    here collection becomes null.
    </customTree:MyTree>
    </mx:HBox>
    </mx:VBox>
    </mx:Canvas>
    The collection of TreeData is iterated in the customTree to
    form xml which will act as dataprovider for tree.
    and this canvas is added as a child for a panel in my main
    application.
    Hope this gives an idea.
    Thanks,
    Lucky

  • Problem creating an extendable panel with a header

    Hi -
    I'm trying to create a base panel class. What it needs is a header at the
    top of it with a title box(another panel) of a different color. The title of
    course is in the title box. My primitive solution was to create a parent
    panel and place the title box on the header panel, then the header on
    the parent panel. My problem is that I can't extend from that and add
    components to it with the header there.
    Does anybody have a more elegant solution?
    Thanks.

    Hello Steven,
    You can use createdby field to determine the docentry of the base document instead of quering docentry by docnum
    select createdby, transtype, baseref from jdt1
    Note: Always set the correct document type for payments: (createdby is ok in integer format)
    Example:
    Opening Balance:  JE # 8 amount 1000, created by Opening balance (not JE)
       vPay.Invoices.DocEntry = 8
       vPay.Invoices.InvoiceType = BoRcptInvTypes.it_OpeningBalance
       vPay.Invoices.SumApplied = 1000
       Call vPay.Invoices.Add
    Opening Balance:  JE # 8 amount 1000, created by Journal Entry
       vPay.Invoices.DocEntry = 8
       vPay.Invoices.InvoiceType = BoRcptInvTypes.it_JournalEntry
       vPay.Invoices.SumApplied = 1000
       Call vPay.Invoices.Add
    Sales Invoice:  DocEntry: 11  amount 1000
       vPay.Invoices.DocEntry = 11
       vPay.Invoices.InvoiceType = BoRcptInvTypes.it_Invoice
       vPay.Invoices.SumApplied = 1000
       Call vPay.Invoices.Add
    Regards,
    J.

  • Implemenet/Extend interface/class in default package

    Filename: DeaultInterface.java
    public interface DefaultInterface {
        // Abstract Methods...
    Filename: ConcreteClass.java
    package com.company;
    import DefaultInterface;
    public class ConcreteClass implements DefaultInterface {
        // Implementation of Abstract Methods...
    }When I compile above java code it gives error "cannot find symbol. symbol: class DefaultInterface".
    Can anyone explain why can't we implement the interface/extend the class in default package(no package)?
    Edited by: 974531 on Dec 2, 2012 11:07 PM

    >
    When I compile above java code it gives error "cannot find symbol. symbol: class DefaultInterface".
    Can anyone explain why can't we implement the interface/extend the class in default package(no package)?
    >
    You CAN implement the interface defined in the default package.
    What you CANNOT do is import it. And that is because the Java Language Specification specifies that named types can only be referenced by their simple name if they are imported and must otherwise be referenced by their fully qualified name.
    See the 7.5 Import Declarations in the Java Language Specification - http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html
    >
    An import declaration allows a named type or a static member to be referred to by a simple name (§6.2) that consists of a single identifier.
    Without the use of an appropriate import declaration, the only way to refer to a type declared in another package, or a static member of another type, is to use a fully qualified name (§6.7).
    A type in an unnamed package (§7.4.2) has no canonical name, so the requirement for a canonical name in every kind of import declaration implies that (a) types in an unnamed package cannot be imported, and (b) static members of types in an unnamed package cannot be imported. As such, §7.5.1, §7.5.2, §7.5.3, and §7.5.4 all require a compile-time error on any attempt to import a type (or static member thereof) in an unnamed package.
    >
    So you can't reference that type by importing it because you can't import a type that doesn't have a canonical nmae. And you can't just use the simple name because, as the first statement above says you have to import it to use the simple name.
    When you use the simple name of that type without an import the simple name would refer to a class IN your 'com.company' named package.

  • Extending WebCatItemList class

    Hi
    I have a functionality to implement in CRM ISA 4.0 in which I need to filter out WebCatItem object stored in form of arraylist in class WebCatItemList.
    I tried extending the class WebCatItemList but it didn't help.
    All I want is, based on a few attributes of some items (WebCatItem) in WebCatItemList, I want to filter some items that suits my requirement. For example if the description of an item contains "ABC", I want to keep it otherwise discard from the WebCatItemList object. If anybody has done something of the sort, please let me know. I'll be really grateful.
    Cheers
    Pankaj Bansal

    Hi,-
    i have a question regarding extending a class.
    what is wrong with the following statement?
    sub_class a = (sub_class) class.method();
    sub_class is an extension of class.
    thanks,
    barisI'm afraid without any actual code, all I can say is that you tried to cast the reference that method returned to something that it is not a subclass of. This is per the docs for ClassCastException which say, in part:
    (your) code has attempted to cast an object to a subclass of which it is not an instance.

  • JSP extending application class?

    Greetings,
              I'm in the midst of porting some servlets from an implementation that
              didn't use jsp at all to a MVC type model.
              For some quick and dirty output, I wanted to define a couple jsp files
              that extended a app BaseServlet class (frame and menu functions included
              on this servlet) so that
              I could do stuff like this
              </body>
              <% setSideMenu(<array of Menu structures from session>); %>
              ... other html
              where setSideMenu was one of the functions this jsp inherited from my
              BaseServlet class.
              Unfortunately, the JSP compiled, but whenever I try to use it, the
              client browser sits waiting for output that never comes.
              Now, before I go off and debug this with lots of printlns, is there
              some easy explaination for why WLS would do this (did I break the JSP
              implementation by extending a class that was not weblogic.xxx?)
              If I remove the "page extends..." directive, the jsp returns after
              compilation ok.
              Thanks In Advance,
              Brian Homrich
              Chicago Illinois
              

      There is no  such thing as a javafx  class.  It is a regular  java class.  The Aapplication class is  the entry
    point  for JavaFX application.  You have to extend the Application class to create Javafx  application .

  • Extending abstract classes such as ByteBuffer?

    How would I extend an abstract class such as ByteBuffer?
    If I call the normal extends key word:
    public class MyBuffer extends ByteBuffer
    then I need to implement virtually every method in the class.
    But If I just create a ByteBuffer such as:
    ByteBuffer buf = BtyeBuffer.Allocate(100);
    then I can just go and use all of the various methods witin the class without have to implement anything.
    But I need to add an additional method to ByteBuffer . What is the best way to do this? I realize I can encapsulate a ByteBuffer object but that does not sound like a good idea.
    Is there a better way? If so what?

    Thanks. Well that gets me started.
    I have:
    public abstract class SerialPortBuffer extends ByteBuffer {
    and I am getting:
    Implicit super constructor ByteBuffer() is undefined for default constructor. Must define an explicit constructor     
    How do I fix this? Sorry for the newbie questions.

  • Extend standard class CL_CRM_BSP_AM_CM_1O

    Hi all
    I need to extend the standard class CL_CRM_BSP_AM_CM_1O. The class is
    defined "Final" so it's impossible to extend.
    I'm thinking on changing the class type. Is this a good solution? Which are the consequences if I change the class type?                             
    If this is not the right way, how could I extend standard class CL_CRM_BSP_AM_CM_1O?
    Thanks in advance
    Joaquin

    Hello Joaquin
      I would have used one of the following two approaches:
    1. Opened an OSS message and asked SAP to remove the final flag. They have done that in the past when I requested them to.
    2. Do a modification to standard remove the final flag and go ahead by using the standard class as a super class.
    Infact I would do step 1 first and then step 2. Because even if SAP releases a note you have to implement the note manually which is as good as doing a modification to standard.
    Thanks and regards,
    Murli Rao

  • Why does ArrayList "implement" List, when it extends AbstractList?

    I never noticed this before, and so i was wondering if there's a good explanation for it: If you look at how ArrayList is defined, you'll see this:
    ===
    public class ArrayList
    extends AbstractList
    implements List, RandomAccess, Cloneable, Serializable
    ===
    But AbstractList, which ArrayList extends, already implements List, like this:
    ===
    public abstract class AbstractList
    extends AbstractCollection
    implements List
    ===
    So, why does ArrayList list List in the list of implements? (that's kind of a confusing sentence, read it twice) By extending AbstractList, it's already clear that it implements List - now it's like it's implementing it twice (which doesn't hurt of course, but it doesn't help either.) This seems inconsistent with other parts of the API, where usually in cases like this (with an abstract class being extended) the interface isn't listed again in the final concrete class. For instance:
    public class TitledBorder
    extends AbstractBorder
    and:
    public abstract class AbstractBorder
    extends Object
    implements Border, Serializable
    but:
    TiledBorder doesn't mention Border in its (non-existent) list of implements.
    Any ideas?
    -- Niek

    Surely enough the AbstractList
    takes care of all the burden (like I wrote before),
    but the ArrayList (re)implements the List interface
    for
    very sound reasons. If it didn't, the
    o.getClass().getInterfaces() would've missed the List
    interface,Since AbstractList implements List, ArrayList has an implicit "implements List." However, as you say, getInterfaces() doesn't produce that.
    So you're saying that the VM has to do something different to find the method? I don't think so. The compiler may have to work harder, but in both cases, the VM does an invokeinterface. The javap output looks the same in a copule of test classes I created.
    public interface I1 {
        public void i1Meth();
        public void i1Meth2();
    public abstract class IA implements I1 {
        public void i1Meth() {}
    public class IC1 extends IA implements I1 {
        public void i1Meth2() {}
        void dummy() {
            I1 i1 = new IC1();
            i1.i1Meth();
            i1.i1Meth2();
    import java.util.*;
    public class IC2 extends IA {
        public void i1Meth2() {}
        void dummy() {
            I1 i1= new IC2();
            i1.i1Meth();
            i1.i1Meth2();
        public static void main(String[] args) {
            System.out.println(Arrays.asList(IC2.class.getInterfaces()));
            System.out.println(Arrays.asList(IC1.class.getInterfaces()));
    Compiled from "IC1.java"
    public class IC1 extends IA implements I1{
    void dummy();
      Code:
       0:   new     #2; //class IC1
       3:   dup
       4:   invokespecial   #3; //Method "<init>":()V
       7:   astore_1
       8:   aload_1
       9:   invokeinterface #4,  1; //InterfaceMethod I1.i1Meth:()V
       14:  aload_1
       15:  invokeinterface #5,  1; //InterfaceMethod I1.i1Meth2:()V
       20:  return
    Compiled from "IC2.java"
    public class IC2 extends IA{
    void dummy();
      Code:
       0:   new     #7; //class IC2
       3:   dup
       4:   invokespecial   #8; //Method "<init>":()V
       7:   astore_1
       8:   aload_1
       9:   invokeinterface #9,  1; //InterfaceMethod I1.i1Meth:()V
       14:  aload_1
       15:  invokeinterface #10,  1; //InterfaceMethod I1.i1Meth2:()V
       20:  return
    ...

  • Extending a class through inner anonymous class??

    What kind of construction is this?
    SomeClass sc = new SomeClass()
                      public void sayHello()
                        System.out.println("Hello");
              };I thought this is equal to sc extends SomeClass, and this is what the decompiled inner class tells. Anyhow I don't think this is the same as extending a class cause you can only overwrite methods which are declared/implemented in SomeClass, adding new methods doesn't make sense to compiler. If in the example above SomeClass doesn't contain sayHello method
    sc.sayHello();
    will result in compiler error message.

    The compiler error is because you are calling the method via a reference of type SomeClass, not a reference of the type of the anonyomous class you have created. If you need to do that, then use a named class.
    You can have any number of methods in an anonymous class, but you will only be able to call them from within the class itself unless they are declared in the superclass or super-interface.

  • Can interface extend abstract class?

    Can interface extend abstract class?
    I tried to make a interface extend an abstract class but i got an error stating:
    interface expected here.
    Can anyone help me ?

    > ok, but can an interface implement an abstract class?
    No. An interface provides no implementation whatsoever. An abstract class can implement an interface, but not the other way around.
    http://java.sun.com/docs/books/tutorial/java/concepts/interface.html
    ~

Maybe you are looking for

  • My ipod 6th gen wont sync new songs ive uploaded and when i try to update it i get error message 1436

    my ipod 6th gen wont sync new uploaded music and when try to update version 1.2 it comes up with error message 1436

  • Missing package

    Hello, I preordered the PS4 game Bloodborne and it was supposedly delivered today 3/24/15 on my front door but I do not see it anywhere. I had just arrived home 5 minutes after the proposed delivery time but did not see any UPS truck int he vicinity.

  • Flat file to Oracle using --- LKM File to Oracle (SQLLDR)

    Hello All, I am planning to replicate simple sqlldr process below in ODI. Two things I cannot do, 1) I cannot modify exisiting tables for creating new sequences 2) We need SEQ column to start with 1 always(tried sequence in odi, didn't work as expect

  • SAPSCRIPT - number of copies prining only one

    Dear all, Developed a script. OPEN_FORM WRITE_FORM CLOSE_FORM I am not passing ITCPO structure in OPEN_FORM. On execution In print parameter screen i am giving number of copies as 5. but its printing only one. what might be the issue. Regards, Kannan

  • Mail displays text as .htm attachments

    Machine is set to Rich text. This only occurs in files sent from our PCs (specifically a signature with a jpeg logo in it). The jpeg shows up fine with a text.htm attachment next to it. On my 10.5.5 machine, the signatures from PCs come across fine.