Set origin (position) of vi in subpanel

Hello,
I have a problem I don't seem to find the solution for.
I have two vi's. A first vi which has a subpanel, and a second vi which is displayed in the subpanel of the first vi.
I don't have a problem displaying the second vi but I cannot seem to control the origin of the front panel of the second vi.
If I try to set the FP.Origin property of the second vi I get the following error message
     "LabVIEW:  This property is read only while the VI is in a subpanel."
Why do I need this behaviour?
This is a big project with several developers working on it. The individual developers do not have alot of LV knowledge. They can only make changes to the vi's displayed inside the subpanels. It happens frequently that they change something inside the vi (second vi) and they forget to position the front panel back to position 0,0.
When this subvi is then loaded into the subpanel of the main vi, the controls are shifted ... because the vi was not exactly saved in position 0,0.
Preferably I would like to control the origin position when displaying this vi inside the subpanel. Is there a way how this can be accomplished?
Thanks in advance for all the help!

Set the origin before you load it into the subpanel?
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be!

Similar Messages

  • When my Ramp stops the set pops back to its original position...?

    I have a set to which I have attached a Ramp behaviour to swivel it on it's Y axis.
    Its works well, but at the 10 second point when the Ramp Y swivel ends, the set jumps suddenly back to its original position.
    How can I get the set to keep its position as it is at the end of the Ramp behaviour?
    ps: Merry Christmas to all on the forum, and thanks for your help during 2008!

    Or you can use the Spin behavior. The object will stay where it is after the spin is finished.
    Andy

  • Keep Original Position Numbers in Purchase Order Creation

    Hi community, i'm trying to solve the following problem in purchase order creation using BAPI_PO_CREATE1:
    I'm loading a file with several order numbers and positions to be created in R/3. This file has a structure similar to:
    OrderNumber;PositionNumber;Material;Quantity;Unit;.......
    The purchase order is created successfully, but i need to keep original position numbers in the order. i.e:
    Supposing this input file:
    1900;08;993322;10.00;KG.....
    1900;13;994455;12.00;KG.....
    the positions in purchase order are created as
    00010
    00020
    But i need positions to be created as:
    00008
    00013
    Any ideas?????
    Thanks you for your cooperation
    Leonardo

    Hi Leonardo,
       I doubt if that is possible.
    You can have the configuration set up to set the Item Number Interval to  step size like 5,10,15 etc,
    based on this value, your line item number will be
    5,10,15,20...
    10,20,30,40..
    15,30,45,60
    etc.
    to set this value, you should go to SPRO.
    Material Management->Purchase Order->Define Document Types
    Regards,
    Ravi Kanth Talagana

  • Cut/paste text in a new TextFrame, and place it on the text original position

    With this script, the pagraphs with style "_DESTACADOS" are cut and paste in a new TextFrame, but place them in to first page. I need place it on the text original position...
    var myDocument = app.activeDocument;
    var myRegExp = ".+";
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.appliedParagraphStyle = "_DESTACADOS";
    app.findGrepPreferences.findWhat = myRegExp;
    var myFoundItems = myDocument.findGrep(true);
    if(myFoundItems.length != 0){
          for(var myCounter = 0; myCounter < myFoundItems.length; myCounter ++){
              myFoundItem = myFoundItems[myCounter];
              myX1 = myFoundItem.characters.item(0).horizontalOffset;
              myY1 = myFoundItem.characters.item(0).baseline;
              myX2 = myX1 + 50;
              myY2 = myY1 + 50;
                app.selection = myFoundItem;
                    app.cut();
                myTextFrame = myDocument.textFrames.add();
                myTextFrame.geometricBounds = [myY1, myX1, myY2, myX2];
                app.selection = myTextFrame.insertionPoints[0];
                    app.paste(); // Pega el texto del caso encontrado
                myTextFrame.applyObjectStyle(app.activeDocument.objectStyles.item("_Destacados"), true);           
                myTextFrame.fit(FitOptions.FRAME_TO_CONTENT);
    THANKS...

    Hi Marcos Suárez,
                 If you've xml for the indesign document, u can use the following.
    myElement.placeIntoInlineFrame(["8p","6p1"]);
    I hope this code is useful in ur script.
    #include "glue code.jsx"
    var doc = app.activeDocument;
    var myRuleSet = new Array ( new idd)
              with(doc)
                        var elements = xmlElements;
                        __processRuleSet(elements.item(0), myRuleSet)
    function idd()
        var newstyle=doc.objectStyles.add("ObjectStyle1");
        newstyle.appliedParagraphStyle="Ap3";
        newstyle.strokeColor="None";
        newstyle.fillColor="None";
              this.name = "idd"
              this.xpath = "//title/p2"                    //set this xpath value to the xmltree element which u want to set into frame.
              this.apply = function(myElement, myRuleProcessor)
            var txt=myElement.placeIntoInlineFrame(["8p","6p1"]);
            txt.fit(FitOptions.frameToContent);
            txt.applyObjectStyle(newstyle, true);
      return true;
    This will create a textframe around the selected content which u want to do so...
    For more info, refer XMLElement.placeIntoInlineFrame() in Object Model Viewer....
    With Regards,
    Vel.

  • Return the cursor to original position in ABAP List

    There is an interactive List report, clicking on the lines in the main report leads to a secondary report and clicking on the line in secondary report gives a pop up screen. Depnding upon the selection made in pop up screen the data in the seconary report is changed and it again displays the secondary report with the changes but now the cursor is at the line 1 of the seconary report.
    I am unable to set the cursor to the original position in the seconary screen from where the pop up screen was called.
    I have tried to position the curosr using SET CURSOR but it does not help are there any other techniques for setting the curosr or what could have gone in my report which is not allowing me to position the curosr correctly.

    HI Mike
    Thanks for the reply. When I apply the logic to reposition the cursor in the scale range event only one cursor is moving to the zoomed in position. The other cursor remains out of  graph scale. I tried to repeat the same logc but it didn't work.  Could you please tell me how to get the 2nd cursor also in to the scale range. Sorry i'm fairly new to labview. I have attached the pic of what I tried.  Thankyou in advance
    Regards
    Pratheek
    Attachments:
    Capture.PNG ‏18 KB

  • JTable addColumn into original position

    Hi,
    I have wriiten a generic dialog box to allow a user to select the visible columns in a JTable.
    Basically a TableColumnModel is passed to the routine to dynamically create a grid of JCheckBox's using the info from getHeaderValue().
    I create a list of TableColumn's that are in the TableColumnModel so that I can add a removed column back in again.
    My problem is that I cannot add the columns into the required locations.
    In the code below:
    tcm = TableColumnModel
    tc = TableColumn
    col = original position of table column
    public void setColumnStatus(int col, boolean status)
    if (col > -1 && col <= columnNames.length)
    int index = col > tcm.getColumnCount() ? tcm.getColumnCount() : col ;
    if (status)
    tcm.addColumn(tc[col]);
    System.err.println("New Column Index :" + tcm.getColumnIndex(tc[col].getIdentifier()));
    System.err.println("Original Column Index :" + col);
    tcm.moveColumn(tcm.getColumnIndex(tc[col].getIdentifier()), index);
    else
    tcm.removeColumn(tc[col]);
    If I have approached this in the wrong way, I would appreciate some pointers in the right direction.
    Things would be so much easier if they would have implemented an isVisible for TableColumnModel.
    Regards
    Chris

    I can't think of a reference that would be appropriate since I made the solution up during a few quiet minutes.
    I suppose the closest analogy I can imagine at the moment is that of a SortableTableModel (stay with me for this). The sortable table model wraps a table model and reorders its rows without changing the underlying model. This has proven quite effective in the past and is quite easy to use. You're right, though, the concept can be quite confusing.
    Think of the table model being transformed by the sortable table model like this:
    ORIGINAL TABLE MODEL     SORTABLE TABLE MODEL
    1. goodbye               3. adios
    2. see ya                1. goodbye
    3. adios                 2. see ya
    4. ta ta                 4. ta taAll the sortable table model does is maintain a mapping from its row numbers to the wrapped model's row numbers (ie, row 1 is actually row 3)
    I'll post the complete code at the end so that you can have a good look at it.
    What I'm suggesting is that something similar can be done for the table column model but rather than "reordering" them we actually add/remove them. But not actually add/remove them, just wrap them in something that makes them appear to be added/removed.
    If you'd like me to go further into this then I'd be happy to give it a go.
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.TableModel;
    import javax.swing.event.TableModelListener;
    import javax.swing.event.TableModelEvent;
    import java.util.Comparator;
    import java.util.ArrayList;
    import java.util.TreeSet;
    import java.util.Iterator;
    import java.util.HashMap;
    * Wrapper for a table model that provides the ability to sort the rows by the values in a particular column.
    * @author Kevin Seal
    public class SortableTableModel extends AbstractTableModel implements TableModelListener
         protected TableModel tableModel;
         protected int[] sortableColumns;
         protected HashMap comparatorMap;
         private int sortColumn;
         private boolean sortAscending;
         private Comparator comparator;
         private int[] fromModelRow;
         private int[] toModelRow;
         private class ComparableValue implements Comparable
              private Object value;
              private int row;
              private ComparableValue(Object value, int row)
                   this.value = value;
                   this.row = row;
              private int getRow()
                   return row;
              private Object getValue()
                   return value;
              public int compareTo(Object obj)
                   ComparableValue c = (ComparableValue)obj;
                   int i;
                   if(comparator == null)
                        if(value == null)
                        i = (c.getValue() == null)?0:-1;
                        else
                             i = ((Comparable)value).compareTo(c.getValue());
                   else
                        i = comparator.compare(value, c.getValue());
                   if(i == 0)
                        i = c.getRow() - row;
                   return sortAscending?i:-i;
         public SortableTableModel(TableModel tableModel, int[] sortableColumns)
              super();
              this.tableModel = tableModel;
                 this.sortableColumns = new int[sortableColumns.length];
              System.arraycopy(sortableColumns, 0, this.sortableColumns, 0, sortableColumns.length);
              comparatorMap = new HashMap();
              sortColumn = -1;
              // If the underlying data changes - we wanna know about it!!
              tableModel.addTableModelListener(this);
         public void setComparator(int column, Comparator comparator)
              if(!isColumnSortable(column))
                   throw new IllegalArgumentException("Cannot set the Comparator for a column that isn't sortable");
              comparatorMap.put(new Integer(column), comparator);
         public int getRowCount()
              return tableModel.getRowCount();
         public int getColumnCount()
              return tableModel.getColumnCount();
         public boolean isColumnSortable(int column)
              for(int idx = 0; idx < sortableColumns.length; idx++)
                   if(sortableColumns[idx] == column)
                        return true;
              return false;
         public void setSorting(int sortColumn, boolean sortAscending)
              if(!isColumnSortable(sortColumn))
                   throw new IllegalArgumentException("Cannot sort by unsortable column: " + sortColumn);
              this.sortColumn = sortColumn;
              this.sortAscending = sortAscending;
              comparator = (Comparator)comparatorMap.get(new Integer(sortColumn));
              calculateSorting();
              fireTableDataChanged();
         public void clearSorting()
              sortColumn = -1;
              calculateSorting();
              fireTableDataChanged();
         public int getSortColumn()
              return sortColumn;
         public boolean isSortAscending()
              return sortAscending;
         protected void calculateSorting()
              if(sortColumn < 0)
                   toModelRow = null;
                   fromModelRow = null;
                   return;
              ArrayList columnValues = new ArrayList(tableModel.getRowCount());
              for(int row = 0; row < tableModel.getRowCount(); row++)
                   columnValues.add(new ComparableValue(tableModel.getValueAt(row, sortColumn), row));
              TreeSet sortedSet = new TreeSet(columnValues);
              toModelRow = new int[sortedSet.size()];
              fromModelRow = new int[sortedSet.size()];
              int idx = 0;
              int row;
              for(Iterator i = sortedSet.iterator(); i.hasNext(); )
                   row = ((ComparableValue)i.next()).getRow();
                   toModelRow[idx] = row;
                   fromModelRow[row] = idx;
                   idx++;
         public int convertToModelRow(int row)
              if((toModelRow == null) || (row >= toModelRow.length))
                   return row;
              return toModelRow[row];
         public int convertFromModelRow(int row)
              if((fromModelRow == null) || (row >= fromModelRow.length))
                   return row;
              return fromModelRow[row];
         public Object getValueAt(int row, int column)
              return tableModel.getValueAt(convertToModelRow(row), column);
         public void setValueAt(Object value, int row, int column)
              tableModel.setValueAt(value, convertToModelRow(row), column);
         public String getColumnName(int column)
              return tableModel.getColumnName(column);
         public Class getColumnClass(int column)
              return tableModel.getColumnClass(column);
         public boolean isCellEditable(int row, int column)
              return tableModel.isCellEditable(convertToModelRow(row), column);
         public void tableChanged(TableModelEvent e)
              calculateSorting();
              // Since this class is essentially a proxy for the table model we propogate the change of data to
              // all of our registered listeners
              // For now we tell them that all data has changed
              // (the mapping between changes in the underlying model and the sorted view should be implemented later)
              fireTableDataChanged();
    }

  • Applescript bug in setting button positions in iDVD6

    I took the liberty of downloading the project files for Apple's iDVD Companion (http://www.apple.com/applescript/idvd/companion.html) to remove the annoying limitations on setting button positions (the original app would allow a maximum horizontal offset of 512 and vertical offset of 384, which is too constraining in widescreen projects)
    After updating the project in Xcode and fixing some Applescript bugs, I modified the code to allow button positions up to (936, 484) which is the lower right corner in a widescreen project.
    But it turns out Apple hasn't modified iDVD's scripting to allow button positions in excess of (620, 480). No doubt this was set when iDVD was first made scriptable - BEFORE the advent of widescreen projects!
    So in iDVD Companion now, if I set a button position to be (936, 484), the button only moves to (620, 480) and stops. No errors are generated.
    The other curiosity is that in a widescreen project the left hand edge of the screen is not offset 0 but an offset of 80. Explain that!
    I'll report this to Apple.

    Yes, you are right!
    If you write an Applescript to directly address iDVD6 using its Dictionary commands, you can indeed read button positions greater than (620, 480) (eg, if you manually drag a button to the extreme right hand side of a widescreen project) but you can't write button positions greater than (620, 480) - anything over that is truncated.
    Well spotted... definitely a bug.

  • How to set the position in SAP Script

    Hi Professionals,
    Can anyone tell me that How can I set the position of an bitmap Image (after inserting) in SAP Script ?
    by default position is in Left, I need to align it in center or somewhere else.
    Anybody knows, kindly reply!
    Thanks
    Devinder

    Hi,
    But Can we assign a window under another window. Because I want to insert a bmp picture on particular position.
    example:- there is a digital signature and wanted to insert upon a name.
    So, there is a text (which is customer name) and digital signature (in bmp picture format) upon it.
    Thanks
    Devinder

  • I need to set the position of components on a page that contains a MenuBar,

    I need to set the position of components on a page that contains a MenuBar, but MenuBar does not provide a getPreferred size method.
    How can I get the MenuBar's size in AWT?
    Thanks.

    A menubar is not a general component that is added to a frame like any another. It is the specific responsibility of the setMenuBar/setJMenuBar methods to deal with this.

  • How can I keep apps in the order I prefer?  I've rearranged via iTunes but every time I power cycle the phone, the apps go back to their original positions...

    How can I keep apps in the order I prefer?  I've rearranged via iTunes but every time I power cycle the phone, the apps go back to their original positions...

    Hi kelori617,
    If you are having issues organizing the Apps on your iPhone via iTunes, you may want to double-check the steps in the following article and make sure you are syncing any changes to your device:
    iTunes 11 for Mac: Sync and organize iOS apps
    http://support.apple.com/kb/PH12115
    iTunes 11 for Windows: Sync and organize iOS apps
    http://support.apple.com/kb/PH12315
    If all of the steps are correct and the changes still aren't being retained when you restart your iPhone, you may want to make sure your data is backed up, then try restoring your iPhone to factory settings, restore your data from the backup, then test to see if you can organize your apps via iTunes:
    Use iTunes to restore your iOS device to factory settings
    http://support.apple.com/kb/HT1414
    Regards,
    - Brenden

  • Sender File Adapter Can I  set original MessageID like SOAP Adapter??

    Hello,PI Experts!!
    I want to set original messageID(GUID) to Sender File adapter scenario.
    SOAP Adapter can set original messageID with url, about FILE Adapter??
    I think Adapter Module maybe can set original messageID.
    best Regards,
    Yuuki Fujioka.

    Hello,
    Yes, you can get Message ID with any adapter.
    All neccessary information about approach you can find in links below:
    Use getTransformationParameters().
    Accessing Adapter-Specific Attributes
    http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
    Container Object
    http://help.sap.com/saphelp_nw04/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm (String Mapping Runtime Constants: MESSAGE_ID)
    Br,
    Dzmitry

  • Set file position within a for loop, error 1

    Hi, I'm reading from a .sxm file consisting of a large chunk of text followed by binary data for 512x512 images with 4 bytes per pixel
    I’ve managed to successfully identify the start of the binary and read the first image from the file and view it using  "flatten pixmap.vi", so I’m doing something right, however when i try to read the next chunk of image data in the .sxm file using a for loop, set file position keeps churning out ERR (1).
    im at a loss as to whats causing this
    Solved!
    Go to Solution.
    Attachments:
    binaryread3d trouble.vi ‏22 KB
    back panel screenshot.png ‏27 KB

     I closed the file in the loop, doh! ... another morning well spent

  • Set audio position microseconds/Player

    Hay,
    I've made this nifty little class for playing audio:
    import java.io.*;
    import javax.sound.sampled.*;
    public class Player implements LineListener
         // Consts
         public static final float maxVol = 6.0206f;
         public static final float minVol = -80.0f;
         // Vars
         // The AudioInputStream to play
         private AudioInputStream toPlay = null;
         // If the playthread should pause
         private volatile boolean paused = false;
         // If the thingy is playing
         private volatile boolean playing = false;
         // The line
         private volatile SourceDataLine line = null;
         // The thread that will play the sound
         private Thread playThread = null;
         // Construtor
         // Body
         public void play(String toPlay)
              try {
                   // If playing
                   if (playing && paused && (!line.isRunning())) {
                        setPaused(false);
                        // The return so don't play again
                        return;
                   play(new FileInputStream(toPlay));
              } catch (Exception ex) {ex.printStackTrace();}
         public void play(File toPlay) {
              try {
                   // If playing
                   if (playing && paused && (!line.isRunning())) {
                        setPaused(false);
                        // The return so don't play again
                        return;
                   play(new FileInputStream(toPlay));
              } catch (Exception ex) {ex.printStackTrace();}
         public void play(InputStream toPlay) {
              try {
                   // If playing
                   if (playing && paused && (!line.isRunning())) {
                        setPaused(false);
                        // The return so don't play again
                        return;
                   // Get AudioInputStream from given file.
                   this.toPlay = AudioSystem.getAudioInputStream(toPlay);
              } catch (Exception ex) {ex.printStackTrace();}
              // Make the play thread
              playThread = new Thread(new PlayThread());
              // Start it
              playThread.start();
         public void stop()
              // Not playing
              playing = false;
              // If there is a line
              if (line != null)
                   // Close the line
                   line.close();
                   line = null;
              // Distroy the play thread
              playThread = null;
         public void update(LineEvent e)
              // Stop
              if (e.getType()==LineEvent.Type.STOP)
                   stop();
         // Getters
         public SourceDataLine getLine()
              if (line != null)
                   return line;
              return null;
         public float getVolume()
              FloatControl con = (FloatControl) line
                        .getControl(FloatControl.Type.MASTER_GAIN);
              // Get value
              return con.getValue();
         public boolean getMute()
              BooleanControl con = (BooleanControl) line
                        .getControl(BooleanControl.Type.MUTE);
              // Get
              return con.getValue();
         // Setters
         public void setPaused(boolean inPaused)
              paused = inPaused;
              // If not null
              if (line != null)
                   // If paused
                   if (paused)
                        // Stop the line
                        line.stop();
                   } // Resume
                   else
                        // Start
                        line.start();
         // Setters
         public void setVolume(float vol)
              // TODO: Maybe test to see if within min an max
              FloatControl con = (FloatControl) line
                        .getControl(FloatControl.Type.MASTER_GAIN);
              // Set value
              con.setValue(vol);
         public void setMute(boolean mute)
              BooleanControl con = (BooleanControl) line
                        .getControl(BooleanControl.Type.MUTE);
              // Set
              con.setValue(mute);
         private class PlayThread implements Runnable
              public void run()
                   try {
                        System.out.println("toPlay is null " + (toPlay == null));
                        // If not playing
                        if (!playing)
                             // Now playing
                             playing = true;
                             play();
                        System.out.println("Finished");
                   } catch (Exception ex) {ex.printStackTrace();}
              private void play()
                   try {
                        AudioInputStream din = null;
                        if (toPlay != null)
                             AudioFormat baseFormat = toPlay.getFormat();
                             AudioFormat decodedFormat = new AudioFormat(
                                       AudioFormat.Encoding.PCM_SIGNED, baseFormat
                                                 .getSampleRate(), 16, baseFormat
                                                 .getChannels(),
                                       baseFormat.getChannels() * 2, baseFormat
                                                 .getSampleRate(), false);
                             // Get AudioInputStream that will be decoded by underlying
                             // VorbisSPI
                             din = AudioSystem
                                       .getAudioInputStream(decodedFormat, toPlay);
                             // Play now !
                             rawplay(decodedFormat, din);
                             toPlay.close();
                   } catch (Exception e) {e.printStackTrace();}
              private void rawplay(AudioFormat targetFormat, AudioInputStream din)
                        throws IOException, LineUnavailableException
                   byte[] data = new byte[4096];
                   line = getLine(targetFormat);
                   if (line != null)
                        // Start
                        line.start();
                        int nBytesRead = 0, nBytesWritten = 0;
                        while (nBytesRead != -1)
                             // While still paused
                             while (paused) {}
                             nBytesRead = din.read(data, 0, data.length);
                             if (nBytesRead != -1)
                                  nBytesWritten = line.write(data, 0, nBytesRead);
                        // Stop
                        line.drain();
                        line.stop();
                        line.close();
                        din.close();
              private SourceDataLine getLine(AudioFormat audioFormat)
                        throws LineUnavailableException
                   SourceDataLine res = null;
                   DataLine.Info info = new DataLine.Info(SourceDataLine.class,
                             audioFormat);
                   res = (SourceDataLine) AudioSystem.getLine(info);
                   res.open(audioFormat);
                   return res;
    }I've got an app that uses JMF to play MP3's, but using JMF just to play MP3's is overkill, but I've found a SPI from javaZoom now, so that's okay.
    Anyway, I want to set the position of the line in microseconds now, as well as get the duration.
    Can anyone help with this?
    By the way, if anyone can open .rar files (lots of complainants about that) then the, in much need of an update, app is here: http://acquiesce.awardspace.co.uk/Projects/Download/Music_Exploder.rar
    I you do want to try it, you do need the JMF.
    Why not pop into the forum as well:
    http://acquiesce.informe.com/mucic-exploder-dc4.html
    You know I need the comments.
    Luke :D

    okay, so u can do this in the Clip interface, but the Clip takes ages to open, at lest for mp3's.
    I need it to open it right away
    I understand a bit more now, the SourceDataLine plays each byte as it is writen which is why it plays it straight away, but the Clip loads it into memory, so therefore it knows how long, how many frames etc about the audio, but it means that it's not as fast as streaming.
    I need the best of both worlds really, I've tried opening a Clip on another Thread as well as playing from a SourceDataLine, the idea was to have the Clip take over the playing once it has loaded, but the line doesn't play or read/write.
    Is there someway to take advantage of both streaming an non-streaming in this way?
    Or simply make the Clip.open_AudioImputStream) faster?
    Thanks
    Luke

  • After editing a photo in another program, the photos return to the library at the end of the grid panel instead of at their original loacation.  How do I avoid this or alternatively, is there a quick way of moving them back to their original position inst

    After editing a photo in another program, the photos return to the library at the end of the grid panel instead of at their original loacation.  How do I avoid this or alternatively, is there a quick way of moving them back to their original position instead of clicking and dragging them?

    Sort your photos by File Name or Capture Date
    Use View->Sort

  • Setting Cursor position

    Pls help me for the following query:
    how to set cursor position at the beginning of text field(JTextField) after setting text inside it.

    RTFM
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/text/JTextComponent.html#setCaretPosition(int)

Maybe you are looking for