Draw a line after zoom in

Hi All,
I want to draw a line after zooming in/out the image. If the image is not scaled, then ever thing is fine. But once I scaled the image and draw the line, the position is not coming correctly. Can you correct me, what's my mistake?
package imagetest;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
public class ZoomAndDraw extends JPanel
    private java.awt.image.BufferedImage image = null;
    private Line2D.Double line = null;
    private double scale = 1.0;
    private int value = 16;
    private double translateX = 0.0;
    private double translateY = 0.0;
    private MouseManager manager = null;
    public ZoomAndDraw()
        line = new Line2D.Double();
        readImage();
        manager = new MouseManager(this);
        addMouseListener(manager);
        addMouseMotionListener(manager);
    private void readImage()
        try
            image = javax.imageio.ImageIO.read(new java.io.File("D:/IMG.JPG"));
        catch (Exception ex)
    @Override
    public Dimension getPreferredSize()
        if (image != null)
            int w = (int) (scale * image.getWidth());
            int h = (int) (scale * image.getHeight());
            return new Dimension(w, h);
        return new Dimension(640, 480);
    @Override
    protected void paintComponent(Graphics g)
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D) g;
        if (image == null)
            return;
        double x = (getWidth() - scale * image.getWidth()) / 2;
        double y = (getHeight() - scale * image.getHeight()) / 2;
        g2.translate(x, y); // move to center of image
        g2.scale(scale, scale); // scale
        translateX = 0 - x * (1 / scale);
        translateY = 0 - y * (1 / scale);
        g2.translate(translateX, translateY); // move back
        g2.drawImage(image, 0, 0, this);
        g2.setColor(Color.RED);
        g2.draw(line);
        g.dispose();
    public void setLine(Point start, Point end)
        line.setLine(start, end);
        repaint();
    public void addLine(Point start, Point end)
        line.setLine(start, end);
        repaint();
    public void ZoomIn()
        value++;
        scale = (value + 4) / 20.0;
        revalidate();
        repaint();
    public void ZoomOut()
        if (value <= -3)
            return;
        value--;
        scale = (value + 4) / 20.0;
        revalidate();
        repaint();
    class MouseManager extends MouseAdapter
        ZoomAndDraw component;
        Point start;
        boolean dragging = false;
        public MouseManager(ZoomAndDraw displayPanel)
            component = displayPanel;
        @Override
        public void mousePressed(MouseEvent e)
            start = e.getPoint();
            dragging = true;
        @Override
        public void mouseReleased(MouseEvent e)
            if (dragging)
                component.addLine(start, e.getPoint());
                component.repaint();
            dragging = false;
        @Override
        public void mouseDragged(MouseEvent e)
            Point end = e.getPoint();
            if (dragging)
                component.setLine(start, end);
                component.repaint();
            else
                start = end;
    public static void main(String[] args)
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        ZoomAndDraw zoomAndDraw = new ZoomAndDraw();
        //Zoom in call
        zoomAndDraw.ZoomIn();
        zoomAndDraw.ZoomIn();
        zoomAndDraw.ZoomIn();
        frame.add(zoomAndDraw);
        frame.setPreferredSize(new Dimension(640, 480));
        frame.setSize(new Dimension(640, 480));
        frame.setVisible(true);
}Thanks and Regards
Raja.

Hi,
I'm having one more doubt. Just assume, after calling the ZoomIn(), I am drawing a line.
Subsequent ZoomIn() calls (let's say 5 times), changed the actual line position. How do I synchronize the zoom in call with the line coordinates?
public void FireZoomIn()
        new Thread(new Runnable()
            public void run()
                try
                    Thread.sleep(3000);
                catch (InterruptedException iex)
                int count = 0;
                while (count++ < 5)
                    ZoomIn();
        }).start();
public void mouseReleased(MouseEvent e)
            if (dragging)
                component.addLine(start, e.getPoint());
                component.repaint();
                component.FireZoomIn();
            dragging = false;
        }Thanks and Regards
Raja.

Similar Messages

  • How to draw a line after i load a frame?

    its simple to draw a line before i load the frame..
    when i try to draw a line after i load the frame, i get a error in the last line of the lauchFrame method..
    the error is "java.awt.Graphics is abstract; cannot be instantiated"
    import java.awt.*;
    class GraphArea extends Panel
        public void paint(Graphics g)
            g.setColor(Color.BLUE);
            g.drawLine(0,0,250,250);
        public void paint(Graphics g,int X1, int X2)
            g.drawLine(0,0,X1,X2);
    class Grapherv1 {
      private Frame f;
      private GraphArea drawPanel;
      public Grapherv1() {
        f = new Frame("Drawing Shapes:Lenin");
        drawPanel = new GraphArea();
      public void launchFrame() {
          f.setLayout(new FlowLayout());
          drawPanel.setSize(950,550);
          drawPanel.setBackground(new Color(220,220,220));
          drawPanel.setLayout(null);
         f.setBackground(Color.white);
          f.add(drawPanel);
        f.pack();
        f.setSize(1000, 800);
        f.setVisible(true);
        drawPanel.paint(new Graphics(),100,100);
    public static void main(String args[]) throws InterruptedException {
          Grapherv1 gui = new Grapherv1();
        gui.launchFrame();
    }please tell me how to call this method ...
    public void paint(Graphics g,int X1, int X2)
    what argument i should pass for Graphics??
    Edited by: Tall-Dude on Dec 3, 2007 4:33 PM
    Edited by: Tall-Dude on Dec 3, 2007 4:33 PM

    Tall-Dude wrote:
    please tell me how to call this method ...
    public void paint(Graphics g,int X1, int X2)just past the new x1 and x2 and repaint no need to pass the graphics.
    e.g.
    import java.awt.*;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    class Grapherv1 {
        private Frame f;
        private GraphArea drawPanel;
        public Grapherv1() {
            f = new Frame("Drawing Shapes:Lenin");
            drawPanel = new GraphArea();
        public void launchFrame() {
            f.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {
                    System.exit(0);
            f.setLayout(new BorderLayout());
            drawPanel.setSize(950,550);
            drawPanel.setBackground(new Color(220,220,220));
            drawPanel.setLayout(null);
            f.setBackground(Color.white);
            f.add(drawPanel);
            f.pack();
            f.setSize(1000, 800);
            f.setVisible(true);
            drawPanel.redraw(300,400);
        public static void main(String args[]) throws InterruptedException {
            Grapherv1 gui = new Grapherv1();
            gui.launchFrame();
        class GraphArea extends Panel {
            int x1, x2;
            public void paint(Graphics g) {
                g.setColor(Color.BLUE);
                g.drawLine(0,0,x1,x2);
            public void redraw(int X1, int X2) {
                x1 = X1;
                x2 = X2;
                repaint();
    }

  • How to draw horizontal line in smartform after end of the all line items

    Hi Friends,
    I am working on the smartform. I have created TABLE node in Main window.
    i want to draw a horizontal line after end of the main window table node. i mean after printing all the line items of the table, I need to print one horizontal line.
    Could you please help me how to resolve this issue.
    FYI: I tried with the below two options. But no use.
    1. desinged footer area in the table node of the main window.
    2. tried with uline and system symbols.
    please correct me if i am wrong. please explain in detail how to draw horizontal line after end of the main window table.
    this is very urgent.
    Thanks in advance
    Regards
    Raghu

    Hello Valter Oliveira,
    Thanks for your answer. But I need some more detail about blank line text. i.e thrid point.
    Could you please tell me how to insert blank line text.
    1 - in your table, create a line type with only one column, with the same width of the table
    2 - in table painter, create a line under the line type
    3 - insert a blank line text in the footer section with the line type you have created.

  • Need to draw line after the 2nd line item(Smart Forms)

    Dear Friends,
    I need to draw horizontal line after the 2nd line item  and 3rd line item in smart forms.How can i achive this.
    Plz help.
    Edited by: farook shaik on May 19, 2009 8:19 AM

    This is what you need to do:
    1> In the tables->details section define two line types LT1 and LT2.
    2> Come back to tables section pressing the table painter button.
    3> Select a line type for which you want to have an underline(say LT2).
         a] If the anchor cursor does not come click the draw lines and columns button( the pencil icon nutton)
         b] select the line type ( it will become black after selection. Press and hold down ctrl to select
             multiple cells.
         c] after selection click the lower 'frame button' ( which is right at the top of box and shading).
    4> Now goto data section where you have given your internal table name and work area.
         a] in the sort criteria put your field POSNR and check the Event on Sort end chk box.
         b] you will see an extra node under the main area of the table.
         c] Create a table line with the line type LT2 in the node.
         d]Also in the Main area add another table line with LT1 as the line type.
    5> If POSNR remains unchnged LT1 will be triggered.
    6> if Posnr changes then LT2 will be triggered with the underline.
    This will suffice your requirement.

  • Problem in drawing a line in Java Application Program

    Hi,
    I am trying to draw a line after a message is displayed on the screen. But the line is not at all coming on the screen while running. but I can see a red line is appearing on the screen first and and it is getting overridden.
    There is something wrong in the concept what I understood about graphics.Can anybody help to
    understand where the problem is ?
    Here is the part of the code which used to draw line.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.util.Date.*;
    import java.text.*;
    import java.lang.*;
    import MyPack.*;
    class chalan_pay extends JFrame
    JTextField jt1,jt2,jt3,jt4,jt5;
    JLabel jlh,jl1,jl2,jl3,jl4,jl5,jl10;
    JButton bt1,bt2,bt3;
    Choice ch1,ch2,ch3,ch4;
    Connection con = null;
    int i1no,i2no,i3no,i4no,itno;
    String idate;
    public chalan_pay()
    getContentPane().setLayout(null);
    jt1= new JTextField(5);
    jt1.setBounds(110,150,50,20);
    jt2= new JTextField(10);
    jt2.setBounds(400,150,100,20);
    jt3= new JTextField(3);
    jt3.setBounds(590,150,30,20);
    jt4= new JTextField(2);
    jt4.setBounds(750,150,30,20);
    jlh= new JLabel();
    jlh.setText("CHALLAN DETAILS");
    jlh.setBounds(300,50,200,20);
    jl1= new JLabel();
    jl1.setText("IGM No. ");
    jl1.setBounds(50,150,100,20);
    jl2= new JLabel();
    jl2.setText("IGM Date ");
    jl2.setBounds(340,150,100,20);
    jl3= new JLabel();
    jl3.setText("Line No. ");
    jl3.setBounds(530,150,100,20);
    jl4= new JLabel();
    jl4.setText("Subline No. ");
    jl4.setBounds(680,150,100,20);
    jl10= new JLabel();
    jl10.setBounds(100,200,300,20);
    ch1= new Choice();
    ch1.setBounds(170,150,150,20);
    getContentPane().add(ch1);
    ch1.addItemListener(new Opt1());
    bt1= new JButton("Exit");
    bt1.setBounds(200,600,100,20);
    getContentPane().add(bt1);
    bt1.addActionListener(new Ex());
    try
    con=db_connect.getConnection();
    Statement st1 = con.createStatement();
    ResultSet rs1 = st1.executeQuery("select igm_no,to_char(igm_dt,'DD-MON-YY'),line_no,subline_no from "+
    "det_item order by igm_no");
    while(rs1.next())
    ch1.addItem(String.valueOf(rs1.getInt(1))+" "+rs1.getString(2)+" "+
    String.valueOf(rs1.getInt(3))+" "+String.valueOf(rs1.getInt(4)));
    rs1.close();
    st1.close();
    catch(Exception e){e.printStackTrace();}
    getContentPane().add(jlh);
    getContentPane().add(jl1);
    getContentPane().add(jt1);
    getContentPane().add(jl2);
    getContentPane().add(jt2);
    getContentPane().add(jl3);
    getContentPane().add(jt3);
    getContentPane().add(jl4);
    getContentPane().add(jt4);
    getContentPane().add(jl10);
    setSize(900,700);
    setVisible(true);
    show();
    public void paint(Graphics g)
    g.setColor(Color.red);
    g.drawLine(0,300,600,300);
    class Ex implements ActionListener
    public void actionPerformed(ActionEvent evt)
    if(evt.getSource() == bt1)
    dispose();
    return;
    This code is incomplete. The program is compiled and Ran. I am unable to see the Line.
    Is it because , I am using contentPane ?. Please help me to cake it clear.
    mjava

    I have no idea what JTutor is, but if it tells you to override paint() in Swing, it's not worth its disk space.
    [http://java.sun.com/docs/books/tutorial/uiswing/painting/closer.html] clearly says that for all practical purposes paintComponent will be the only method that you will ever need to override.

  • Line after window

    How to draw a line after any window in a smartform ,,,,,
    regards,
    Shashank

    In the OUTPUT ATTRIBUTES just click on Windows Box And shading portion and select the lines. this will display the border of the window.
    Regards,
    Amit
    Reward all helpful replies.

  • Show the line after draw with IMAQ selectline.vi in the image display

    hi..
    may i know how to show the line on the image display after i draw the line by using the IMAQ select line.vi??
    i use the the IMAQ select line.vi for drawing few couples of lines...but i don know how to show it all on the image display...
    because i will forget the location of the lines after i draw it by IMAQ select line.vi...
    thanks for help..

    Hey,
    Just use IMAQ Draw.vi
    Christian

  • Brush strokes reshape themselves to smoother lines after I draw them. Solutions?

    I am currently working on a drawing that involves many jagged lines, and I was using a 3pt Pressure brush to work on the outline. However, once I draw the lines and lift my pen off the pad, the lines are reshaped into smoother forms.  Alot of the detail that I am trying to accomplish is smoothed out and taken away, especially with my sharp shapes.  Is there some sort of setting, or something i am missing that will stop this from happening?   
    The pencil tool doesnt do this, and I would probably resort to it since it keeps my lines in tact. However, it sometimes deletes my original line when i draw too close to it, or it connects the lines. In the end, I am going to merge all the lines and marks ive made into one big shape.
    Any suggestions would be appreciated!

    AAA! thank you! i knew there had to be an easy way to get to a solution, but searching the internet for answers is easier said than done. thank you!

  • Here are my last 3 duke dollars.  Can someone please help me draw a line?

    I have been BEATING my head on this for well over a week now. I'm new to Java2D and I cannot find even one example of this simple little thing that I am trying to do. Not one.
    All I want to do is draw an image, zoom that image, then draw some lines on that image, and then zoom it and have those lines show up where they should.
    For example, we have an image which has been zoomed. No lines are yet drawn on it.
    A line is added.
    The image is then zoomed in or out one more time.
    How do we get the line to remap to the newly zoomed image?
    What I am doing is:
    0) Load up an image from a file.
    1) Create a zoomed image by using the Image.getScaledInstance() method.
    2) Create a BufferedImage with the width and height of the image AFTER the zoom has taken place.
    3) Create a Graphics2D object by the createGraphics from this BufferedImage.
    4) Place the image into the BufferedImage by doing a BufferedImage.drawImage
    5) Select two points to be the start and end of the line.
    6) Draw the line using Graphics2D.drawLine(start.x, start.y, end.x, end.y).
    7) Zoom the image again (using the Image.getScaledInstance() method.
    8) Create a new ImageIcon using the image from above and override its paintIcon method like this:
    ImageIcon newIcon = new ImageIcon(newImage) {                       
    public void paintIcon(Component c, Graphics g, int x, int y)
    super.paintIcon(c, g, x, y);
    zoom(); //<---- ZOOM call
    Now in the zoom routine, what do I need to do to get the lines to draw at the proper location and size?
    Remember, the points of the lines (stored in a list as home grown line objects) are in screen coordinates, not image coordinates since they are just click points
    Note that when I use these points to draw a line, all is well (the line gets drawn where it should), but I have problems when I zoom the image.
    Thanks!

    Below is the documentation and method signature of
    Graphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer);The important thing to note is that it does scaling on the fly if the size dictated by the source co-ordinates is defferent than the size dictated by the destination co-ordinates. The source image is always left un-touched.
    So basically your visual data is located in an offscreen image. You can draw a line on that. Then create a new image, get it's graphics and call drawImage(original_image, co-ordinates that cause it to scale how you like).
    Then you can draw lines on the 2nd image, create a 3rd, ...etc
         * Draws as much of the specified area of the specified image as is
         * currently available, scaling it on the fly to fit inside the
         * specified area of the destination drawable surface. Transparent pixels
         * do not affect whatever pixels are already there.
         * <p>
         * This method returns immediately in all cases, even if the
         * image area to be drawn has not yet been scaled, dithered, and converted
         * for the current output device.
         * If the current output representation is not yet complete then
         * <code>drawImage</code> returns <code>false</code>. As more of
         * the image becomes available, the process that draws the image notifies
         * the specified image observer.
         * <p>
         * This method always uses the unscaled version of the image
         * to render the scaled rectangle and performs the required
         * scaling on the fly. It does not use a cached, scaled version
         * of the image for this operation. Scaling of the image from source
         * to destination is performed such that the first coordinate
         * of the source rectangle is mapped to the first coordinate of
         * the destination rectangle, and the second source coordinate is
         * mapped to the second destination coordinate. The subimage is
         * scaled and flipped as needed to preserve those mappings.
         * @param       img the specified image to be drawn
         * @param       dx1 the <i>x</i> coordinate of the first corner of the
         *                    destination rectangle.
         * @param       dy1 the <i>y</i> coordinate of the first corner of the
         *                    destination rectangle.
         * @param       dx2 the <i>x</i> coordinate of the second corner of the
         *                    destination rectangle.
         * @param       dy2 the <i>y</i> coordinate of the second corner of the
         *                    destination rectangle.
         * @param       sx1 the <i>x</i> coordinate of the first corner of the
         *                    source rectangle.
         * @param       sy1 the <i>y</i> coordinate of the first corner of the
         *                    source rectangle.
         * @param       sx2 the <i>x</i> coordinate of the second corner of the
         *                    source rectangle.
         * @param       sy2 the <i>y</i> coordinate of the second corner of the
         *                    source rectangle.
         * @param       observer object to be notified as more of the image is
         *                    scaled and converted.
         * @return   <code>true</code> if the current output representation
         *           is complete; <code>false</code> otherwise.
         * @see         java.awt.Image
         * @see         java.awt.image.ImageObserver
         * @see         java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
         * @since       JDK1.1
        public abstract boolean drawImage(Image img,
                              int dx1, int dy1, int dx2, int dy2,
                              int sx1, int sy1, int sx2, int sy2,
                              ImageObserver observer);

  • How to get the whole map image after zoom in?

    Hi,
    I use mapviewer API to generate map images and put them in JSP as well as in Java Applet. I called the method getGeneratedImage(). After I using the methods zoomIn() or zoomOut(), I got a new map image. But the size is fixed, so after zoom in I can only see a part of the whole map. I would like to use scrollbar to see other part of the map after zoom in.
    How can I solve this problem? I have the images as predefinied themes saved in database with MBR information.
    Thanks in advance.

    Hi,
    For the map request in MapViewer you may define the data area that you want to display, as well as the device size (width and height). The result is a java Image with width and height sizes. You can draw this image on a canvas with scroll bars, and if the size of the canvas is smaller than the image size, then you should see the scroll bars. But you have to code that. MapViewer will just return an Image with the specified size.
    The zoom in/out options just change the data area, but keeps the device size. Therefore you should use the API methods to set the data area (setBox or setCenterAndSize) and to set the device size (setDeviceSize), in order to control the size of your resulted image, and then draw it on your canvas with scroll bars.
    Regards.

  • Drawing 2d line chart problem, urgent please!!!

    Hello,
    can anyone help me with the function GRAPH_MATRIX_2D please,
    i couldn't draw a line graph with three data series, i mean with three lines in the graph.
    i want to the chart to be drawn as line graph at the beginning, i shouldn't have to change the chart type later,
    can anybody send me a sample code that does what i want.
    i am expecting your answers,
    thanks.

    Hi,
    have you checked the two reports Matthias mentioned?
    After downloading the SAP Chart Designer the general procedure should look like: create your chart settings interactively using the designer. Save these settings as a local XML file. Use this XML in your ABAP application and additionally create a data XML at runtime (the format is described in the pdf of the SAP Chart Designer zip).
    Regards, Kai
    PS: Please don't use these very outdated function modules graph_matrix* / grstat* in new projects!

  • Getting Dynamic XPOS and YPOS for drawing the line in MAIN window in SAP Script using BOX command

    Hi Experts,
    I am trying to draw a line using the BOX command in the main window.
    /:         BOX HEIGHT 0 TW FRAME 10 TW INTENSITY 100
    I want to draw a line in XPOS and YPOS dynamically..
    Is there any way to find such I can draw a line dynamically after triggering a Text element. or determine the XPOS and YPOS dynamically such that I can draw a line in an intended position dynamically.
    Thanks in Advance
    Regards
    Rajesh Chowdary Velaga

    Any update on this ??

  • I get a "prohibited" icon when trying to draw flowchart lines.

    Evening all, was hoping someone here could explain my problem to me. Here's what I've done, step by step:
    1. Imported my videos to the project, and created timelines for each of them.
    2. Imported a PSD file, and converted three text layers on it to buttons.
    3. Opened up the Flowchart panel, and tried to drag from my first button to a timelin     e in the little orphanage sub-panel.
    When I try this, I get the little "prohibited" icon Windows gives you when you're not allowed to do something (circle with a slash through it, as on a No Smoking sign), but no explanation as to why. I'm following online tutorials, and notice no difference between what I've done, and what the instructor has successfully done.
    Can someone explain what would prohibit me from drawing flowchart lines this way?

    Yes, the other day I was doing a Menu in PS, and was working with the Type Tool. I went to move the entire Image about, and hit the Spacebar to access the Hand Tool. I kept typing spaces... took a moment to put it all together, the Spacebar only types spaces, with the Type Tool selected. I knew that, but did not put it together, until after I had about 40 spaces.
    Enough Duh! moments for us all.
    Good luck,
    Hunt

  • Drawing dotted lines

    Hey
    I've already figured out how to draw dotted lines so that's not the questions
    the thing is I only need to draw some lines as dotted, some as dashed and all others just normal..
    I figured I could make radiobox to select which line.. then I save that to an array of some sort and then in the paintComponent thing I should make an if to check for array value and change the stoke according to that
    so far I've just made my lines dotted like this
    http://www.jguru.com/faq/view.jsp?EID=114099
    but now everything is dotted.. even the borders around my buttons..
    ni my applet I have some buttons which are connected with a line.. I want that line dotted or dashed when the users wants it to.. and only then otherwise just normal lines
    I couldn't find anything about that on the google =(

    done!
    now I want to be able to use diffrent line style combinations but it doesn't work
    currently it only uses the linestyle that you selected for the first line and then uses that for every line after that too
    this is my code
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              Graphics2D g2d = (Graphics2D)g;
              g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              g2d.setColor(lijnKleur);
              for (int i = 0; i < Main.XList.size(); i++) {
                   int j = (i - 1);
                   int k = (i + 1);
                   int aantal = 0;
                   if ((k % 2 == 0) && (i != 0)) {
                        if (Main.lijnstyleList.get(aantal) == 1){
                             g2d.setStroke(normaal);
                        else if (Main.lijnstyleList.get(aantal) == 2){
                             g2d.setStroke(gestippeld);
                        else if (Main.lijnstyleList.get(aantal) == 3){
                             g2d.setStroke(gestreept);
                        else{
                             g2d.setStroke(normaal);
                        int tmpX_oud = Main.XList.get(j) + (Main.breedte / 2);
                        int tmpY_oud = Main.YList.get(j) + (Main.hoogte / 2);
                        int tmpX = Main.XList.get(i) + (Main.breedte / 2);
                        int tmpY = Main.YList.get(i) + (Main.hoogte / 2);
                        aantal++;
                        if (tmpY_oud > tmpY){
                             tmpY = tmpY + (Main.hoogte / 2);
                             int half = tmpY + (Main.spacing / 2);
                             if ((tmpY_oud != tmpY) && (tmpX_oud != tmpX)) {
                                  g2d.drawLine(tmpX_oud, tmpY_oud, tmpX_oud, half);
                                  g2d.drawLine(tmpX_oud, half, tmpX, half);
                                  g2d.drawLine(tmpX, half, tmpX, tmpY);
                             else{
                                  g2d.drawLine(tmpX_oud, tmpY_oud, tmpX, tmpY);
                             g2d.drawLine(tmpX, tmpY, tmpX - 5, tmpY + 8);
                             g2d.drawLine(tmpX, tmpY, tmpX + 5, tmpY + 8);
                        else if (tmpY_oud < tmpY){
                             tmpY = tmpY - (Main.hoogte / 2);
                             int half = tmpY - (Main.spacing / 2);
                             if ((tmpY_oud != tmpY) && (tmpX_oud != tmpX)) {
                                  g2d.drawLine(tmpX_oud, tmpY_oud, tmpX_oud, half);
                                  g2d.drawLine(tmpX_oud, half, tmpX, half);
                                  g2d.drawLine(tmpX, half, tmpX, tmpY);     
                             else{
                                  g2d.drawLine(tmpX_oud, tmpY_oud, tmpX, tmpY);
                             g2d.drawLine(tmpX, tmpY, tmpX - 5, tmpY - 8);
                             g2d.drawLine(tmpX, tmpY, tmpX + 5, tmpY - 8);
                        else {
                             if (tmpX_oud > tmpX){
                                  tmpX = tmpX + (Main.breedte / 2);
                                  g2d.drawLine(tmpX_oud, tmpY_oud, tmpX, tmpY);
                                  g2d.drawLine(tmpX, tmpY, tmpX + 8, tmpY - 5);
                                  g2d.drawLine(tmpX, tmpY, tmpX + 8, tmpY + 5);
                             else{
                                  tmpX = tmpX - (Main.breedte / 2);
                                  g2d.drawLine(tmpX_oud, tmpY_oud, tmpX, tmpY);
                                  g2d.drawLine(tmpX, tmpY, tmpX - 8, tmpY - 5);
                                  g2d.drawLine(tmpX, tmpY, tmpX - 8, tmpY + 5);
              g2d.setStroke(normaal);
         }**EDIT**
    according to this it can be done..
    http://java.sun.com/developer/JDCTechTips/2003/tt0520.htm
    no clue why mine doesn't work then
    Edited by: Nizzle on Sep 13, 2007 10:15 AM

  • Overflowing one line after my main window box

    hi,
    in my form in main window i designed a box and it holds 24 lines . after the end of the box in first page another one line is
    showing that means i want that 25 th line should go to the next page .how to do it???
    because here by default in my first page it is displaying 25  lines.
    please let me know how to do it???
    my bos i defined like this
    ubb, 12.05.1999 -
    draw the MAIN-BOX v-lines -
                             on every page
    POSITION XORIGIN '-0.5' MM YORIGIN '-0.5' MM
    SIZE WIDTH '1' MM HEIGHT '1' MM
    SIZE WIDTH '284' MM HEIGHT '77' MM
    BOX FRAME 10 TW
    BOX WIDTH '30'  MM  HEIGHT '77' MM  FRAME 10 TW
    BOX WIDTH '85'  MM  HEIGHT '77' MM  FRAME 10 TW
    BOX WIDTH '148' MM  HEIGHT '77' MM  FRAME 10 TW
    BOX WIDTH '167' MM  HEIGHT '77' MM  FRAME 10 TW
    BOX WIDTH '176' MM  HEIGHT '77' MM  FRAME 10 TW
    BOX WIDTH '201' MM  HEIGHT '77' MM  FRAME 10 TW
    BOX WIDTH '214' MM  HEIGHT '77' MM  FRAME 10 TW
    BOX WIDTH '237' MM  HEIGHT '77' MM  FRAME 10 TW
    BOX WIDTH '252' MM  HEIGHT '77' MM  FRAME 10 TW
    DEBASHIS
    BOX WIDTH '284' MM  HEIGHT '77' MM  FRAME 10 TW
    thanks.

    Hi,
    Reduce the Height of The Window and Box
    or increase The font Size
    Automatically The 25 Line will go to next page
    With Regards,
    Vinu.R

Maybe you are looking for