Subtracting the stroke outside the rectangle.

I've got a stroked rectangle and I want only the stroke inside the rectangle to show.
The bottom layer has the stroke over the fill. 
The top layer is a duplicate of the bottom layer, except that the fill is black, the fill is over the stroke, and the layer mode is subtract.
Everything looks perfect, EXCEPT there is a thin (one pixel?) line on both the right and left side of the rectangle (where the outside of the stroke would be).
Why are those two thin lines there?  Does it have something to do with antialiasing?  How ought I make that work right?
Is there a better way to do it? 

This will only work if your rectangle is an even number of pixels high and wide and the anchor point is on a whole pixel value. Otherwise you get into sub pixel sampling. You can mitigate the errors by changing the blend mode to Alpha Add for both layers.
If that suggestion does not fix your problem we need to know a lot more about your project. How are the rectangles created? How is the stroke created? I'm assuming you are using Shape layers. If this is correct then my suggestions should work.

Similar Messages

  • I have made a swirl, but the allign stroke inside, and allign stroke outside are greyed out. Why? And how can I fix it?

    I have made a swirl, but the allign stroke inside, and allign stroke outside are greyed out. Why? And how can I fix it?

    Thank you, that kind of explains the why. Is there a how? Meaning is there a workaround? Basicly I have two strokes. One white thin stroke on the path (black background), Now I want my second stroke (which is a blue gradient) to start from the path and continue inward, as if it was "alligned innside"

  • I have Indesign CS6.  Question is about the rectangle box on the left side.

    The rectangle/box with the X through it, on the left in the second column, does not have the X through it anymore and now when I set up something to place in that section there is no X there either.  So I kept doing my thing as usual because it was still working, but when I printed it out the outline shows up where before the X was and there was no outline that showed up.  I do not know what I hit or did to change this.

    Screen shots, please.
    There are two, similar-looking, tools in the toolbox. The ones with the X are image frame tools and expect image content by default. These do not have stroke or fill applied when created, no matter what settings might be set as defaults.
    The ones without the X are the Shape tools, and by default they expect no content, but you can place anything into them if they are empty. They will have whatever stroke and fill are set by default when created.

  • [Help!] How I connect (the index) the rectangle array to a interger array

    I'm new in javafx... but the javafx language syntax seam to be many thing new... : )
    And I got a problem... : |
    My source:
    * Main.fx
    * Created on Mar 21, 2009, 4:57:42 PM
    package canvas;
    import javafx.scene.*;
    import javafx.scene.paint.*;
    import javafx.scene.shape.*;
    import javafx.stage.*;
    import javafx.scene.text.Text;
    import javafx.scene.text.Font;
    * @author xllsllx
    Stage {
        title: "Application title"
        width: 500
        height: 500
        scene: Scene {
            var clickcount = 0;
            content:Group {
                content: for(i in [1..8], j in [1..8]){
                    var zoom = 1;
                    var recbig = 40;
                    Rectangle {
                        x: i*recbig*zoom,
                        y: j*recbig*zoom
                        width: recbig*zoom,
                        height: recbig*zoom
                        fill: Color.BLACK
                        stroke:Color.WHITE
                        strokeWidth:1
                        onMouseEntered: function( e ):Void {
                            var rect: Rectangle = e.node as Rectangle;
                            rect.fill = Color.BLUE;
                        onMouseExited: function( e ):Void {
                            var rect: Rectangle = e.node as Rectangle;
                            rect.fill = Color.BLACK;
                        onMousePressed: function( e ):Void {
                            var rect: Rectangle = e.node as Rectangle;
                            rect.fill = Color.GREEN;
                            clickcount++;
                            //How can I get the rectangle index ...?
    }*[Problem]*
    I have:
    1. int array [i..8,j..8]
    2. rectangle array [i..8,j..8]
    3. I have a rectangle array display in a window. Picture -> [http://www.onjava.com/onjava/2007/07/27/graphics/grill.gif]
    4. I add mouse click event for each rectangle
    *5*. Mine problem is "_How I get the index of the rectangle in the rectarray when I click on any display rectangle_"
    Ex: I click on Rect[col:2,row:3] and I have the return value is col:2 & row:3.
    So I can mark it on int array at col:2 & row:3
    Thank for reading my problem... and thank a lot if have any answer... : )
    And if you have any new best solution for this problem please share. : ) Thank much!!!
    Edited by: xllsllx on Mar 23, 2009 11:09 AM

    What do you mean "you can use those features of Java from JavaFX"?
    I thought that JavaFX don't have a "true multi-dimensional arrays". Because I had tried a multi-dimensional arrays but it seam to be impossible.Correct. JavaFX doesn't have multi-dimensional arrays, and it also doesn't have a lot of the capabilities found in the Java Collections API. However, because JavaFX compiles to JVM bytecode, you can use Java functionality in your JavaFX program. For example, if you need a true multi-dimensional array, you could create a Java class that contains a multi-dimensional array and exposes getters and setters. On a related note, you could use the Collections API directly, as in the example in the following post (that also demonstrates reflection in JavaFX).
    http://javafxpert.com/weblog/2009/03/answering-reader-mail-about-the-javafx-reflection-api.html
    Note that the source code in that post imports java.util.Iterator, etc. to iterate over a Java collection. It also uses java.util.Date
    A disadvantage of using these approaches is that JavaFX can't bind to POJOs (yet).
    Thanks,
    Jim Weaver
    http://JavaFXpert.com (Learn JavaFX blog)

  • Subtract the amount of deductions from the amount of charges

    Subtract the amount of deductions from the amount of charges
    In the matrix are Grouping - Charges column, then deductions.
    There are total for charges and deductions.
    How to get the difference?

    Hi AlexFilipov,
    To achieve your requirement, we can refer to the following steps:
    Right-click the column contains charges and deductions values to insert a column with Outside Group-Right.
    Then type the following expression to the corresponding cells (the name filed contains charges and deductions values, the Value filed contains the amounts values of name field):
    =Sum(iif(Fields!name.Value="charges",Fields!Value.value,0))-Sum(iif(Fields!name.Value="deductions",Fields!Value.value,0))
    The following screenshot is for your reference:
    Besides, we can also use custom code to achieve the same goal, please see:
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/6b385f12-c431-4cde-99dc-eca3bc5df2bf/calculate-percentage?forum=sqlreportingservices
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to use the Rectangle class to draw an image and center it in a JPanel

    I sent an earlier post on how to center an image in a JPanel using the Rectangle class. I was asked to send an executable code which will show the malfunction. The code below is an executable code and a small part of a very big project. To simplifiy things, it is just a JFrame and a JPanel with an open dialog. Once executed the JFrame and the FileDialog will open. You can then navigate to a .gif or a .jpg picture and open it. What I want is for the picture to be centered in the middle of the JPanel and not the upper left corner. It is also important to stress that, I am usinig the Rectangle class to draw the Image. The region of interest is where the rectangle is created. In the constructor of the CenterRect class, I initialize the Rectangle class. Then I use paintComponent in the CenterRect class to draw the Image. The other classes are just support classes. The MyImage class is an extended image class which also has a draw() method. Any assistance in getting the Rectangle to show at the center of the JPanel without affecting the size and shape of the image will be greatly appreciated.
    I have divided the code into three parts. They are all supposed to be on one file in order to execute.
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class CenterRect extends JPanel {
        public static Rectangle srcRect;
        Insets insets = null;
        Image image;
        MyImage imp;
        private double magnification;
        private int dstWidth, dstHeight;
        public CenterRect(MyImage imp){
            insets = getInsets();
            this.imp = imp;
            int width = imp.getWidth();
            int height = imp.getHeight();
            ImagePanel.init();
            srcRect = new Rectangle(0,0, width, height);
            srcRect.setLocation(0,0);
            setDrawingSize(width, height);
            magnification = 1.0;
        public void setDrawingSize(int width, int height) {
            dstWidth = width;
            dstHeight = height;
            setSize(dstWidth, dstHeight);
        public void paintComponent(Graphics g) {
            Image img = imp.getImage();
         try {
                if (img!=null)
                    g.drawImage(img,0,0, (int)(srcRect.width*magnification), (int)(srcRect.height*magnification),
              srcRect.x, srcRect.y, srcRect.x+srcRect.width, srcRect.y+srcRect.height, null);
            catch(OutOfMemoryError e) {e.printStackTrace();}
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Opener().openImage();
    class Opener{
        private String dir;
        private String name;
        private static String defaultDirectory;
        JFrame parent;
        public Opener() {
            initComponents();
         public void initComponents(){
            parent = new JFrame();
            parent.setContentPane(ImagePanel.panel);
            parent.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            parent.setExtendedState(JFrame.MAXIMIZED_BOTH);
            parent.setVisible(true);
        public void openDialog(String title, String path){
            if (path==null || path.equals("")) {
                FileDialog fd = new FileDialog(parent, title);
                defaultDirectory = "dir.image";
                if (defaultDirectory!=null)
                    fd.setDirectory(defaultDirectory);
                fd.setVisible(true);
                name = fd.getFile();
                if (name!=null) {
                    dir = fd.getDirectory();
                    defaultDirectory = dir;
                fd.dispose();
                if (parent==null)
                    return;
            } else {
                int i = path.lastIndexOf('/');
                if (i==-1)
                    i = path.lastIndexOf('\\');
                if (i>0) {
                    dir = path.substring(0, i+1);
                    name = path.substring(i+1);
                } else {
                    dir = "";
                    name = path;
        public MyImage openImage(String directory, String name) {
            MyImage imp = openJpegOrGif(dir, name);
            return imp;
        public void openImage() {
            openDialog("Open...", "");
            String directory = dir;
            String name = this.name;
            if (name==null)
                return;
            MyImage imp = openImage(directory, name);
            if (imp!=null) imp.show();
        MyImage openJpegOrGif(String dir, String name) {
                MyImage imp = null;
                Image img = Toolkit.getDefaultToolkit().getImage(dir+name);
                if (img!=null) {
                    imp = new MyImage(name, img);
                    FileInfo fi = new FileInfo();
                    fi.fileFormat = fi.GIF_OR_JPG;
                    fi.fileName = name;
                    fi.directory = dir;
                    imp.setFileInfo(fi);
                return imp;
    }

    This is the second part. It is a continuation of the first part. They are all supposed to be on one file.
    class MyImage implements ImageObserver{
        private int imageUpdateY, imageUpdateW,width,height;
        private boolean imageLoaded;
        private static int currentID = -1;
        private int ID;
        private static Component comp;
        protected ImageProcessor ip;
        private String title;
        protected Image img;
        private static int xbase = -1;
        private static int ybase,xloc,yloc;
        private static int count = 0;
        private static final int XINC = 8;
        private static final int YINC = 12;
        private int originalScale = 1;
        private FileInfo fileInfo;
        ImagePanel win;
        /** Constructs an ImagePlus from an AWT Image. The first argument
         * will be used as the title of the window that displays the image. */
        public MyImage(String title, Image img) {
            this.title = title;
             ID = --currentID;
            if (img!=null)
                setImage(img);
        public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
             imageUpdateY = y;
             imageUpdateW = w;
             imageLoaded = (flags & (ALLBITS|FRAMEBITS|ABORT)) != 0;
         return !imageLoaded;
        public int getWidth() {
             return width;
        public int getHeight() {
             return height;
        /** Replaces the ImageProcessor, if any, with the one specified.
         * Set 'title' to null to leave the image title unchanged. */
        public void setProcessor(String title, ImageProcessor ip) {
            if (title!=null) this.title = title;
            this.ip = ip;
            img = ip.createImage();
            boolean newSize = width!=ip.getWidth() || height!=ip.getHeight();
         width = ip.getWidth();
         height = ip.getHeight();
         if (win!=null && newSize) {
                win = new ImagePanel(this);
        public void draw(){
            CenterRect ic = null;
            win = new ImagePanel(this);
            if (win!=null){
                win.addIC(this);
                win.getCanvas().repaint();
                ic = win .getCanvas();
                win.panel.add(ic);
                int width = win.imp.getWidth();
                int height = win.imp.getHeight();
                Point ijLoc = new Point(10,32);
                if (xbase==-1) {
                    xbase = 5;
                    ybase = ijLoc.y;
                    xloc = xbase;
                    yloc = ybase;
                if ((xloc+width)>ijLoc.x && yloc<(ybase+20))
                    yloc = ybase+20;
                    int x = xloc;
                    int y = yloc;
                    xloc += XINC;
                    yloc += YINC;
                    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
                    count++;
                    if (count%6==0) {
                        xloc = xbase;
                        yloc = ybase;
                    int scale = 1;
                    while (xbase+XINC*4+width/scale>screen.width || ybase+YINC*4+height/scale>screen.height)
                        if (scale>1) {
                   originalScale = scale;
                   ic.setDrawingSize(width/scale, height/scale);
        /** Returns the current AWT image. */
        public Image getImage() {
            if (img==null && ip!=null)
                img = ip.createImage();
            return img;
        /** Replaces the AWT image, if any, with the one specified. */
        public void setImage(Image img) {
            waitForImage(img);
            this.img = img;
            JPanel panel = ImagePanel.panel;
            width = img.getWidth(panel);
            height = img.getHeight(panel);
            ip = null;
        /** Opens a window to display this image and clears the status bar. */
        public void show() {
            show("");
        /** Opens a window to display this image and displays
         * 'statusMessage' in the status bar. */
        public void show(String statusMessage) {
            if (img==null && ip!=null){
                img = ip.createImage();
            if ((img!=null) && (width>=0) && (height>=0)) {
                win = new ImagePanel(this);
                draw();
        private void waitForImage(Image img) {
        if (comp==null) {
            comp = ImagePanel.panel;
            if (comp==null)
                comp = new JPanel();
        imageLoaded = false;
        if (!comp.prepareImage(img, this)) {
            double progress;
            while (!imageLoaded) {
                if (imageUpdateW>1) {
                    progress = (double)imageUpdateY/imageUpdateW;
                    if (!(progress<1.0)) {
                        progress = 1.0 - (progress-1.0);
                        if (progress<0.0) progress = 0.9;
    public void setFileInfo(FileInfo fi) {
        fi.pixels = null;
        fileInfo = fi;
    }

  • Lookup expression is not working when I am using with in the rectangle box in SSRS

    I have two datasets with common member is ProgramID.
    I have followed the below steps,
    1. Added one table  (2x2) and mapped this table to dataset1. After that I have removed top row.                                               
    That means I am maintaing only  data row.
    2. Added group to the table (ProgramID). Now the programid is sitting at cell#(1,1) and  cell#(1,2) is blank
    3. I have verified the report with preview and able to see the data for my all programs. I have 5 programs
    4. my plan is adding chart and matrix reports to cell# (1,2). If I am adding chart/matrix to the cell#(1,2) then we can't contol the  cell alignments in terms of height x width.
     To resolve that problem, I have added one rectangle control to the cell#(1,2) then I have added my chart and matrix report
    5. After completing the report, I have verified with preview and able to see the reports (chart/matrix) for all my 5 programs by page wise (note: I have provided page break before for my rectangle)
    6. Till this point, I have no issues
    7. Now, I have added one more row under the group. so, we have our main table (2x2). Becuase of programId group we can only see 3 cells in total table  (cell# (1,1) =ProgramId  cell#(1,2)=chart and matix reports under rectangle box; cell#(2,1)=already
    merged with ProgramID group; cell#(2,2)= planned to add one more rectanlge and add two reports (chart and matrix)
    8. Now, i have added rectangle to cell#(2,2) then added chart and matrix reports within the rectangle.
    9. cell#(2,2) reports are needs to extract the data from dataset-2. Here we have common member is ProgramID (ds-1,ds-2)
    10. First I have tested for matrix report by adding lookup expression
          Matrix report (2x2)
         row-1: Cell(1,1)= Gender report heading ; cell(1,2)=Month  (column group)
         Note: month is also common member in both the datasets. 
         row-2: cell(2,1)--  =Lookup(Programid.value, Programid.value,Gender.value,"Dataset2")  (Gender data is Male and Female)
                    Cell(2,2) -- empty for now
     11. I have tried to preview the report and able to see the report without any issues and below are observations
            main Table (2 x2)
             Cell# (1,1)  = ProgramID --Returning all 5 programs properly
             Cell# (1,2)  = Dataset1 related report (chart and matrix reports under rectangle) -- able to see without any issues
             Cell#(2,1)  = We already know this is merged cell. i.e menas ProgramID dispalying
              Cell#(2,2)= Only Male record is dispalying in the matrix report which is under rectanlge (here we have applied Lookup expression.
    Note: male is the first record from the database and Female is the second record
    Also, observed that Cell#(2,2) matrix report is unable to display the gender count information when I have provided count value expression in the cell(2,2) within the matrix and the expression I have uses is
      = sum(Lookup(ProgramId.value,ProgramId.value,GenderCOunt.value,"Dataset2"))
    Please ask me if I am unable to explain or lengthy explain.
    Point : Why the lookup expression is giving the first record only (in case of gender #(male, female) and why it is unable to give the gendercount.  Gendercount cell is totally blank.
    Please help me.
    Kishore.

    Hi Kishore,
    I have tested the issue step by step by following you description, while the first issue works well in my local environment. Based on my research, this can be caused by the lookup expression or it indeed return Male value based on the logic. If you use the
    expression below, it will indeed only return the Male record. So please try to double-check the record in the two datasets and the expression in your environment:
    =lookup(first(Fields!ProgramID.Value,"DataSet1"),Fields!ProgramID.Value,Fields!Gender.Value,"DataSet2")
    As to the second issue, please try to use the following expression:
    =Count(Lookup(fields!ProgramID.value,fields!ProgramID.value,fields!Gender.value,"DataSet2"))
    Besides, if this issue still exist, in order to trouble shoot this issue more efficiently, could you please post both the .rdl  file with all the size properties to us by the following E-mail address?  It is benefit for us to do further analysis.
    E-mail: [email protected]
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to clear the the rectangle........

    Hello,
    I'm doing a project in swings and i have drawn a rubberband rectangle in buffered image once the user clicks and drags mouse the dotted lines appear showing the boundary of rectangle and when the button is released the lines should become solid .
    But in my case after releasing the button the dotted lines will remain within the rectangle but i need only the outer lines of rectangle to be there.
    How to make those lines invisible which are in side the rectangle.
    Can anybody suggest some method to do it ?
    Thanks in advance,
    The code is:
    // Rubber1.java    basic rubber band for shape
    //                 Draw rectangle. left mouse down=first point     
    //                 Drag to second point. left mouse up=final point
    //                 right mouse changes color of first figure area
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import javax.swing.*;
    public class Rubber1 extends JPanel
      int ax,ay,bx,by;     
      int winWidth = 500;
      int winHeight = 500;
      boolean tracking = false; // left button down, sense motion
      int startX = 0;
      int startY = 0;
      int currentX = 0;
      int currentY = 0;
      int num_fig = 0; // number of figures to draw
      int select = 0;  // the currently selected figure index
      Fig figure[] = new Fig[50]; // num_fig is number of figures to display
      BufferedImage BuffImage ;
      Graphics2D gb;
      Rubber1()
        //setTitle("Spiral");
        setSize(winWidth,winHeight);
        setBackground(Color.white);
        setForeground(Color.black);
        BuffImage = new BufferedImage(10,10,BufferedImage.TYPE_INT_ARGB);
        gb = BuffImage.createGraphics();
        gb.setColor(Color.BLACK);
        /*addWindowListener(new WindowAdapter()
          public void windowClosing(WindowEvent e)
            System.exit(0);
        setVisible(true);
        this.addMouseListener (new mousePressHandler());
        this.addMouseListener (new mouseReleaseHandler());
        this.addMouseMotionListener (new mouseMotionHandler());
      class Fig // just partial structure, may add more
        int kind;           // kind of fig
        int x0, y0, x1, y1; // rectangle boundary
        double r, g, b;     // color values
        double width;
        Fig(){ kind=0; x0=0; y0=0; x1=0; y1=0;
                      r=0.0; g=0.0; b=5.0; width=0.0;}
         void mouseMotion(int x, int y)
            if(tracking)
             currentX = x;
             currentY = y;
             requestFocus();
             repaint();
          void startMotion(int x, int y)
            tracking = true;
             startX = x;
             startY = y;
             currentX = x;
             currentY = y; // zero size, may choose to ignore later
             requestFocus();
             repaint();
         void stopMotion(int x, int y)
           tracking = false; // no more rubber_rect
           // save final figure data for 'display' to draw
           currentX = x;
           currentY = y;
           figure[num_fig] = new Fig();
           figure[num_fig].kind = 1; /* just rectangles here */
           figure[num_fig].x0 = startX;
           figure[num_fig].y0 = startY;
           figure[num_fig].x1 = currentX;
           figure[num_fig].y1 = currentY;
           figure[num_fig].r = 1.0;
           figure[num_fig].g = 0.0;
           figure[num_fig].b = 0.0;
           figure[num_fig].width = 2.0;
           num_fig++;
           requestFocus();
           repaint();
      class mousePressHandler extends MouseAdapter
        public void mousePressed (MouseEvent e)
          int b;
          b = e.getButton();
          ax = e.getX();
          ay = e.getY();
           System.out.println("press x="+ax+"   y="+ay+" "); // debug print
          if(b==1) startMotion(ax, ay);  // right mouse
          if(b==3) pick(ax, ay);         // left mouse
        @Override
        public void mouseClicked(MouseEvent e)
             int n =0,o;
             if(MouseEvent.BUTTON3==e.getButton())
             n = e.getX();
             o = e.getY();
             menu( n , o);
        public void menu(int n ,int o)
             JFrame.setDefaultLookAndFeelDecorated(true);       
             JFrame frame = new JFrame("Parameters");
           // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JPanel panel = new JPanel();
            frame.add(panel,BorderLayout.SOUTH);
            JButton b1 = new JButton("PLOT");
            panel.add(b1);
          /*  b1.addActionListener(new ActionListener()
                 public void actionPerformed(ActionEvent arg2)
                       Spiral spiral = new Spiral();
            b1.setMnemonic(KeyEvent.VK_P);
            JButton b2 = new JButton("CANCEL");
            panel.add(b2);
           b2.setMnemonic(KeyEvent.VK_C);
            b2.addActionListener(new ActionListener()
                 public void actionPerformed(ActionEvent arg1)
                      System.exit(0);
            JMenuBar menubar = new JMenuBar();
            JMenu degmenu = new JMenu("Angle(D)");
            degmenu.add(new JSeparator());
            JMenu colmenu = new JMenu("Color");
           // colmenu.add(new JSeparator());
            JMenu spamenu = new JMenu("Spacing");
            //spamenu.add(new JSeparator());
            JMenuItem degItem1 = new JMenuItem("5");
            JMenuItem degItem2 = new JMenuItem("10");
            JMenuItem degItem3 = new JMenuItem("15"); 
            JMenuItem colItem1 = new JMenuItem("Color");
            colItem1.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent arg0)
                        // TODO Auto-generated method stub
                        ColorChooser chooseColor = new ColorChooser();
                        JFrame frame = new JFrame();
                        frame.setSize(450,330);
                        frame.add(chooseColor);
                        frame.setVisible(true);
                       //frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            degmenu.add(degItem1);
            degmenu.add(degItem2);
            degmenu.add(degItem3);
            colmenu.add(colItem1);
            menubar.add(degmenu);
            menubar.add(colmenu);
            menubar.add(spamenu);
            frame.setJMenuBar(menubar);
            frame.setSize(180,120);
            frame.setVisible(true);  
            frame.setLocation( n+5 , o+5 );
      class mouseMotionHandler extends MouseMotionAdapter
        public void mouseDragged (MouseEvent e)
          int x, y;
          int b;
          b = e.getButton();
          x = e.getX();
          y = e.getY();
          mouseMotion(x, y);
         // rubberRect rub = new rubberRect();
      class mouseReleaseHandler extends MouseAdapter
        public void mouseReleased (MouseEvent e)
          int b; //int x, y;
          b  = e.getButton();
          bx = e.getX();
          by = e.getY();
          if(b==1) stopMotion(bx, by);
          System.out.println("press x=" +bx+"    y="+by+" ");
       public void rubberRect(Graphics2D gb, int x0, int y0, int x1 , int y1)
          // can apply to all figures
          // draw a rubber rectangle, mouse down, tracks mouse
           int x,y,x2,y2,x3,y3; // local coordinates
           x2=x0;
           x3=x1;
           if(x1<x0) {x2=x1; x3=x0;};
           y2=y0;
           y3=y1;
           if(y1<y0){y2=y1; y3=y0;};
             //gb.setColor(Color.black);
           for(x=x2; x<x3-3; x=x+8) // Java does not seem to have a
             {                        // dashed or stippled rectangle or line
               gb.drawLine(x, y0, x+4, y0);
               gb.drawLine(x, y1, x+4, y1);
           for(y=y2; y<y3-3; y=y+8)
               gb.drawLine(x0, y, x0, y+4);
               gb.drawLine(x1, y, x1, y+4);
      void fillRect(Graphics2D gb, Fig rect)
        int x, y;
        gb.setColor(new Color((float)rect.r, (float)rect.g, (float)rect.b));
        // g.setLineWidth(rect.width); ???
        x=rect.x0;
        if(rect.x1<rect.x0) x=rect.x1;;
        y=rect.y0;
        if(rect.y1<rect.y0) y=rect.y1;
        gb.drawRect(x, y, Math.abs(rect.x1-rect.x0),Math.abs(rect.y1-rect.y0));
        if(rect.width>1.0)
        gb.drawRect(x-1, y-1, Math.abs(rect.x1-rect.x0)+2,Math.abs(rect.y1-rect.y0)+2);
        //gb.clearRect(startX-10,startY-10,currentX-10,currentY-10);
      void pick(int x, int y)
        int i;
       // float t; search figures in list, select
        for(i=0; i<num_fig; i++)
          if(figure.x0 < figure[i].x1)
    if(x<figure[i].x0 || x>figure[i].x1) continue;
    if(figure[i].x1 < figure[i].x0)
    if(x<figure[i].x1 || x>figure[i].x0) continue;
    if(figure[i].y0 < figure[i].y1)
    if(y<figure[i].y0 || y>figure[i].y1) continue;
    if(figure[i].y1 < figure[i].y0)
    if(y<figure[i].y1 || y>figure[i].y0) continue;
    // select here by just changing color
    figure[select].r = 1.0;
    // figure[select].g = 0.0;
    select = i;
    figure[select].r = 0.0;
    // figure[select].g = 1.0;
    break;
    requestFocus();
    // repaint();
    protected void paintComponent(Graphics g)
    Graphics2D gb=(Graphics2D)g;
    //gb.setXORMode(getBackground());
    // gb.setXORMode(Color. gray); //border color
    if(tracking==true)rubberRect(gb,startX,startY,currentX,currentY);
    gb.drawImage(BuffImage,ax,ay,Color.white,this);
    for(int i=0;i<num_fig;i++)
    fillRect(gb, figure[i]);
    // gb.clearRect(startX-10,startY-10,currentX-10,currentY-10);
    public static void main(String args[])
         JFrame f = new JFrame();
         f.setSize(500,500);
         Rubber1 r = new Rubber1();
         f.add(r);
         f.setVisible(true);
    //new Rubber1();
    Edited by: sumukha on Nov 15, 2007 1:19 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Two things,
    1) Java does have dashed lines. Look into BasicStroke. You'll have to cast your Graphics object into a Graphics2D to use it, but it's quite simple to use.
    See http://java.sun.com/j2se/1.4.2/docs/guide/2d/spec/j2d-awt.html section 2.3.2.3.
    2) Rubber banding is much easier to do using XOR mode. The first drawing will use the difference between the color you're set at and the background. The second drawing over the same place with the same color will reverse the process. So to use it, you draw your rubber band, then to remove it, you draw over the old one without changing anything. You'll have to keep track of the last known position of the shape, but it's not too difficult once you get the hang of it. Use setPaintMode() to return to normal drawing. I couldn't find a good example on the net, so here's a simple example for a rectangle only:
       public void drawShape() {
          if (mCurrentRect != null) {
             Graphics2D g = (Graphics2D)getGraphics();
             if (mIsPermanent) {
                g.setPaintMode();
             } else {
                g.setXORMode(getBackground());
             g.draw(mCurrentRect);
             g.dispose();
       public void mousePressed(MouseEvent evt) {
          mCurrentRect = new Rectangle(evt.getX(), evt.getY(), 0, 0);
          mIsPermanent = false;
          drawShape();
       public void mouseDragged(MouseEvent evt) {
          if (mCurrentRect != null) {
             drawShape();      // Remove shape
             mCurrentRect.setRect(mCurrentRect.getX(), mCurrentRect.getY(), evt.getX(), evt.getY());
             drawShape();      // Redraw it
       public void mouseReleased(MouseEvent evt) {
          if (currentShape != null) {
             drawShape();      // Remove shape
             mCurrentRect.setRect(mCurrentRect.getX(), mCurrentRect.getY(), evt.getX(), evt.getY());
             mIsPermanent = true;
             drawShape();      // Redraw it
             mRectangleList.add(mCurrentRect); // iterate through in paintComponent to draw these
             mCurrentRect = null;
       }

  • How can I change the frame around a title created with the Rectangle Tool?

    In PrE 7, I have been creating titles (e.g.: Title > New Title > Default Still, etc.) for a long time and using the many ways to manipulate the text (type, color, size, animation, etc.). Today, I tried to use the Rectangle Tool (or the Ellipse Tool, or the Line Tool) and they created a beautiful 'frame' (like a picture frame: artistically designed and colored) and I can change the background color within the frame and place any text (also background picture, etc.) in it. However, I couldn't find any way to change the 'frame' or the general style of these title objects. Is there any way to do this, or this is the only design that can be created with these tools? I would greatly appreciate any help (couldn't find any in this u2u site). Thanks, Laci.

    Laci,
    Yes, you can apply Styles to several Rectangles (or other Shapes), to simulate a "frame." The Styles should appear as Text in the Styles Panel. Since you are working with Shapes, but viewing the Styles applied to Text, it is not perfectly intuitive as to what those Styles look like with the Shapes.
    Personally, I find that doing things like "frames" in Photoshop and then Importing the PSD's into PrE is far, far easier. In that case, I would place the PSD on Video Track 1 (unless I wanted it to appear superimposed over my Video (like a PiP), and then do the text in a PrE Title, and place it above the PSD.
    Here is an example:
    This is a simple "picture frame" created in PS. I used a still image, instead of text in this case. These could be "wood-grained," "granite," etc.
    Much more control and tons of Effects and Filters that can be applied.
    Good luck,
    Hunt
    PS - that is from PrPro, so the GUI will look quite different, but things work the same way.

  • How can can i subtract the value of the column in each row ?

    I want to subtract  the value  of the column in each row if the row is not enough then continue to next row.
    For example 
    ID             QTY
    A               20
    B               40       
    C               60
    I want to update this table by subtract  the value  of the column (QTY) out 70 so the result i want will be 
    ID              QTY
    A                20 - 70 = -50 -->  0 this row will be updated to 0 and 50 will continue to next row   
    B                40 - 50  = -10 -->  0   this row will be updated to 0 and 10 will continue to next row
    C                60 - 10  = 50  -->  Stop loop
    How can i write the sql query for this operation , Thanks

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You have no idea,
    do you? Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. What did you try on your own before posting? I will bet that you did nothing! You expect other people to do your job or homework for you. 
    >> I want to subtract the value of the column in each row if the row is not enough then continue to next row. <<
    This makes no sense. Rows have no ordering; that is a spreadsheet. There is no such thing as a generic “id” in RDBMS. And an identifier is not a sequence which would have an ordering. 
    CREATE TABLE Foobar
    (something_seq INTEGER NOT NULL PRIMARY KEY,
     onhand_qty INTEGER NOT NULL);
    Learn how to use the SUM()OVER() and LAG() aggregate functions, post what you tried for yourself and then we will help you. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Trying to underline the rectangle of a Text Field

    I am trying to underline the rectangle of a Text Field with a Line Annotation, but I am a little confused.
    The first doubt is about the "Square" vs, the "Rectangle" annotations. What is the difference between them? Has Adobe changed those recently?
    I have tried several variations of the following snippet:
        var x1 = textField.rect[0];
        var y1 = textField.rect[1];
        var x2 = textField.rect[2];
        var y2 = textField.rect[3];
        var underscore = this.addAnnot({
            page: 0,
            type: "Line",
            rect: [x1, y1, x2, y1],
            strokeColor: color.red,
            strokeWidth: 160
    What I am getting is an identity line (i.e., 45-degree) at the lower left corner.
    -Ramon

    Thanks for your reply, try67:
    Could you -or anybody else- please clarify this:
    "The square rect defines top-left-x, top-left-y, bottom-left-x and bottom-left-y.
    For a line it's left-x, left-y, right-x, right-y."
    According to such definition, the square rect does not contain any information about the right side?
    Maybe what you meant to write is:
    "The square rect defines:
    top-left-x, top-left-y, bottom-right-x and bottom-right-y.
    For a line it is
    left-x, left-y, right-x, right-y."
    If that's the case, a rect of zero height is the same thing as a horizontal line. That was my assumption, but I am getting a 45-degree line through the origin.
    TIA,
    -Ramon

  • Calculate the rectangle size displayed in JScrollPane

    Hi,
    I am pasting a code below, What i want to get is the the rectangle of panel which will be displayed, so i can use g.setClip method to only paint that much portion of the JPanel
    Please copy the code compile it and run it, so u will come to know my problem..
    I want to dynamically setClip so the display is proper when the user scrolls.
    Ashish
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class TestDisplaySize extends JFrame
         JScrollPane scrollPane ;
         public TestDisplaySize()
              super("layered pane");
              this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              MyPanel panel = new MyPanel();
              scrollPane = new JScrollPane(panel);
              Container contentPane = this.getContentPane();
              contentPane.add(scrollPane, BorderLayout.CENTER);
              setSize(new Dimension(800,600));
              this.setVisible(true);
         class MyPanel extends JPanel
              public MyPanel()
         setPreferredSize(new Dimension(2000,600) );     
         this.setBackground(Color.white);
         this.setOpaque(true);
         public void paintComponent(Graphics g)
    super.paintComponent(g);
    g.setClip(0,0, 750,550);
    g.setColor(Color.blue);
    int x = 0;
    for(int i = 0; i < 60; i++)
         x +=60;
         g.drawLine(x, 0, x, 600);
         public static void main(String args[])
         new TestDisplaySize();
    }

    ash,
    Use this:
    super.paintComponent(g);
    Rectangle r = scrollPane.getViewport().getViewRect();
    g.setClip((int)r.getX(), (int)r.getY(), (int)r.getWidth(), (int)r.getHeight());
    g.setColor(Color.blue);--A
    PS: in future please see the "special tokens" link in the posting page for special tags that will make posted code format better.

  • How do I get the rectangle tool to draw in the color I've selected?

    I'm quite new to indesign, so bear with me.
    I've selected a color with the eyedropper tool, and once I am about to draw using the rectangle tool, the color switches to grayscale. How do I change this?
    Thanks

    You've gotten the answer but may I suggest a couple of references?
    Sandee Cohen's Visual Quick Start Guide is the best $18 you'll ever spend: http://amzn.to/IfpRN3
    There are some excellent video courses on Lynda.com. This link will get you a one week free trial: http://bit.ly/fcGpiI
    Bob

  • I want to Subtract the current date to find out whats the date 10 days back

    Hi guys,
    I want to subtract the current date to find the date 10 days back. If I use Gregorian calendar and then substract the day
    calender.get(GregorianCalendar.DATE) - 10;
    I will get right if my current date is 20 or more. If it happens to be less than 10, then I get in negative.
    Please suggest an solution for this.
    Thanks in advance
    With regards,
    Amin

    Here's the code.
        GreogrianCalendar mycalendar = new GregorianCalendar() ;
        mycalendar.add(mycalendar.DATE, -10) ;That should get you the date you want and just ignore the background noise that is hambone.
    Hi guys,
    I want to subtract the current date to find the date
    10 days back. If I use Gregorian calendar and then
    substract the day
    calender.get(GregorianCalendar.DATE) - 10;
    I will get right if my current date is 20 or more. If
    it happens to be less than 10, then I get in negative.
    Please suggest an solution for this.
    Thanks in advance
    With regards,
    Amin

  • What is the cross in the rectangle/ellipse shape?

    Hi,
    Been using Illstrator for over 7 years now, and never really wanted to ask this question, but I have to now. If I draw a sqaure using the rectangle tool, it shows a cross in the centre, and if I draw one using the pen tool, there is no cross. Is the cross there to merely show the centre or does it have a different purpose in showing it's a different property? Also, if you want to recreate this, make sure you are in Outline View (⌘/ctrl + Y) .
    Thanks in advance!

    It's the center point of the rectangle; useful for alignment and movement. Can be turned off in the Attributes panel (icons on the left). The rectangle created with the Pen tool can have one as well; just needs to be turned on.

Maybe you are looking for

  • Error while parsing date format

    Hi Friends I am using db2 as backend for my project and currently facing an issue with the parsing of the date. The date being returned from the db is in the format - yyyy-MM-dd-HH.mm.ss.SSS000 and the return type is String. when i try to parse and c

  • Regarding "select into" query and "no data found" exception

    So i have included the following into my procedure: select div_cd into c_div_cd                from division_tab d, emp_tab y                where d.div_name=y.div_text and y.emp_code=d.emp_code; and also an exception exception when no data found --

  • Set :system.current_datatime

    Hi ! 1. The :system.current_datetime, display current date & time in this formate: DD-MON-YYYY HH24:MM:SS. 2. I want to display time not in 24 hr mode, but in 12 hr mode. Thanks! Regards!

  • Scaling models

    hello; the scale command only offers scaling along the x,y,z axis's; is it possible to scale along some other vector? my models are coming from Rhino --> LW --> .w3d; within the w3d's, the models ARE NOT aligned/positioned relative to world(x,y,z)/wo

  • Can't install Lion on Macbook Pro with bootcamp.

    Basically I have a Macbook pro with 10.6.8 with windows installed on a partition called bootcamp. I try to install lion on Mac HD and it says This disk doesnt use the GUID partition table....Use disk utility.... How ever when I select my internal hd