Ordering Graphics2D objects

Is there anyway to handle the z axis' ordering of Graphics2D objects? I'm developing a graphic tool wich provides support for specifying component based applications for a digital tv framework and i'm representing these components both with JLabels and Graphics2D. I can easily set the z order for the JLabel with the setComponentZOrder method but when i'm dealing with Graphics2D rectangles i don't know how to get it working... any hints?
10x in advance...

What i'm actually trying to do is to suport user interaction so he could drag away graphics2d rectangles. So the only way would be draw the component being dragged later? I'll try this ... i didn't think about it LOL ... sorry to bother

Similar Messages

  • Order of Object Creation

    I need to know what order various objects are created and processed. An example will be most helpful.
    class A {
    A() { myFunc();    }
    public void myFunc() {}
    class B extends A {
    class innerB {       public void funcInnerB() { ... do some work ...       } }
    public void myFunc() {       someVar.funcInnerB();   }
    innerB someVar = new innerB();
    When class B is instantiated the following happens [assuming I coded my example properly :) ]
    1. The default B constructor is called.
    2. It calls the A constructor.
    3. The method myFunc in class B is called from A constructor.
    4. a NULL Pointer error occurs because someVar has appearantly not yet been assigned to the new innerB object.
    This is my problem, why is someVar not being created immediately? I don't know if this problem is universal, but in my particular application, it is happening this way. (I can't post the actual code, because it is way, way too long.)
    I tried using an initialization block in class B to assign someVar, but the same problem occurs.
    Here's my current workaround:
    in class B:
    public void myFunc() {  if (someVar == null) { someVar = new innerB() }
    someVar.funcInnerB(); }
    But I am hoping there is a better solution and I am worried about when I may run into this situation. So, I am hoping there is a definitive guide to the order everything is created.
    Thanks in advance.

    It's not a good idea to call non-final methods from a non-final class because of exactly what you found. The NullPointerException happens because of the order of processing that you described - by the time you get to B.myFunc(), the B members have not been initialized. First, the superclass is fully initialized. All members are set to their initial values, then the constructor is executed. After the superclass constructor finishes, then the subclass members are initialized, and any further subclass constructor processing occurs.

  • Sales order cost objective vs OKB9  Internal order cost object.

    Hi All,
    we facing an  issue with sales order cost objective vs OKB9 cost object.
    For IC PO service material, we assigned account assignment category 4.Reasonis Service material was not showing on G\R account.
    The G\L account 7898788, we assigned to Service Item (material type DIEN)  , for G\Cost 7898788 cost element is assigned in OKB9. Combination business + order 3478787.
    Now conflict with sales order cost objective vs OKB9  internal order cost object.
    While posting intercompany IR posting system thronging below error messageu2026
    Enter only one true account assignment
    Message no. KI249
    Diagnosis
    You made assignments to several objects in CO (cost center, order, project etc.). 2 of these have been created as true objects.
    System Response
    You are allowed only one account assignment for each cost-relevant account
    How to resolve this issue.. Do I make any config changes in the system to overcome this issue?
    Or any sub account to assin in VKOA config for internal orderu2026
    Regards,
    Adi

    Hi Waman,
    Thanks for your inputs.
    Issue :  IR failed to post for wax  Sales Order -> ICPO  - Error:  Enter only one true account assignmentu2019.
    Background:
    Original setup  in  Test system   & Productionu2013 account determination for servive (DIEN) account assignment category u20184u2019 was linked to G/L Account  34444444, As part of project orange u2019, account determination was linked to account u201889710100u2019.
    Account u20188970100u2019   34444444 was replaced with 8970100 ,is not linked to any cost center & always post with reference to IC Sales Order as per config in OKB9 based on company code (US99) + cost element (89701100) + business area (9yyy). This caused a conflict while posting IR, system could not determine exact order for posting financial value.
    Conflict:  Actual Sales Order 34789343 is  linked to PO via account assignment category & IC dummy sales order (8014331) is determine via config setting. Two cost objects cannot be linked to one IR G/L account booking.
    Regards,
    Adi

  • Ascending Order of Objects at universe Level

    Hi Techies.
    I am working on BO 3.1 Designer SP5.
    I have one Period (Month Year) object at universe level and I have arranged the order of object as Descending by editing the properties of the object.
    and when I use this object in the Query Filter section and making it as a Mandatory prompt, the values are loading in a different way rather than descending order.
    Please help me on this......
    thanks in Advance...

    Hi
    If you want to sort the LOV’s, use the  LOV’s based on custom SQL option.
    Please find the below sample code.
    Sample Code
    SELECT DISTINCT FIELD
    FROM
    TABLE
    ORDER BY 1
    And find the below link for more info.
    http://scn.sap.com/community/semantic-layer/blog/2014/06/11/how-to-sort-the-list-of-values-in-the-prompts-screen

  • Purchase Order Text Object missing in Transcation VOTXN

    Hi Experts
    I want Purchase Order Text Object in Transction VOTXN, for that Referring SAP Note 75144 - EKKO EKPO entries should be in table TFRM, if these two entries are missing, using the solution contained in Note 524453 to generate the missing entries in the table TFRM, run program RV80INCTFRM. I run that program too but still am not able to see purchase order text in Tcode VOTXN.
    Please help me on this....

    The note  Note 524453 - Purchasing text determination is not transported mentions that you need to run program RV80HGEN after RV80INCTFRM. Did you run this program? What is your SAP version? Did you also check other notes provided in 524453?
    Regards,

  • PM: how to track the operations in prev.maint order against object list

    Dear PM Guru's.
    i have one issue in my preventive maintenance scenario. i clubed the same type of machines in one maintenance order under object list tab. and i mention the list operations in maintenance order. suppose in one preventive maintenance order 10 operations are maintained and 5objects are mentioned in that order. Now i like to mention all these 10 operations activities against to 5 objects. how i can assign sequentially? i required like 10operations one by one row wise and 5objects side by side column wise. i would like to update the each operation activity against each machine column? how i have to do this one?
    Please suggest me and help me.
    regards
    Jalendhar Merugu

    Using Object functionality, we can maintain many equipments in the order.
    But the constraint is that one operation can be assigned to only one equipment. In your case, you have 5 objects. If all 10 operations will be performed on 5 objects, then you have to maintain 50 operations & you should assign the objects.
    In other words, if one operation will be performed on 5 objects, then you should define that one operation 5 times & you have to assign to technical objects. You can't share one operation to many equipments.

  • Loading transaction data from flat file to SNP order series objects

    Hi,
    I am an BW developer and i need to provide data to my SNP team.
    Can you please let me know more about <b>loading transaction data (sales order, purchase order, etc.,) from external systems into order based SNP objects/structure</b>. there is a 3rd party tool called webconnect that gets data from external systems and can give data in flat file or in database tables what ever required format we want.
    I know we can use BAPI's, but dont know how. can you please send any <b>sample ABAP program code that calls BAPI to read flat file and write to SNP order series objects</b>.
    Please let me know ASAP, how to get data from flat file into SNP order based objects, with options and I will be very grateful.
    thanks in advance
    Rahul

    Hi,
    Please go through the following links:
    https://forums.sdn.sap.com/click.jspa?searchID=6094493&messageID=4180456
    https://forums.sdn.sap.com/click.jspa?searchID=6094493&messageID=4040057
    https://forums.sdn.sap.com/click.jspa?searchID=6094493&messageID=3832922
    https://forums.sdn.sap.com/click.jspa?searchID=6094493&messageID=4067999
    Hope this helps...
    Regards,
    Habeeb
    Assign points if helpful..:)

  • On Work Order using Object lists for equip u can manually create Notifi

    On a maintenance Work Order using Object lists for equipment you can manually create a notification for each line item.
    We want to automate this process to do this when we save the document.
    Any ideau2019s on how to do this?
    Does a user exit exist for this?

    Hi:
    Check with Tcode: IBIP - Plant maintenace batch input utility tool.
    Hope, it may help!
    Thanks,
    Murali.

  • Merging Two Graphics2D objects into one

    Is it possible to accomplish this:
    1) have a method in class A that returns a Graphics2D object
    2) have a method in class B that returns a Graphics2D object
    3) have class C call both class A's and class B's methods that return Graphics2D objects
    4) lay those two Graphics2D objects into a new Graphics2D object within a component's paint(Graphic g) method
    What I am trying to do is a lot like a Viso diagram, that is drag a graphic onto another graphic x numberof times and perform some kind of layering technique.
    Thanks

    Why don't you pass a graphics 2D into each method, and get method to draw onto that. Then it becomes very simple to combine each.
    MArk

  • How to make a Graphics2D object from a Graphics object?

    Hallo !
    Graphics g = pj.getGraphics();
    Graphics2D g2 = (Graphics2D) g;I get an Exception as follows:
    java.lang.ClassCastException: sun.awt.windows.WPrintGraphicsWrapper
    Is there an other possibility to to make a Graphics2D Object ? Or can I repair the error on an other way?
    Thank you Wolfgang

    Yes JBuilder makes a reference to this line.
    pj is a PrintJob.
    The only lines in this method for test are
    PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(p,"PrintWindow",null);
    Graphics g = pj.getGraphics();
    Graphics2D g2 = (Graphics2D) g;
    pj.end();Exception occurred during event dispatching:
    java.lang.ClassCastException: sun.awt.windows.WPrintGraphicsWrapper
    Wolfgang

  • Changing a Graphics2D object into a BufferedImage

    Well subject says it all really. At some point in my code I extract a Graphics2D object from another object, and I'd like to store it as a BufferedImage. The code below does almost what i want, but not quite.
    BufferedImage img;
    GraphicsConfiguration gc = this.getGraphicsConfiguration();
    this.img = gc.createCompatibleImage(getWidth(), getHeight(), BufferedImage.OPAQUE);
    Graphics2D g2d = img.createGraphics();
    This is the only hint I've been finding around the forums, and it works well if you just want to draw new drawings on a BufferedImage. However, I have a Graphics2D object that already contains alot of graphics, and I want to copy this into a BufferedImage. I can't seem to find a way to do this no matter where i look.
    Any help would be appreciated.

    reading through alot of code will be alot more work than a simple explanation of the problemA good SSCCE is many times easier to understand than a description.
    That said, if I understand what you are trying, I assume you have a paintComponent override in nr1 that has a drawImage statement, and you want to obtain a part of that image in nr2 which is in a different class, to a BufferedImage in the same class as nr2.
    If that's it, you can construct a BufferedImage of appropriate size and call the paintComponent method of nr1 with the Graphics reference of the BufferedImage, translated or otherwise transformed if necessary, to paint the panel's painting on the BufferedImage. Something like (in the class containing nr2)
    BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = bi.createGraphics());
    g.translate(x, y); // optional
    g.setClip(x1, y1, w1, h1); // optional
    nr1.paintComponent(g);Note that you need a reference to panel nr1 in the class containing nr2.
    Now (even if this is not what you needed) which was easier to understand -- the description above or the code? So if that's not it, don't expect anything more without a SSCCE which only demonstrates the problem faced -- not 500 lines of code that have nothing to do with the problem.
    luck, db

  • Scaling a Graphics2D object

    hi there! i have this drawing in a Graphics2D object and if I render it it takes around 2 seconds to load. if i scale it before I render it takes like 4 seconds to show up? is there anyway to speed this up?
    heres some of my code:
      public void paint(Graphics g){
            Graphics2D g2d = (Graphics2D) g; 
            g2d.scale(0.5, 0.5); //// heres the line that slows down the system!
            for (int y = 0; y < 256; y++) {
                for (int x = 0; x < 256; x++) {
                    g2d.setPaint(new Color((int) Mod.mod(tree[0].evaluate(v), 255), (int) Mod.mod(tree[1].evaluate(v), 255), (int) Mod.mod(tree[2].evaluate(v), 255)));
                    g2d.drawRect(x, y, 0, 0);
        }Mind the drawing method, Im actually evulating an expression tree for each pixel on the canvas (256x256) so it produces a random pattern.

    Something I forgot earlier: if you apply transforms to your Graphics context, you need to undo those when your done. I.e. the paint method should actually look like this:public void paint(Graphics g){
      Graphics2D g2d = (Graphics2D) g;
      AffineTransform oldTransform = g2d.getTransform();
      // apply whatever transforms you need
      // calculate the position of the image's upper left corner
      int x = ...;
      int y = ...;
      g2d.drawImage(image, x, y, null);
      g2d.setTransform(oldTransform);
    }If you modify the Graphics context in other ways (e.g. setting a Color, Stroke, etc), too, it might be easier to work on a copy though:public void paint(Graphics g){
      Graphics2D g2d = (Graphics2D) ((Graphics2D) g).create();
      // apply whatever transforms you need
      // calculate the position of the image's upper left corner
      int x = ...;
      int y = ...;
      g2d.drawImage(image, x, y, null);
      g2d.dispose();
    }

  • Defining the order of objects when using Distribute?

    VERSION: Illustrator CC Mac
    So, I've always assumed that the order of the layers determined the order and position that shapes are moved in the Distribute function.
    I'm having a wierd problem today and the order seems to be defined by something I can't figure out. I'm trying to vertically distribute a set of the same shape and instead of counting the shapes in order from left to right or vise versa the distribute function seems to be randomly picking the order of the shape, not basing it on location or layer order.
    Here are a couple of examples:
    In both examples I have used a Vertical Distribute Center and both groups of shapes are ordered from left to right in the layers palette with the left most layer being the first layer and the right most shape being the last.
    What is causing the shapes to be distributed in this order? How do I specify what the order is if it isn't based on layer or position order?

    So, I've always assumed that the order of the layers determined the order and position that shapes are moved....
    Wrong assumption. Only true sometimes.
    ...instead of counting the shapes in order from left to right...
    Wrong assumption again.
    So first, let's deal with the above assumptions:
    When distributing objects, you are not usually talking about stacking order at all. You are talking about modifying initial reading order based on the initial relative X or Y positions.
    Although you want stacking order to be a factor in some cases, you wouldn't want it in every case. Nor would you want it to be the default criteria. To understand this, consider the matter of reading order in text objects:
    You open a PDF. As is often the case, it has a plethora of individual text objects. Those objects have a particular reading order which is really nothing but a perception of the viewer based on their relative positions. There is no guarantee whatsoever that the object stacking order corresponds to the reading order (creation order). For all the viewer knows, the body text may in fact have been created before the decorative headlines. The subheads, bullets, and callouts may also have been created in any unknown order.
    In fact, I have just such a real-world frequently-reccuring situation: DXFs exported from engineering drawings frequently contain columns/rows of text in which the reading order does not correspond to the object stacking order. If the DXF is opened in Illustrator and then those text objects are threaded, or if their text is copied and pasted to concatenate them into a single text object, their reading order becomes scrambled, because threading and concatenating text is indeed dependent upon object stacking order (as are Blends, Mesh patches, and Pattern Brush tiles). By the same token, if those "lines" of text are distributed for uniform spacing and if the result were determined by the object stacking order, the text reading order would be similarly ruined.
    So for this and similar situations I wrote a set of Javascripts which I use to rearrnage the stacking order of objects according to their relative positions on the page (i.e.; their reading order) first, before concatenating the text. But you wouldn't want to have to do this in every situation in which you want to distribute every and all kind(s) of objects.
    The concept of "reading order" is not limited to text. Consider a fan of playing cards in a poker player's hand. Or chess pieces on a board. Or a row of houses on a map. Fence slats. Deck boards. Bricks or stones. Holiday icons on a calendar grid. You might want to make the XY spacing of such objects uniform, but that doesn't mean you want the stacking order changed, and inversely it doesn't mean you want the XY positions to be determined by stacking order.
    So unless and until there is an "Ordered By:" control with which the user specifies "Stacking Order" or "Reading Order" (which there isn't), the feature just uses initial position values (reading order) as the first sorting criteria, and this is the most "normal" behavior.
    ...drawing a set of overlapping squares in decreasing size order, smallest on top. Drag the top square out of alignment.
    I start with a group of shapes, all repeatedly copied from the first one on the far left...Then I move up the last one up...
    On the left is before with two circles on top of each other...
    In all the above instances, note that the situation starts with multiple objects already aligned in the direction of desired distribution, and moving only one of them before performing the distribution. So think of the math:
    You have a set of horizontal position values: [0,0,0,3]. You want to "equally space" those values. How do you do that if, as explained above, stacking order is not a determinant? How do you "order" three zeros based on their numeric values? The instructions are ambiguous. In such situations, you have to use some other secondary criteria, even if it is arbitrary; even if it is random. Example:
    Understand, I'm just replying to your initial post here. I'm not saying there is no bug in the Distribute interface. There may be, and if so, the bug(s) may be version-specific. I'm not addressing what Steve is trying to explain in Post 18: But note that when you do what he describes, the Distrubute Spacing value field automatically changes to zero, even if it is initially set to Auto and you are only clicking the Horizontal Distribute Space button.  (At least in CS3; I don't have later versions in front of me right now because I'm not in the studio and I don't have CC at all because I'm not going to rent Adobe's software),
    JET

  • How can I stack Graphics2D objects

    How can I stack two or more Graphics2D objects on the same BufferedImage.

    I am trying to create layers. Here is an example I have started with. The problem is the remarked code. The effect is correct but it is applied to the complete image. I would like to separate the effect to only the shadow text. I would appreciate any help. I am new to Java so still fumbling around with concepts.
    import java.awt.*;
    import java.awt.font.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    import java.awt.geom.*;
    import java.util.*;
    public class ShadowText {
    static Rectangle2D.Double Rectangle;
    static BufferedImage image;
    static Graphics graphics;
    static Graphics2D g2d;
    static TextLayout textLayout;
    public ShadowText() {
    public static void main(String[] args) {
    BufferedImage image = new BufferedImage(500,120,BufferedImage.TYPE_INT_RGB);
    Rectangle2D Rectangle = new Rectangle2D.Double(0,0,500,120);
    graphics = image.getGraphics();
    g2d = (Graphics2D) graphics;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setPaint(Color.white);
    g2d.fill(Rectangle);
    g2d.draw(Rectangle);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    //g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .5f));
    textLayout = new TextLayout("Shadow Text", new Font("Serif", Font.BOLD, 70), g2d.getFontRenderContext());
    g2d.setPaint(Color.black);
    textLayout.draw(g2d, 12, 102);
    //float ninth = 1.0f / 9.0f;
    //float[] kernel = {ninth, ninth, ninth, ninth, ninth, ninth, ninth, ninth, ninth};
    //biop = new ConvolveOp(new Kernel(3, 3, kernel));
    //op = (BufferedImageOp) biop;
    //image = op.filter(image,null);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    textLayout = new TextLayout("Shadow Text", new Font("Serif", Font.BOLD, 70), g2d.getFontRenderContext());
    g2d.setPaint(Color.black);
    textLayout.draw(g2d, 10, 100);
    Write("C:/JavaTraining/Filters/images/ShadowText.jpg",image);
    public static void Write(String file, BufferedImage image){
    //Check for file exsist
    StringTokenizer tokens = new StringTokenizer(file,".");
    if(tokens.countTokens()>0){
    String filename = tokens.nextToken().trim();
    String type = tokens.nextToken().trim();
    try{
    if(type.equalsIgnoreCase("gif")) type = "png";
    ImageIO.write(image, type, new File(file));
    }catch (IOException e){
    System.out.println("Invalid file name or path! "+file);
    }else{
    System.out.println("Invalid file name! "+file);
    }

  • Please check the order's object list (inconsistency SOBJ)

    Hi Friends;
    I am facing a strange issue where I have copied a custom task from SAP standard decision task 00008267 caz I needed to perform some custom requirement on it.
    I have done evry thing but then I have observed that Agent assignment is not coming at testing client which is on same server.
    I also can not modify any thing at testing client.
    So I performed SCC1 from testing client and check but still same issue.
    Then I thought of re assigning agent at development client but while making it general task it pop up the message "Please check the order's object list (inconsistency SOBJ)".
    And after again performing the SCC1 still the issue exist.
    Can any one suggest their inputs where the problem could be and how should I fix it.
    Regards
    Devraj

    Hi Dev,
    Can you please share more details? Agent assignment not coming means?
    Have you set the task as General in testing client?
    Thanks,
    Viji.

Maybe you are looking for

  • I was working with my iPad with 1% battery and it turned off....

    I was working with my iPad with 1% battery and it turned off . I connected it to USB cable but my iPad wants to turns  on with 1% battery but after a minute it turns off again.it happend for more than10 times.Please help me .My iPad is the 3rd Genera

  • Insert Editing, Why Won't Clips Appear In The Timeline?

    Every time I attempt an insert edit, either via the "downward arrow" symbol or via "W" on the keyboard the clip appears in a secondary time/storyline below the Timeline, with a blank space in the main Timeline of exactly the same duration as the clip

  • Stream TO iPod touch?

    Am wondering if you can stream TO and iPod touch (3rd gen)using iTunes? Would like to use the iPod as a substitute for my Airport Express. Thanks!

  • HT4914 90 day lockout on match - two users, one desktop, now what?

    My husband and I both subscribed to match separately - orginally he was using a PC laptop, while I was using the Mac desktop...then he tried to phase out the laptop, and now I'm locked out of match because of his log on. How do we solve this?

  • Itunes - freezing/not responding: why?

    Anyoone else think that there is an increase in the frequency of Itunes freezing?  It sure is happening with my Itunes over the last weeks.  And twice in under five minutes, a moment ago. Anyone have a solution to the issue?  Certainly, yesterday's u