Moving to beginning of line in editor

Okay, this is killing me, and I'm sure it's something really stupid that I'm just missing.
In the editor, how do you move to the beginning of the current line? <end> will take me to the end of line, but <home> doesn't take me back to the beginning.
I've tried multiple combinations of ctrl-home, alt-home, etc. with/without smart-home and smart-end enabled.
Thanks in advance.

Also, Tools -> Preferences -> Code Editor, "Use Smart Home" checkbox will affect the behavior. On Windows with the above checked, hitting Home key once goes to the beginning of text on the line (after tabs/spaces), hitting Home key again jumps to beginning of line (column 1). With above unchecked, hitting Home key once goes to beginning of line (column 1).
Hope that helps,
dfg
PS: I now see that you already discovered smart home, never mind...
Message was edited by:
Indy

Similar Messages

  • [Selection-screen] Begin of line, Icons, Layout, ...

    Hi,
    Is WDA lacking some those very familiar features we have in ABAP Selection-screen? (WDR_TEST_SELECT_OPTIONS application certainly does not show the full scope, is it?)
    Is there a replacement for BEGIN OF LINE in WDA selection-screen?
    What about adding comments?
    Is this possible to add icon or images?
    Besides, I was wondering how it is possible to lay the selection-screen in multiple columns. In tried different layout (Grid, Matrix, ...) without success.
    Lastly, is this possible to put labels on top of input fields?
    Do not hesitate to share your most beautiful selection-screens! 
    Thanks in advance.
    Best regards,
    Guillaume

    Some of the designing things are missing in select options -
    IF_WD_SELECT_OPTIONS~ADD_HORIZONTAL_DIVIDER - > to add a line
    IF_WD_SELECT_OPTIONS`ADD_TEXT_LINE - Add a text based line...
    Regarding alignment we need to work on it..there are layout options using ADD_BLOCK..
    Adding Icon/Symbol - I don't see any option...in the interface

  • Match beginning of line with Regular Expression

    I'm confused about dreamweaver's treatment of the characters
    ^ and $ (beginning of line, end of line) in regex searches. It
    seems that these characters match the beginning of the file, not
    the beginning of the various lines in the file. I would expect it
    to work the other way around. A search like:
    (^.)
    should match every line in the file, so that a find/replace
    could be performed at the beginning of each line, like this:
    HELLO$1
    which would add 'HELLO' at the start of each line in the
    file.
    Instead, this action only matches the first character of the
    file, sticks 'HELLO' in front of it, and then quits (or moves on to
    the next file). The endline character $ behaves in a similar
    fashion, matching only the end of the file, not the end of each
    line.
    I've searched, and all the literature about regular
    expressions in dreamweaver seems to indicate that I'm expecting the
    correct behavior:
    www.adobe.com/devnet/dreamweaver/articles/regular_expressions_03.html
    quote:
    ^ Beginning of input or line ^T matches "T" in "This good
    earth" but not in "Uncle Tom's Cabin"
    $ End of input or line h$ matches "h" in "teach" but not in
    "teacher"
    Thanks for any insight, folks.

    Hi Winston,
    I am still digesting the material from the regular expression book and will take sometime to become proficient with it.
    It seems that using groupCount() to eliminate the unwanted text does not work in this case, since all the lines returned the same value. Ie 3 posted earlier. This may be because the patterns are complex and only a few were grouped together. Otherwise, could you provide an example using the string posted as opposed to a hyperthetic one. In the meantime, at least one solution have been found by defining an additional special pattern “\\A[^%].*\\Z”, before combining / intersecting both existing and the new special pattern to get the best of both world. Another approach that should also work is to evaluate the size of String.split() and only accept those lines with a minimum number of tokens.
    Anyhow, I have come a crossed another minor stumbling block in the mean time with the following line, where some hidden characters is preventing the existing pattern from reading it:
    o;?Mervan Bay 40 Boyde St 7 br t $250,000 X West Park AE
    Below is the existing regular expression that works for other lines with the same pattern but not for special hidden characters such as “o;?”:
    \\A([A-Z][a-z]*){1,2} [0-9]{0,4}/?[0-9]{0,4}-?[0-9]{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La [0-9] br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}\\ZIs it possible to come up with a regular expression to ignore them so that this line could be picked up? Would also like to know whether I could combine both the special pattern “\\A[^%].*\\Z” with existing one as opposed to using 2 separate patterns altogether?
    Many thanks,
    Jack

  • SELECTION-SCREEN: BEGIN OF LINE.

    Hi Friends,
    I've tried for Begin of line comment for my required selection screen input, but I got some run-time errors. Can u help me to give a parameters with 3 text field in a straight line/row with your examples.
    Please adivse
    thanks & regards
    sankar.

    Hi Sankar,
    Try this way.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(10) text-001 FOR FIELD p1.
    SELECTION-SCREEN POSITION 11.
    PARAMETERS:p1  TYPE char5.
    SELECTION-SCREEN COMMENT 17(10) text-002 FOR FIELD p1.
    SELECTION-SCREEN POSITION 28.
    PARAMETERS:p2  TYPE char5.
    SELECTION-SCREEN COMMENT 34(10) text-003 FOR FIELD p1.
    PARAMETERS:p3  TYPE char5.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1.
    Thanks
    Venkat.O

  • SELECT ION-SCREEN COMMENT & BEGIN OF LINE???

    Hi Experts,
    What wuld do the follwoing 2 syntax? I mean, just they print the text on Selection-screen! or any thing else?
    1 - SELECT ION-SCREEN COMMENT
    2-  SELECT ION-SCREEN BEGIN OF LINE
    thanq.
    Message was edited by:
            Sridhar

    See the example :
    SELECT ION-SCREEN COMMENT  - it is for text elements for selection-screen fields.
    When you radio button,text will come right side,if you want to use left side text,then use comment line.
    SELECT ION-SCREEN BEGIN OF LINE
    if you want to use selection-screen fields in same line ,then use this
    selection-screen begin of block b0  with frame title text-b00.
    Data Selection Fields
    selection-screen begin of block b1 with frame title text-001.
    select-options: s_werks     for marc-werks no intervals
                                             obligatory
                                             no-extension
                                             default '1000',
                    s_lgort     for mseg-lgort no intervals
                                             obligatory
                                             no-extension
                                             default '1000',
                    s_prod      for marc-zzproddept ,
                    s_zzdept    for marc-zzdept,
                    s_mtart     for mara-mtart,
                    s_matnr     for mara-matnr,
                    s_lifnr     for mseg-lifnr,
                    s_vmsta     for mvke-vmsta.
    selection-screen end of block b1.
    selection-screen skip.
    Report Type
    selection-screen begin of block b2 with frame title text-002.
    Shelf Life Expiry Report
    selection-screen begin of line.
    selection-screen comment 1(31) text-004.
    parameter:        r_1   radiobutton group rad1.
    selection-screen end of line.
    selection-screen begin of line.
    Aging  Report
    selection-screen comment 1(31) text-005.
    parameter:        r_2   radiobutton group rad1.
    selection-screen comment 40(30) text-003.
    parameter: p_expir as checkbox.
    selection-screen end of line.
    selection-screen begin of line.
    Materials with no Expiry Date
    selection-screen comment 1(31) text-006.
    parameter:        r_3   radiobutton group rad1.
    selection-screen comment 40(30) text-007.
    parameter : p_bin as checkbox ."default 'X'.
    selection-screen end of line.
    selection-screen end of block b2.
    selection-screen end of block b0.

  • Code has moved on to 1 line ??? Please help

    Hi Guys.
    For some reason, all of my code has moved on to 1 line. So I
    now have only 1 line of code instead of 500 lines of code.
    EXAMPLE
    [code]
    <?PHPinclude("dbconnect.php");include("Library/tracker.php");include("Library/Navi.php");i nclude("Library/top_banner.php");include("Library/call_to_action.php");include("Library/fo oter_links.php");include("Library/head.php");$tag
    = 'About BusinessMobiles.com';$url =
    'about_businessmobiles.php';$page = 'about';$sub = '';$num =
    '';$page_name = 'template2';?>
    [/code]
    It should be:
    [code]
    <?PHP
    include("dbconnect.php");
    include("Library/tracker.php");
    include("Library/Navi.php");
    include("Library/top_banner.php");
    include("Library/call_to_action.php");
    include("Library/footer_links.php");
    include("Library/head.php");
    $tag = 'About BusinessMobiles.com';
    $url = 'about_businessmobiles.php';
    $page = 'about';
    $sub = '';
    $num = '';
    $page_name = 'template2';
    ?>
    [/code]
    How do I get it back to the way that it was, as it's
    imposiable to edit like this.
    Thanks for your help.

    jeff spires wrote:
    > For some reason, all of my code has moved on to 1 line.
    So I now have only 1
    > line of code instead of 500 lines of code.
    Edit > Preferences > Code Format. Set Line Break Type
    to LF (Unix).
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Moving to a particular line in a BufferedReader

    Hi,
    I have a bufferred reader that reads lines of text from a file. I would like to move to a particular line in the file. Is there any way to do so?
    My simple code is below. I am familiar with reading text files, but I have an operation that I would like to move to particular lines in the file.
    String curLine;
    while(((curLine = this.rtReader.readLine()) != null)
    }

    As long as you can live with moving forward only you
    can use LineNumberReader
    http://java.sun.com/j2se/1.5.0/docs/api/java/io/LineNum
    erReader.htmlNote that this class requires that the file be read starting at the beginning - it keeps track of the line numbers. (Of course, that is easy to do with a counter, yourself.)

  • Premiere Elements 10 - Moving Pictures to Time Line

    Have version 10 and no manual is available yet, so a simple question im sure.
    I have say 100 pictures that I want to move into my movie, making a slide show of sorts.
    Is there a way to move them all and set the time (or number of frames) that each picture is shown.
    So select all 100 pictures and move to time line and set the time to display each one to 1 second as example.
    Is there a way to select multiple pictures on the time line and set them all to be shown for a specific time.
    I know that a silgle item can be selected on the time line and manualy dragged to make it a specifice time,
    but can this time be entered by entering a time/frames value?  I'd like to change the time on all 100 at the same time.
    My objective is to make a fast moving slide show from pictures, being able to set the on screen time for each one to
    the same value, all at once, not having to select each one on the time line and manually adjust it picture by picture.
    Dave

    Sure is.
    First, before you load the photos into Premiere Elements, go to Edit/Preferences and set the duration for each still. You must do this before you import your pictures because it only affects stills added after you make this change.
    Then, before you bring your pictures in, open them in a program like Photoshop Elements and make sure they are all no larger than 1000x750 pixels. Photo Elements has a batch change feature under the File menu called Process Multiple Files.
    Then use Get Media/From Files and Folders and bring your pictures into your project. If you've got them named in alpha numeric order, they'll appear in the Media panel in the right order and you can grab them all at once and drag them to the timeline. Voila!
    All of this and more is in my books, by the way -- for better or worse, the ONLY manuals for Premiere Elements and the Photo Elements/Premiere Elements combo (aside from Adobe's Classroom in a Book). You can read about it and see some walk-throughs of its new features here:
    http://Muvipix.com/pe10.php

  • Sqlplus, error with some chars at begining of line

    I have a file test.sql with:
    DECLARE
        x varchar(4000);
    BEGIN
        x := 'my test
    # line error 1
    @ line error 2
    end of test';
        dbms_output.put_line(x);
    END;at sqlplus i run it like this
    SQL>@test.sql
    SP2-0734: unknown command beginning "line error..." - rest of line ignored.
    SP2-0310: unable to open file "line.sql"
      8  How can I make sqlplus ignore # and @?
    Add --@ or --# does not solve my problem, because its part of a text.

    >
    How can I make sqlplus ignore # and @?
    >
    It is the @ that is the problem.
    Put an escape character (default \) before the @ or set a new escape char.
    See SET ESCCHAR in the SQL*PLUS doc
    http://docs.oracle.com/cd/E11882_01/server.112/e16604/ch_twelve040.htm#sthref2081
    >
    SET ESCCHAR {@ | ? | % | $ | OFF}
    Specifies a character to be escaped and not interpreted when used in a file name for
    the SPOOL, START, @, RUN and EDIT commands. These special characters are
    translated to the following:
    ■ @ in a filename will be translated to Oracle SID
    ■ ? is translated to Oracle Home in Unix
    ■ % is translated to Oracle Home in Windows
    ■ $ is translated to Oracle Home in certain platforms
    While it is not recommended that these characters are used in filenames, if you have
    legacy files that do use them, it might be useful to include a SET ESCCHAR command
    in your GLogin file to implement it across your site.
    If not escaped, the characters @, ?, % and $ have significance when interpreted and
    cause errors for the SPOOL, START, @, RUN and EDIT commands.
    SET ESCCHAR is set OFF by default.
    Example
    If you include the character ’$’ in your filename, then
    SET ESCCHAR $
    RUN MYFILE$
    behaves normally.

  • Failure to display multiple lines om editor screen

    I converted a form from v 4.5 to 6I. This form(in v 4.5)for a text item that was associated to a editor had a value in the mulit-line property of the property palette = 'False', yet in the 4.5 version multi lines on the editor screen have always been displayed.
    When I converted this same form to 6I, the multi-lines property value was set to 'No'. When I ran the form under 6I, the display of the editor screen was limited to a single line instead of displaying the multi-lines.
    I changed the property for multi-lines from 'No' to 'Yes' and then the multi-lines were displayed under 6I. It appears to me that 4.5 did not care what the value for the multi line property was since it displayed multi-lines even with the value = to 'False'.
    It appears in 6I it does care what the value is since I had to change the value from 'No' to 'Yes'. Is this the case? If it is that's disturbing since we have many forms that utilize an editor and that would mean I have to go into each form and change that value.
    Am I missing something here?
    Any help would be appreciated.

    This is a bug and has been fixed in Patch 3a.
    Apply this patch (Forms 6.0.8.12.x) and it will work.
    Abhijith Unnikannan,
    Oracle Support Services

  • JTextArea + position of cursor from beginning of line

    Hi all,
    I want to find how many characters my cursor is located away from the beginning of a line, in a JTextArea.
    I already know the position of the cursor using the following statement:
    int caret = myJTextArea.getCaretPosition();
    I also use the following method to get the line number the cursor is located (I found it in a forum posting):
    public static int getLineAtCaret(JTextArea textArea)
    int caretPosition = textArea.getCaretPosition();
    Element root = textArea.getDocument().getDefaultRootElement();
    return root.getElementIndex(caretPosition) + 1;

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JFrame {
        JTextArea jta = new JTextArea("Hi all,\nI want to find how many characters "+
             "my cursor is located away from the beginning of a line, in a "+
             "JTextArea.\nI already know the position of the cursor using the "+
             "following statement:\nint caret = myJTextArea.getCaretPosition();"+
             "\nI also use the following method to get the line number the "+
             "cursor is located (I found it in a forum posting):\npublic static "+
             "int getLineAtCaret(JTextArea textArea)\n{\nint caretPosition = "+
             "textArea.getCaretPosition();\nElement root = textArea."+
             "getDocument().getDefaultRootElement();\nreturn root."+
             "getElementIndex(caretPosition) + 1;\n}");
        public Test() {
         setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
         Container content = getContentPane();
         content.add(new JScrollPane(jta), BorderLayout.CENTER);
         JButton jb = new JButton("Do Not Press!!!");
         content.add(jb, BorderLayout.SOUTH);
         jb.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent ae) {
              int cpos = jta.getCaretPosition(), lpos=-1, line=-1;
              try {
                  for (int x=0; x<jta.getLineCount(); x++) {
                   if (jta.getLineStartOffset(x)<=cpos) {
                       line=x;
                       lpos = cpos-jta.getLineStartOffset(x);
                   } else break;
                  System.out.println("line="+line+", col="+lpos);
              } catch (javax.swing.text.BadLocationException ble) {
                  ble.printStackTrace();
         setSize(400,300);
         show();
        public static void main( String args[] ) { new Test(); }
    }

  • [Solved] How do I delete from cursor to beginning of line in Vi?

    I'm wondering if there's a way to delete from the the cursor to the beginning of the current line in Vi, basically doing D backwards.  I would find this very useful, as manually doing this is getting annoying.
    Edit: Of course after days of searching I figure it out right after asking.  It's d0 that I need to type in.
    Last edited by zenten (2012-06-13 17:42:45)

    I saw your thread title and that it was already solved, so I gave myself a little quiz to see if I knew the answer before reading what you wrote.
    Since I use 'd$' to delete to the end of the line, I guessed that it was 'd0' to delete to the beginning of the line. Looks like I was right! Who says Vim isn't intutitive?
    I didn't even know about the 'D' command...

  • I like commas at beginning of line

    How do I prevent Formatter from moving commas to the end?
    How do I run a stored procedure. When i hit the green button for execute, the script opens in a window but I am unable to specify parameters and to actually execute.

    For the formatter: Preferences - Database - SQL Formatter - Oracle Formatting - Edit - Line Breaks - check Before Comma, uncheck After Comma.
    Upon running stored PL/SQL, you see an anonymous block is generated in the dialog. Just change the parameters' initialization from NULL to whatever you like.
    Have fun,
    K.

  • Moved home. New line constant engaged tone and can...

    I moved home last Monday and organised a BT phone line move from my old property to the new one a few weeks prior. I said I did not mind if the phone number changes as I don't use the phone line for calling anyway. I only have it for the sake of broadband.
    So I was told by BT the phone line at my new property should be ready last Friday. Well I tried plugging my phone into the phone socket and all I get is the sound of a constant engaged tone. I cannot make any calls from this. I tried dialling numbers but the engaged tone persists, as if nothing has changed at all. 
    I even unscrewed the BT socket panel to connect my phone to the main test socket and still, the same persistent engaged tone. No different than before.
    Called BT about this and they did a line test and said they could not detect a problem with the line from their end. They said they could send an engineer out but kept giving me a warning that if they send an engineer down here it will cost me £129.99 if it is not BT's fault. They said it could be fallen trees on my end or whatever, and in that case I would be charged. I really don't think it could be fallen trees as I live near the city centre in a mid terrace Victorian house with paved backyard and all my neighbours too have paved yards. There is not a single tree around here growing in anybody's yard. 
    Anyway I decided I'd rather have an engineer see to this than be forced to pay the monthly £29 ish charge to BT for a broadband service I cannot use because of the line being the way it is. So booked an engineer to come yesterday. They said he'd come between 1 - 6 pm. And they kept telling me NOT to call them again regarding this issue. Well the engineer never showed up. At about 5 pm BT called me to say there is a problem with the booking system and said they will rebook another engineer appointment for me today. Said the engineer will come between 8 am  - 1 pm. And once again she finished off by telling me NOT to call BT back about this. Well it's past 11 am now and still no sign of any engineer. 
    Not very happy about this... Sigh.
    Does anyone know what could be going on with my phone line? 

    Please contact NeilO  as requested.
    Make sure that you are logged into the forum, then click on his name, you will see a screen like this. Click on the link as shown below.
    Please do not send them a personal message, as they may not be on duty for a long time, and your message will not be tracked properly.
    For your own security, do not post any personal details, on this forum. That includes any tracking number you are give.
    This is the form you should see when you click on the link. If you do not see this form, then you have selected the wrong link.
    When you submit the form, you will receive an enquiry number, so please keep a note of it
    I would imagine its probably an exchange configuration fault, which should not require a visit. Its quite normal for the Field Technician to visit the excahnge first, and test on the frame.
    You may find that the fault will be cleared within a few hours, once the equipment is sorted.
    There are some useful help pages here, for BT Broadband customers only, on my personal website.
    BT Broadband customers - help with broadband, WiFi, networking, e-mail and phones.

  • Problem!!! Moving point along the line

    hi,
    I need to move the point along the line. I want move this point using mouse.
    My program draws a line and a point that' s on this line.
    Could someone help me.

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.MouseInputAdapter;
    public class TraverseAgain extends JPanel {
        Point2D.Double[] points;
        Point2D.Double p1;
        Point2D.Double p2;
        /** An endPoint of one of the lines is being moved. */
        public void setEndPoint(int index, double x, double y) {
            int start;
            double ratio;
            switch(index) {
                case 0:
                    start = index == 0 ? 1 : 0;
                    ratio = getRatio(p1, start, index);
                    resetMidPoint(p1, points[start], x, y, ratio);
                    break;
                case 1:
                    start = index == 0 ? 1 : 0;
                    ratio = getRatio(p1, start, index);
                    resetMidPoint(p1, points[start], x, y, ratio);
                    start = index == 1 ? 2 : 1;
                    ratio = getRatio(p2, start, index);
                    resetMidPoint(p2, points[start], x, y, ratio);
                    break;
                case 2:
                    start = index == 1 ? 2 : 1;
                    ratio = getRatio(p2, start, index);
                    resetMidPoint(p2, points[start], x, y, ratio);
                    break;
                default:
                    System.out.println("illegal index: " + index);
            points[index].setLocation(x, y);
            repaint();
         * Design assumption/decision:
         * Preserve this ratio when repositioning a midPoint between the
         * end points of its line when one of the end points is being moved.
        private double getRatio(Point2D.Double p, int start, int end) {
            double d1 = points[start].distance(p);
            double d2 = points[start].distance(points[end]);
            return d1 / d2;
        private void resetMidPoint(Point2D.Double p, Point2D.Double end,
                                   double x, double y, double ratio) {
            double dy = y - end.y;
            double dx = x - end.x;
            double theta = Math.atan2(dy, dx);
            double length = end.distance(x, y);
            x = end.x + length*ratio*Math.cos(theta);
            y = end.y + length*ratio*Math.sin(theta);
            p.setLocation(x, y);
        /** A midPoint is being moved. */
        public void setMidPoint(int number, double x, double y) {
            switch(number) {
                case 1:
                    double dx = points[1].x - points[0].x;
                    double dy = points[1].y - points[0].y;
                    if(points[0].x < x && x < points[1].x ||
                       points[1].x < x && x < points[0].x)
                        y = points[0].y + (x - points[0].x)*(dy / dx);
                    else if(points[0].y < y && y < points[1].y ||
                            points[1].y < y && y < points[0].y)
                        x = points[0].x + (y - points[0].y)*(dx / dy);
                    else
                        return;
                    p1.setLocation(x, y);
                    break;
                case 2:
                    dx = points[2].x - points[1].x;
                    dy = points[2].y - points[1].y;
                    if(points[1].x < x && x < points[2].x ||
                       points[2].x < x && x < points[1].x)
                        y = points[1].y + (x - points[1].x)*(dy / dx);
                    else if(points[1].y < y && y < points[2].y ||
                            points[2].y < y && y < points[1].y)
                        x = points[1].x + (y - points[1].y)*(dx / dy);
                    else
                        return;
                    p2.setLocation(x, y);
                    break;
                default:
                    System.out.println("illegal number " + number);
            repaint();
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            if(points == null)
                initGeoms();
            g2.setPaint(Color.blue);
            for(int j = 1; j < points.length; j++)
                g2.draw(new Line2D.Double(points[j-1].x, points[j-1].y,
                                          points[j].x,   points[j].y));
            g2.setPaint(Color.red);
            for(int j = 0; j < points.length; j++)
                mark(points[j], g2);
            g2.setPaint(Color.green.darker());
            mark(p1, g2);
            mark(p2, g2);
        private void mark(Point2D.Double p, Graphics2D g2) {
            g2.fill(new Ellipse2D.Double(p.x-2, p.y-2, 4, 4));
        private void initGeoms() {
            int w = getWidth();
            int h = getHeight();
            points = new Point2D.Double[3];
            points[0] = new Point2D.Double(w/4, h/3);
            points[1] = new Point2D.Double(w/16, h/2);
            points[2] = new Point2D.Double(w*13/15, h*3/4);
            double cx = points[0].x + (points[1].x - points[0].x)/2;
            double cy = points[0].y + (points[1].y - points[0].y)/2;
            p1 = new Point2D.Double(cx, cy);
            cx = points[1].x + (points[2].x - points[1].x)/2;
            cy = points[1].y + (points[2].y - points[1].y)/2;
            p2 = new Point2D.Double(cx, cy);
        public static void main(String[] args) {
            TraverseAgain test = new TraverseAgain();
            PointMover mover = new PointMover(test);
            test.addMouseListener(mover);
            test.addMouseMotionListener(mover);
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(test);
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class PointMover extends MouseInputAdapter {
        TraverseAgain traverseAgain;
        int selectedEndIndex = -1;
        int selectedMidNumber = -1;
        Point2D.Double offset = new Point2D.Double();
        boolean dragging = false;
        final int MIN_DIST = 5;
        public PointMover(TraverseAgain ta) {
            traverseAgain = ta;
        public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            Point2D.Double[] points = traverseAgain.points;
            for(int j = 0; j < points.length; j++) {
                if(points[j].distance(p) < MIN_DIST) {
                    selectedEndIndex = j;
                    rigForDrag(points[j], p);
                    break;
            if(selectedEndIndex == -1) {
                if(traverseAgain.p1.distance(p) < MIN_DIST) {
                    selectedMidNumber = 1;
                    rigForDrag(traverseAgain.p1, p);
                } else if(traverseAgain.p2.distance(p) < MIN_DIST) {
                    selectedMidNumber = 2;
                    rigForDrag(traverseAgain.p2, p);
        private void rigForDrag(Point2D.Double p, Point loc) {
            offset.x = loc.x - p.x;
            offset.y = loc.y - p.y;
            dragging = true;
        public void mouseReleased(MouseEvent e) {
            dragging = false;
            selectedEndIndex = -1;
            selectedMidNumber = -1;
        public void mouseDragged(MouseEvent e) {
            if(dragging) {
                double x = e.getX() - offset.x;
                double y = e.getY() - offset.y;
                if(selectedEndIndex != -1)
                    traverseAgain.setEndPoint(selectedEndIndex, x, y);
                else
                    traverseAgain.setMidPoint(selectedMidNumber, x, y);
    }

Maybe you are looking for

  • Songs Appear in Playlists -randomly

    I have a large library- over 5,000 tracks. Lately, I've noticed that iTunes is displaying large numbers of songs in some of my playlists that I did not put in that playlist. There seems to be no rhyme or reason to why it chooses particular titles to

  • Amber software update

    I have downloaded and installed software amber update two days back but my phone again notifies of an update for download. I don't know why. After the update my lumia 720 gets some added features like Nokia clock in sleep mode, radio, live tv options

  • Import iPhoto 11 to Aperture 3 w/o duplicates

    I have a new Aperture 3 on my MacBook Pro, using OSX Lion.  I have followed the directions for attempting various library additions to the A3.  Has worked fine, using drag and drop and such. I attempted to load some iPhoto images and ran into an odd

  • I can't change the ringtone on my iPhone 4

    I recently changed my wife's incoming ringtone on my phone to one I recorded from a CD.  The default ringtone on my own phone is one I bought from Apple*. Doing this changed the default for ALL incoming calls to the one I set for my wife even though

  • Am i making a huge mistake getting only a 16gb ipad mini?

    basically i have ordered a 16gb ipad mini and thinking now perhaps i should of tried to save up more to get the 32gb. my iphone is 16gb and i want everything i have on my phone on the ipad.  thats all.  i have used 8gb used. so i should be ok right??