Drawing Zoom Box

I am implementing zoom in/zoom out for a JPanel using the scale and translate methods. For zoom in, I allow the user to click and drag a box for the area they want to zoom. But since I am using scale, the thickness of the zoom rectangle changes as I zoom in, because for the zoom rectangle I am drawing a rectangle onto the JPanel after I have already zoomed therefore, I have scaled already and therefore a line that was one pixel wide is now wider. Is there anyway to fix this so that my zoom rectangle always has the same thickness?

You have to set old transform after painting.
AffineTransform af=new AffineTransform();
af.scale(scale,scale);
oldTransform=g2d.getTransform();
g2d.transform(af);
paint actions
g2d.setTransform(oldTransform);
best regards
Stas

Similar Messages

  • Drawing a box in smartforms

    Hi,
    Is it possible to draw a box in smartforms in a non specific place on the page?
    Thanks
    Lindy

    Hi Andreas,
    The form I am trying to design is an instruction form for a driver.
    Basically it lists the drivers instructions for the day, then has boxes where the driver can fill in vehicle registration, start kilometers and end kilometers.
    There is also then a place where the customer can tick a box if he was happy with the service, or enter comments into a box if he was not happy with the service.
    The problem is that the driver instructions can be any length, so I cannot place these boxes at a specific place on the page. This is what I originally did, but the client does not want to see a big empty space if the instructions are really short.
    Thanks for your help. I would be interested to here of a solutions, but if it is quite complicated, don't worry about it as I am sure it can be done with a sapcript instead.
    Regards
    Lindy

  • How to draw a box before Line Item in the Main Window  In SapScript

    Hi guys,
    I am trying to draw a box before Line items to be printed but it overwriting the Line Item can anyone help me in this.
    Thanks,
    Ramesh

    Hi ramesh,
    check this:
    /E   TOP
       plant,,status,,GROUP,,Profit,,Min.Size,,Max.Size
    /:   BOX FRAME 10 TW
    /:   BOX YPOS 2 CH HEIGHT 0 CM FRAME 10 TW
    /*   BOX XPOS 15 CH WIDTH 0 CM FRAME 10 TW
    /*   BOX XPOS 28 CH WIDTH 0 CM FRAME 10 TW
    /*   BOX XPOS 35 CH WIDTH 0 CM FRAME 10 TW
    /*   BOX XPOS 42 CH WIDTH 0 CM FRAME 10 TW
    /*   BOX XPOS 55 CH WIDTH 0 CM FRAME 10 TW
    /E   NEW
       &IT_SCRIPT-pstat(C)&,,&IT_SCRIPT-werks(C)&,,
    =    &IT_SCRIPT-EKGRP(C)&,,&IT_SCRIPT-PRCTR(C)&,,
    =    &IT_SCRIPT-MINLS(C)&,,&IT_SCRIPT-MAXLS(C)&
    /:   BOX FRAME 10 TW
    /:   BOX YPOS 2 CH HEIGHT 0 CM FRAME 10 TW
    /:   BOX XPOS 15 CH WIDTH 0 CM FRAME 10 TW
    /:   BOX XPOS 28 CH WIDTH 0 CM FRAME 10 TW
    /:   BOX XPOS 35 CH WIDTH 0 CM FRAME 10 TW
    /:   BOX XPOS 42 CH WIDTH 0 CM FRAME 10 TW
    /:   BOX XPOS 55 CH WIDTH 0 CM FRAME 10 TW
    the corresponding code in abap editor:
    CALL FUNCTION 'OPEN_FORM'
      EXPORTING
       APPLICATION                       = 'TX'
       ARCHIVE_INDEX                     =
       ARCHIVE_PARAMS                    =
       DEVICE                            = 'PRINTER'
       DIALOG                            = 'X'
        FORM                              = 'ZFINAL_13688'
        LANGUAGE                          = SY-LANGU
      EXCEPTIONS
        CANCELED                          = 1
        DEVICE                            = 2
        FORM                              = 3
        OPTIONS                           = 4
        UNCLOSED                          = 5
        MAIL_OPTIONS                      = 6
        ARCHIVE_ERROR                     = 7
        INVALID_FAX_NUMBER                = 8
        MORE_PARAMS_NEEDED_IN_BATCH       = 9
        SPOOL_ERROR                       = 10
        CODEPAGE                          = 11
        OTHERS                            = 12
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL FUNCTION 'WRITE_FORM'
                        EXPORTING
                          ELEMENT                        = 'TOP'
                        FUNCTION                       = 'SET'
                          TYPE                           = 'TOP'
                          WINDOW                         = 'MAIN'
                        EXCEPTIONS
                          ELEMENT                        = 1
                          FUNCTION                       = 2
                          TYPE                           = 3
                          UNOPENED                       = 4
                          UNSTARTED                      = 5
                          WINDOW                         = 6
                          BAD_PAGEFORMAT_FOR_PRINT       = 7
                          SPOOL_ERROR                    = 8
                          CODEPAGE                       = 9
                          OTHERS                         = 10
                       IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                       ENDIF.
    LOOP AT IT_SCRIPT.
      CALL FUNCTION 'WRITE_FORM'
       EXPORTING
         ELEMENT                        = 'NEW'
        FUNCTION                       = 'SET'
         TYPE                           = 'BODY'
         WINDOW                         = 'MAIN'
       EXCEPTIONS
         ELEMENT                        = 1
         FUNCTION                       = 2
         TYPE                           = 3
         UNOPENED                       = 4
         UNSTARTED                      = 5
         WINDOW                         = 6
         BAD_PAGEFORMAT_FOR_PRINT       = 7
         SPOOL_ERROR                    = 8
         CODEPAGE                       = 9
         OTHERS                         = 10
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ENDLOOP.
    CALL FUNCTION 'CLOSE_FORM'
    IMPORTING
      RESULT                         =
      RDI_RESULT                     =
    TABLES
      OTFDATA                        =
    EXCEPTIONS
       UNOPENED                       = 1
       BAD_PAGEFORMAT_FOR_PRINT       = 2
       SEND_ERROR                     = 3
       SPOOL_ERROR                    = 4
       CODEPAGE                       = 5
       OTHERS                         = 6
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    regards,
    keerthi.

  • Pencil mark-ups disappear and Drawing Markups box goes black

    As I use Adobe Reader X, after a few pages of using the Comment--Drawing Markups tools, like the pencil marks, these start going goofy, disappearing an reappearing. Also the Drawing Markups box goes black, the "find" windows starts to disappear too. Seems like something's corrupted. Can anyone help?
    Thanks much.

    Hi there
    I also bought mine from the US, can't believe the sickening price difference. I've kept the powerlead for when I visit the states and want to use on my iPod charger and as Winston said, just used an existing powerlead (figure of eight). They're actually cheaper to buy than an airport-esque US to UK plug adaptor. The unit automatically does the 110/240v thing, so don't worry.
    Regards

  • Drawing a box with now fill and an outline

    I know this is simple, but I it's driving me crazy. Using the rectangle tool how do you draw a box with: an outline and no fill, and an outline with a different color fill. thanks

    public class Flags3 extends JFrame {
        public Flags3() {
            setContentPane( new JPanel() {
                public void paintComponent(Graphics g) {
                    int w = getWidth();
                    int h = getHeight();
                    int x = 0;
                    int y = 0;
                    System.out.println("Width:"+getWidth()+" Height: "+getHeight());
                    for (int i=0; i<100; i++) {
                        Color newGrey = Color.getHSBColor(150, 0, i/100.0f);
                        g.setColor(newGrey);
                        g.fillRect(0, (h/100)*i, w, (h/100));
            Dimension size = new Dimension(800, 600);
            getContentPane().setPreferredSize(size);
            getContentPane().setMinimumSize(size);
            getContentPane().setMaximumSize(size);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pack();
            setVisible(true);
        public static void main(String[] args) {
            new Flags3();
    }I wrote this mainly to make sure I wasn't giving you bad info, but I also improved your paint method a little bit. It's a JFrame instead of a JApplet, so you'll have to make some changes, but it gives the full range of black to white (although it doesn't include full brightness white, the B value only goes to .99).

  • Drawing a box

    Hi,
    I've developed a sapscript..... and I want to draw a box arround the date which is in the header..... can anybody help me please..... I'm using this syntax /: BOX FRAME 10 TW  but it is drawing a box on all the header.
    Thanks

    hi,
    in print preveiw in the header u get  <b>date xx.xx.xxxx</b>. right.
    by asssuming the cooridnates u enter in
      xpos ,ypos.
    width means the length of date xx.xx.xxxx may b around 3 to 4 cm.
    hight arounud 1 cm
    regards,
    ananth

  • 3D picture Draw shaded boxes - FAST!

    Hi,
    I would like to draw shaded boxes, like 'Scene.Drawable.Geometry.New Box'. But I want to draw some 100.000 boxes or more. If I use this function, I have to join the boxes using the Object.Add Object' invoke node. Repeating this for 100.000 times takes a long time, costs a lot of memory, and results in a slow display.
    As an alternative, I created a box primitive, built from 6 quads. I can create an array holding the vertices of 100.000 cubes, and display them like a mesh. The creation is fast, and also is the display. But: the shading of the boxes differs from the shading that results from the first method. See example code.
    I tried a whole lot of different lighting and shading settings, but I cannot get it right. Is it possible to draw a box using a mesh that looks exactly the same as the box using the new.box method?
    In the example code, I would like to have the red box to have the same sort of shading as the green box.
    Any help is appreciated.
    Attachments:
    3D Picture Draw.vi ‏23 KB

    Well you will have an X, a Y and a Z normal depending on the face of the cube and also positive or negative depending on the side of the cube.
    Try {1,0,0}, {0,1,0}, {0,0,1}, {-1,0,0}, {0,-1,0}, {0,0,-1} although I don't know in which order (Depends ont he order of declaration of the "sides".
    I think you may have to declare the normal mode to "Per Primitive" for this to work.
    PS here are the normals I got working with your example
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • How to draw transparent boxes in different layers including Size inside box

    See this apps http://www.pixelwindowapp.com/
    How to do this thing inside photoshop using Shapes or from any other method. see added video on this page to understand.
    In photoshop i want to draw transparent boxes (round corner not necessary) in different layers including Size in pixel like this Adobe air apps http://www.pixelwindowapp.com/ do on desktop
    http://www.pixelwindowapp.com/

    Hi Anvano,
    You don't actually have to draw the live features to be able to access the attributes. You can just call getLiveFeatureAttrs(x, y, tolerance) on your MapViewer instance to get hold of the attributes, you can use this in getToolTipText() of your component to show the attributes in a pop-up. No drawLiveFeatures needed! This way you still have to add a theme twice (once for drawing, once for the attributes) but it only gets drawn once, just in the nice style.
    Ida

  • Draw a box with a stroke, then invert to a fill, causes resizing using the invisible stroke

    ID-CS3
    Draw a box with a stroke, then invert to a fill, causes resizing using the invisible stroke. Is there a way to fix and have the graphic resize using the fill size without redrawing the shape? Something like expand appearance?
    I'm not looking for a workaround or to redraw the shape. This problem description was used to present the simplest explanation to recreate the problem.

    I'm not sure I understand your question/problem, but if I make a box with an outside stroke and assign a stroke color, then... invert the stroke and fill, the stroke gets redrawn as a centered stroke --- it is no longer an outside stroke.
    This seems to me to be incorrect behavior, but it's more likely I just don't understand *why* this happens.
    Tad

  • 1X 2X zoom box removal

    how can i remove the 1X or 2X zoom box i have accidentally opened in top-right of one of my apps? this issue is only in one app. thanks

    You are probably running an iPhone app which only produces an output screen the size of the iPhone. You can run the App at 1X (actual size) or 2X (doubled in size to better fill the iPad screen). I don't believe that you can remove the 1X-2X feature. See if there is an iPad screen sized version of the App in the App Store to replace it.

  • Zoom box shows pink shading instead of image

    Sometimes when I have several zoom areas on one screen, the
    first or second zoom shows up as a pink box instead of the zoom
    image. Strange that it doesn't seem to happen on all slides which
    have several zooms, just some of them. I've tried rearranging the
    zooms on the timeline and locking the slides, but nothing seems to
    work. I'm zooming 3 different areas of an image, so none of the
    zoom areas overlap and none of the zoom destination areas overlap.
    It happens intermittently in preview mode and also after I publish
    the file. Help! :)
    Example:
    Zoom #1 appears after 3 seconds and looks fine. It displays
    for rest of slide
    Zoom #2 appears after 11 seconds and looks fine (at first).
    It displays for the rest of slide
    Zoom #3 appears after 15 seconds and looks fine. Once Zoom #3
    appears, however, Zoom #2 (destination area) turns to a pink/peach
    colored box and remains that color for the rest of the
    slide.

    To my knowledge, this bug was never fixed. I just do one of
    these workarounds:
    1) Use highlighting instead of zooming
    2) Avoid placing more than one zoom area on a slide -
    separate them into separate slides with one zoom each
    3) If placing 2 zoom areas on one slide, zoom into a JPG of
    the zoomed area. To do this, follow these steps:
    - Insert zoom area as you normally would
    - Preview the slide and pause it when the zoom is at its
    largest
    - Use a screen capture to get a JPG of the zoom (I use
    faststone screen capture)
    - Exit captivate preview mode
    - return to the slide and doubleclick on the zoom area to
    show the info related to the zoom area
    - use the "select image" button (located on the "zoom
    destination area" tab)
    - find the JPG you just made and select it
    - Now when you play the slide the zoom turns into the JPG so
    you don't have to worry about it turning pink. Kinda time
    consuming, but it's the best I got ;)

  • Acrobat 11 crashing after drawing signature box

    I have a user that is using Acrobat Professional 11 and it has worked flawlessely for quite awhile.  But recently when he goes to try to sign the document it allows him to draw the signature box but as soon as he releases the mouse Acrobat crashes and immediately closes.  If he goes into the Signature section of preferences and changes it between DKC #7 and CAdES it works for that instance, but the next time he opens a document he has to repeat the process otherwise it crashes again.
    Version 11.4
    Anyone have any thoughts?

    Windows 7 Professional 64bit.

  • Draw signature box for a tablet computer

    I work for a public library and Acrobat is not my area of expertise so I need some help please!
    We have a PDF form for a lease agreement for a meeting room space. Using a tablet computer, we go over the lease with the renters and then sign it in person
    I need a signature box that just has a way to draw the signature. Right now I have to go through about 4 clicks to get that box, sign it, and then place the signature. I need a 1 click/tap solution that pulls up that draw signature screen and places it back in the existing box or field.
    I have tried using a text box with a javascript but am not getting anywhere.
    Thank you!

    I work for a public library and Acrobat is not my area of expertise so I need some help please!
    We have a PDF form for a lease agreement for a meeting room space. Using a tablet computer, we go over the lease with the renters and then sign it in person
    I need a signature box that just has a way to draw the signature. Right now I have to go through about 4 clicks to get that box, sign it, and then place the signature. I need a 1 click/tap solution that pulls up that draw signature screen and places it back in the existing box or field.
    I have tried using a text box with a javascript but am not getting anywhere.
    Thank you!

  • SAP-Script - Draw Table (Boxes) with variable number of lines

    Hello,
    I want to create a Table with Frames in a SAP-Script Form. First of all I don´t know the position of the table in the window main. It can be page 2 or 3 on top or in the middle. But i have to describe a position like
    POSITION YORIGIN '12.95' CM.  How can i position the table in a variable way?
    And i don´t know the number of lines of the table. How can I manage to draw the correct numbers of boxes as numbers of lines exist?
    Kind Regards
    Carsten Fuchs

    Hi carsten,
    1. Drawing GRID (just like excel, matrix)
       is very cumbersome in sapscript layout.
      (either dynamically, or hardcoded)
    2. Moreover, the final look,
       may or maynot appear as requried,.
      ie. exactly with proper alignment and grid lines.
    3. If the font size is required to change,
      then the dynamic position also changes.
    4. If the grid is supposed to go to the next page,
      again the calculation and logic becomes tougher.
    5. To use grid, its better to use smartform,
       which provided FINE CONTROL of the grid
      and its lines and width, height, style etc.
    6. In sapsctip, at most we can use
       UNDERLINE (_) and PIPE (|)
    regards,
    amit m.

  • Default gutter width for drawing text boxes for overset text

    I have master pages that were created with columns and the correct gutter width we want. When I drag a story from a window (a window that is part of our CMS) and place it on the page, the gutters between the text columns are correct -- p9 (or 0.125 inches). But if I draw a new text box or if I click the red plus to draw a text box for overset text, the gutter is a full pica (or 0.1667 inches).
    I want any text box that is drawn on the page or any overset text box that is drawn to default to p9 for gutters.
    I don't want to manually change the gutter for every new text box I draw.
    I'm using ID with CS4.
    Thank you.

    The default gutter in a multi-column frame is set in the object style under Text Frame General Options. If you haven't defined any new styles you only need to edit the [Basic Text Frame] style. New frames will use the new gutter value when you add columns. If you have object styles for other text frames, you'll need to edit those, too. For existing frames, if the number of columns has been changed manually, you will need to reset the gutter.

Maybe you are looking for

  • My apple id is not set with itunes store

    hello my apple id is not set with itunes

  • Site Won't Publish

    I have been having ongoing problems with iWeb. I thought that I had fixed them, by creating a new account on my computer and shifting my domain to that account and useing iWeb there to pubish and edit my page. I just added a photo album and now when

  • Error in executing delivery

    Hi Experts, While doing Delivery for order type "OR" I am getting the following error: "Create delivery" not allowed (Sys. status Cost, object VB0000015022000010)+ Diagnosis The status check for the status object VB0000015022000010 indicated that the

  • Camera RAW Mamiya ZD Back

    Can anyone help me with the folling problem, I want to import files from my Mamiya ZD back as Camera RAW (mef extension)in Aperture 3.0.3 It seems that the programm does'nt support that.

  • Keeping original iPhone data, songs, etc. when upgrading to 4g?

    I have a first generation iPhone, and I really want to upgrade to 4G. Is it possible to recover the things from your original iPhone when activating and switching to the iPhone4? If so, how is that accomplished?