JButton array with NetBeans 6.1

Hi,
I am relatively new to Java and NetBeans.
I have the following problem; wish someone could help me.
I need to create an array of 30 buttons programatically, on a Panel, namely pnlButtonPack. I have created this panel using NetBeans 6.1 GUI builder, along with several other components which are on other panels, frames and so on.
All the 30 buttons are with same behaviour and I need only the index of the button that a user presses to trigger different actions. Thus, one ActionListner
for the entire array.
I know how to create the button array if I were to create it purely on the code editor, the relevent portion of the code being;
JButton[] btnNumbers = new JButton[30];
    JTextField txtDisplay = new JTextField();
     for (int i = 0; i < btnNumbers.length; i++){
             String text = String.valueOf(i);
             JButton btn = new JButton( text );
             btn.addActionListener( this );
             btn.setMnemonic( text.charAt(0) );
             btnNumbers[i] = btn;
             pnlButtonPack.add( btn );
      public void actionPerformed(ActionEvent e){
            JButton source = (JButton)e.getSource();
            txtDisplay.replaceSelection( source.getActionCommand());
       }How can I do this on NetBeans ?
The guarded code does not allow me to insert my code at the appropriate places. (The "code" pane in the component Properties window is ****, it inserts my code at wrong places).
One option is to drag and drop 30 buttons on my panel, but that idea and the resulting code would be rediculous.
Another option would be to design the whole GUI from scratch on the code editor but that defeats the purpose of using NetBeans in the first place.
Your kind advice on this is highly appreciated please.

ViKARLL wrote:
Thanks for your prompt response morgalr.
Yes, I agree. But the moment I make any change elsewhere on the GUI through NetBeans, all my manual coding vanishes (as they warn in their Help)
Of course I can cut and paste the entire code to another plain Java Class in NetBeans itself. But then my point is that, the whole purpose of using an IDE with a GUI builder is defeated ?
Isn't there some way for me to introduce components programatically to a UI through NetBeans on the same GUI builder's editable coding areas ??The problem you are encountering is exactly why I quit using GUI Builders about 8+ years ago. I, after much frustrations and searching, finally decided that if I wanted to use a GUI Builder, then at the point it ceased to do what I needed--like where you are--then I'd just take the code from the .java file and include it in my project and be done with the AutoGen of that piece from that point (The code is actually gened in a file down on your drive that you can include and not have to copy/paste the entire file into your project.)
What I do now, is I usually just manually code it, I don't find it any slower than using the GUI builder, and me being a control freak, I enjoy it a lot more.
BTW: VB has a lot of the same type of problems, including ophaning code fragments. I've done a lot of VB/C/C++/C# with MS tools and that is where I started not enjoying the AutoCoding.

Similar Messages

  • How to create Componet array in NetBean?

    I want to create ten or more text field with same format.
    Also want to use NetBean to done it with out typing the code self.
    How can I do?
    I mean whether easy and fast method to create componet array in netbean.

    I want to create ten or more text field with same
    format.
    Also want to use NetBean to done it with out typing
    the code self.Why not? because it's the fastest, simplest and safest way.
    How can I do?
    I mean whether easy and fast method to create
    componet array in netbean.Just like oyu'd do it without Netbeans.
    If you still want to do it in Netbeans, I suggest reading the manual. This is not a Netbeans product support forum, and I'm definitely not inclined to help as you don't want it done by writing code yourself.

  • Incompatibility of array with list

    I have three business classes. One is person which has attribute name of string type and a ArrayList of phone class. Phone class itself has one attribute of string type with name of "number". My third class is Patient which is inherited from Person class and has attribute id of string type. All these classes has setter and getter method except in Phone class which has setter and getter methods for array of Phone class because web services does not support collection in rpc literal mode. I have developed a service class which expose a method of insertPatient with parameter of Patient class. But there is an exception of ArrayIndexOutOf Bound Exception. Application server is JBoss and i m compiling my webservices with Netbeans. What can be problem please response me. I m giving structure of my classses
    package com.catalisse;
    import java.io.*;
    import java.util.*;
    * @author Amer Sohail
    public class Person implements Serializable
    private String name = null;
    private ArrayList phoneList = new ArrayList();
    /** Creates a new instance of Person */
    public Person()
    public void setName(String name)
    System.out.println("setting Name"+ name);
    this.name = name;
    public String getName()
    return this.name;
    public void setPhone(Phone[] phone)
    System.out.println("setting the Phone number"+ phone.length);
    if(phone.length > 0){
    System.out.println("Another statement here::: sara khan::: "+ phone[phone.length-1]);
    for (int i = 0; i < phone.length; i++)
    if (phone[i] != null)
    phoneList.add(phone);
    else
    System.out.println("value not found on index " + i);
    //this.phArray = phone;
    // this.phoneList = phone;
    // public void setPhone(Phone phone)
    // if (phone != null)
    // phoneList.add(phone);
    // else
    // System.out.println("yaar i m null" );
    public Phone[] getPhone()
    Phone ph[] = new Phone[phoneList.size()];
    for (int i = 0; i < phoneList.size();i++)
    Phone phone = (Phone)phoneList.get(i);
    if (phone != null)
    ph[i] = (Phone)phoneList.get(i);
    else
    System.out.println("no value");
    return ph;
    package com.catalisse;
    import java.io.*;
    * @author Amer Sohail
    public class Phone implements Serializable
    private String number;
    /** Creates a new instance of Phone */
    public Phone()
    public void setNumber(String number)
    this.number = new String();
    System.out.println("from client number = "+ number);
    this.number = number;
    System.out.println("on server number = "+ this.number);
    public String getNumber()
    return this.number;
    package com.catalisse;
    import java.io.*;
    * @author Amer Sohail
    public class Patient extends Person implements Serializable
    private String id = null;
    /** Creates a new instance of Patient */
    public Patient()
    public void setID(String id)
    this.id = id;
    public String getID()
    return this.id;
    package com.catalisse;
    * This is the service endpoint interface for the PatientWSweb service.
    * Created Sep 20, 2005 8:18:49 PM
    * @author Amer Sohail
    public interface PatientWSSEI extends java.rmi.Remote
    * Web service operation
    public com.catalisse.Patient getPatient() throws java.rmi.RemoteException;
    * Web service operation
    public String insertPatient(com.catalisse.Patient patient) throws java.rmi.RemoteException;
    public class PatientWSImpl implements PatientWSSEI
    // Enter web service operations here. (Popup menu: Web Service->Add Operation)
    * Web service operation
    public com.catalisse.Patient getPatient()
    Patient p = new Patient();
    p.setID("1");
    p.setName("amer");
    Phone ph[] = new Phone[2];
    Phone phone1 = new Phone();
    phone1.setNumber("12345");
    ph[0] = phone1;
    phone1 = new Phone();
    phone1.setNumber("4555");
    ph[1] = phone1;
    p.setPhone(ph);
    return p;
    * Web service operation
    public String insertPatient(com.catalisse.Patient patient)
    System.out.println("Name = " + patient.getName());
    System.out.println("ID = " + patient.getID());
    Phone[] ph = patient.getPhone();
    System.out.println("I am called");
    if (ph != null && ph.length != 0)
    System.out.println("phone = " + ph[0].getNumber());
    System.out.println("ID = " + ph[1].getNumber());
    return "inserted";
    I am waiting for reply

    Isn't ph supposed to be a phone array and you are assigning it to a single Phone in this line?
    public Phone[] getPhone()
    Phone ph[] = new Phone[phoneList.size()];
    for (int i = 0; i < phoneList.size();i++)
    Phone phone = (Phone)phoneList.get(i);
    if (phone != null)
    ph = (Phone)phoneList.get(i);
    else
    System.out.println("no value");
    return ph;
    }

  • Serious problems on GUI with NetBeans.....

    package supershare;
    import java.awt.event.*;
    import javax.swing.*;
    public class testGUI extends javax.swing.JFrame implements java.awt.event.ActionListener{
        public testGUI(){initComponents();}
    public void initComponents(){/*Generated Code*/}
    public static void main(String args[]) {
                    new testGUI().setVisible(true);
      public void actionPerformed(ActionEvent e)
            /*JProgressBar jp = new JProgressBar(0, 100);
            jp.setValue(0);
            jp.setStringPainted(true);
            this.add(jp);
            this.validate();*/
            this.remove(jButton1);
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        // End of variables declaration
    }Above is the code I made under NetBeans....
    As you know, NetBeans has a function called "JFrameForm", which allows you to design GUI more conviniently....
    if you are familar with NetBeans, you can easily understand the above code...
    You know what I am trying to do is that when I click the button, the button should disappear, but it doesnot....
    please help here... actually, I have a bigger project meeting this problem.. and if I have to design the whole project without using NetBeans's JFrameForm function, it will be a nightmare...yes, lots of work...
    Apreciate any help
    thanks

    Has any one here used NetBeans before???
    It has nothing to do with netbeans (except the layout manager you used happens to come with it)
    You need to understand what you are doing in terms of LayoutManagers and Containers. You cannot just add a Component to a Container with anything but the simplest layout manager - you need to understand the constraints the manager uses. In this case, I designed my JFrame using the Netbeans designer (which is most cool I must say) and added a JPanel to act as an area to add and remove components from (so I don't have to understand the GroupLayout constraints).
    Be forewarned that GroupLayout is not (as of yet) part of the standard jdk and you may have issues trying to distribute your application or run it outside of netbeans unless you know what you are doing or netbeans does it for you (I haven't tried yet)
    Good luck
    import java.awt.BorderLayout;
    import javax.swing.JProgressBar;
    * @author  Ian Schneider
    public class NewJFrame extends javax.swing.JFrame {
        /** Creates new form NewJFrame */
        public NewJFrame() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jButton1 = new javax.swing.JButton();
            jPanel1 = new javax.swing.JPanel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("Press Me");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jPanel1.setLayout(new java.awt.BorderLayout());
            jPanel1.setName("progressArea");
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                    .addContainerGap()
                    .add(jButton1)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)
                    .addContainerGap())
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                        .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            pack();
        // </editor-fold>
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
            final JProgressBar jpb = new JProgressBar(0,100);
            jPanel1.add(jpb,BorderLayout.CENTER);
            jPanel1.validate();
            jPanel1.repaint();
            Runnable task = new Runnable() {
                public void run() {
                    jButton1.setEnabled(false);
                    for (int i = 0; i < 100; i++) {
                        jpb.setValue(i);
                        try {
                            Thread.sleep(50);
                        } catch (InterruptedException ie) {}
                    jButton1.setEnabled(true);
                    jPanel1.remove(jpb);
                    jPanel1.validate();
                    jPanel1.repaint();
            new Thread(task).start();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NewJFrame().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JPanel jPanel1;
        // End of variables declaration
    }

  • Lots of blank space when printing array with only last element printed

    I have a slight problem I have been trying to figure it out for days but can't see where my problem is, its probably staring me in the face but just can't seem to see it.
    I am trying to print out my 2 dimensional array outdie my try block. Inside the trying block I have two for loops in for the arrays. Within the second for loop I have a while to put token from Stringtokeniser into my 2 arrays. When I print my arrays in this while bit it prints fine however when I print outside the try block it only print the last element and lots of blank space before the element.
    Below is the code, hope you guys can see the problem. Thank you in advance
       import java.io.*;
       import java.net.*;
       import java.lang.*;
       import java.util.*;
       import javax.swing.*;
       public class javaflights4
          public static final String MESSAGE_SEPERATOR  = "#";
          public static final String MESSAGE_SEPERATOR1  = "*";
          public static void main(String[] args) throws IOException
             String data = null;
             File file;
             BufferedReader reader = null;
             file = new File("datafile.txt");
             String flights[] [];
                   //String flightdata[];
             flights = new String[21][7];
             int x = 0;
                   //flightdata = new String[7];
             int y = 0;
             try
                reader = new BufferedReader(new FileReader(file));   
                //data = reader.readLine();   
                while((data = reader.readLine())!= null)   
                   data.trim();
                   StringTokenizer tokenised = new StringTokenizer(data, MESSAGE_SEPERATOR1);
                   for(x = 0; x<=flights.length; x++)
                      for(y = 0; y<=flights.length; y++)
                         while(tokenised.hasMoreTokens())
                            //System.out.println(tokenised.nextToken());
                            flights [x] [y] = tokenised.nextToken();
                            //System.out.print("*"+ flights [x] [y]+"&");
                   System.out.println();
                catch(ArrayIndexOutOfBoundsException e1)
                   System.out.println("error at " + e1);
                catch(Exception e)
                finally
                   try
                      reader.close();
                      catch(Exception e)
             int i = 0;
             int j = 0;
             System.out.print(flights [j]);
    //System.out.println();

    A number of problems.
    First, I bet you see a lot of "error at" messages, don't you? You create a 21x7 array, then go through the first array up to 21, going through the second one all the way to 21 as well.
    your second for loop should go to flights[x].length, not flights.length. That will eliminate the need for ArrayIndexOutOfBounds checking, which should have been an indication that you were doing something wrong.
    Second, when you get to flights[0][0] (the very first iteration of the inner loop) you are taking every element from the StringTokenizer and setting flights[0][0] to each, thereby overwriting the previous one. There will be nothing in the StringTokenizer left for any of the other (21x7)-1=146 array elements. At the end of all the loops, the very first element in the array (flights[0][0]) should contain the last token in the file.
    At the end, you only print the first element (i=0, j=0, println(flight[ i][j])) which explains why you see the last element from the file.
    I'm assuming you have a file with 21 lines, each of which has 7 items on the line. Here is some pseudo-code to help you out:
    count the lines
    reset the file
    create a 2d array with the first dimension set to the number of lines.
    int i = 0;
    while (read a line) {
      Tokenize the line;
      count the tokens;
      create an array whose size is the number of tokens;
      stuff the tokens into the array;
      set flights[i++] to this array;
    }

  • How can I get a single jar file with NetBeans?

    How can I get a single jar file with NetBeans?
    When I create the project I get these files:
    dist/lib/libreria1.jar
    dist/lib/libreria2.jar
    dist/software.jar
    The libraries that have been imported to create the project are in separate folders:
    libreria1/libreria1.jar
    libreria2/libreria2.jar
    libreria1, libreria2, dist folders are all located inside the project folder.
    I added the following code to the build.xml:
    <target name="-post-jar">
    <jar jarfile="dist/software.jar">
    <zipfileset src="${dist.jar}" excludes="META-INF/*" />
    <zipfileset src="dist/lib/libreria1.jar" excludes="META-INF/*" />
    <zipfileset src="dist/lib/libreria2.jar" excludes="META-INF/*" />
    <manifest>
    <attribute name="Main-Class" value="pacco.classeprincipale"/>
    </manifest>
    </jar>
    </target>
    Of course there is also the project folder:
    src/pacco/classeprincipale.form
    src/pacco/classeprincipale.java
    Can you tell me what is wrong? The error message I get is as follows:
    C:...\build.xml:75: Problem creating jar: archive is not a ZIP archive BUILD FAILED (total time: 2 seconds)

    This is not a NetBeans forum, it is a JDeveloper forum. You might want to try http://forums.netbeans.org/. I also saw your other question - try looking in the New to Java forum: New To Java

  • Auto-indexing is slow for arrays with 1 dimensions

    Hi,
    I was looking at the performance of operations on all individual elements in 3D arrays, especially the difference between auto-indexing (left image) and manual-indexing (right image, calling "Index array" and "Replace array subset" in the innermost loop). I'm a bit puzzled by the results and post it here for discussion and hopefully somebody's benefit in the future.
    Left: auto-indexing; right: manual-indexing
    In the tests I added a different random number to all individual elements in a 3D array. I found that auto-indexing is 1.2 to 1.5 times slower than manual-indexing. I also found that the performance of auto-indexing is much more dependent on the size the dimensions: an array with 1000x200x40 elements is 20% slower than an array with 1000x40x200 elements. For manual-indexing there is hardly any difference. The detailed results can be found at the end of this post.
    I was under the impression that auto-indexing was the preferred method for this kind of operation: it achieves exactly the same result and it is much clearer in the block diagram. I also expected that auto-indexing would have been optimized in LabView, but the the tests show this is clearly not the case.
    What is auto-indexing doing?
    With two tests I looked at how auto-index works.
    First, I looked if auto-indexing reorganizes the data in an inefficient way. To do this I made a method "fake-auto-indexing" which calls "Array subset" and "Reshape array" (or "Index array" for a 1D-array) when it enters _every_ loop and calls "Replace array subset" when exiting _every_ loop (as opposed to manual-indexing, where I do this only in the inner loop). I replicated this in a test (calling it fake-auto-indexing) and found that the performance is very similar to auto-indexing, especially looking at the trend for the different array lengths.
    Fake-auto-indexing
    Second, I looked if Locality of reference (how the 3D array is stored in memory and how efficiently you can iterate over that) may be an issue. Auto-indexing loops over pages-rows-columns (i.e. pages in the outer for-loop, rows in the middle for-loop, columns in the inner for-loop). This can't be changed for auto-indexing, but I did change it for manual and fake-indexing. The performance of manual-indexing is now similar to auto-indexing, except for two cases that I can't explain. Fake-auto-indexing performs way worse in all cases.
    It seems that the performance problem with auto-indexing is due to inefficient data organization.
    Other tests
    I did the same tests for 1D and 2D arrays. For 1D arrays the three methods perform identical. For 2D arrays auto-indexing is 15% slower than manual-indexing, while fake-auto-indexing is 8% slower than manual-indexing. I find it interesting that auto-indexing is the slowest of the three methods.
    Finally, I tested the performance of operating on entire columns (instead of every single element) of a 3D array. In all cases it is a lot faster than iterating over individual elements. Auto-indexing is more than 1.8 to 3.4 times slower than manual-indexing, while fake-auto-indexing is about 1.5 to 2.7 times slower. Because of the number of iterations that has to be done, the effect of the size of the column is important: an array with 1000x200x40 elements is in all cases much slower than an array with 1000x40x200 elements.
    Discussion & conclusions
    In all the cases I tested, auto-indexing is significantly slower than manual-indexing. Because auto-indexing is the standard way of indexing arrays in LabView I expected the method to be highly optimized. Judging by the tests I did, that is not the case. I find this puzzling.
    Does anybody know any best practices when it comes to working with >1D arrays? It seems there is a lack of documentation about the performance, surprising given the significant differences I found.
    It is of course possible that I made mistakes. I tried to keep the code as straightforward as possible to minimize that risk. Still, I hope somebody can double-check the work I did.
    Results
    I ran the tests on a computer with a i5-4570 @ 3.20 GHz processor (4 cores, but only 1 is used), 8 GB RAM running Windows 7 64-bit and LabView 2013 32-bit. The tests were averaged 10 times. The results are in milliseconds.
    3D-arrays, iterate pages-rows-columns
    pages x rows x cols : auto    manual  fake
       40 x  200 x 1000 : 268.9   202.0   268.8
       40 x 1000 x  200 : 276.9   204.1   263.8
      200 x   40 x 1000 : 264.6   202.8   260.6
      200 x 1000 x   40 : 306.9   205.0   300.0
     1000 x   40 x  200 : 253.7   203.1   259.3
     1000 x  200 x   40 : 307.2   206.2   288.5
      100 x  100 x  100 :  36.2    25.7    33.9
    3D-arrays, iterate columns-rows-pages
    pages x rows x cols : manual  fake
       40 x  200 x 1000 : 277.6   457       
       40 x 1000 x  200 : 291.6   461.5
      200 x   40 x 1000 : 277.4   431.9
      200 x 1000 x   40 : 452.5   572.1
     1000 x   40 x  200 : 298.1   460.4     
     1000 x  200 x   40 : 460.5   583.8
      100 x  100 x  100 :  31.7    51.9
    2D-arrays, iterate rows-columns
    rows  x cols  : auto     manual   fake
      200 x 20000 :  123.5    106.1    113.2    
    20000 x   200 :  119.5    106.1    115.0    
    10000 x 10000 : 3080.25  2659.65  2835.1
    1D-arrays, iterate over columns
    cols   : auto  manual  fake
    500000 : 11.5  11.8    11.6
    3D-arrays, iterate pages-rows, operate on columns
    pages x rows x cols : auto    manual  fake
       40 x  200 x 1000 :  83.9   23.3     62.9
       40 x 1000 x  200 :  89.6   31.9     69.0     
      200 x   40 x 1000 :  74.3   27.6     62.2
      200 x 1000 x   40 : 135.6   76.2    107.1
     1000 x   40 x  200 :  75.3   31.2     68.6
     1000 x  200 x   40 : 133.6   71.7    108.7     
      100 x  100 x  100 :  13.0    5.4      9.9
    VI's
    I attached the VI's I used for testing. "ND_add_random_number.vi" (where N is 1, 2 or 3) is where all the action happens, taking a selector with a method and an array with the N dimensions as input. It returns the result and time in milliseconds. Using "ND_add_random_number_automated_test.vi" I run this for a few different situations (auto/manual/fake-indexing, interchanging the dimensions). The VI's starting with "3D_locality_" are used for the locality tests. The VI's starting with "3D_norows_" are used for the iterations over pages and columns only.
    Attachments:
    3D_arrays_2.zip ‏222 KB

    Robert,
    the copy-thing is not specific for auto-indexing. It is common for all tunnels. A tunnel is first of all a unique data space.
    This sounds hard, but there is an optimization in the compiler trying to reduce the number of copies the VI will create. This optimization is called "in-placeness".
    The in-placeness algorithm checks, if the wire passing data to the is connected to anything else ("branch"). If there is no other connection then the tunnel, chance is high that the tunnel won't create an additional copy.
    Speaking of loops, tunnels always copies. The in-placeness algorithm cannot opt that out.
    You can do a small test to elaborate on this: Simply wire "0" (or anything less than the array sizy of the input array) to the 'N' terminal.......
    Norbert
    PS: Auto-indexing is perfect for a "by element" operation of analysis without modification of the element in the array. If you want to modify values, use shift registers and Replace Array Subset.
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Unable to plot 1-D array with a cluster of 2 elements on an XY graph

    I'm Unable to plot a 1-D array with a cluster of 2 elements on an XY graph. The data appears at the input to the graph but nothing is plotted. I'm trying to plot a line connecting each point generated.
    Solved!
    Go to Solution.
    Attachments:
    TEST11.vi ‏13 KB

    Chuck,
    0. Do not post VIs with infinite loops! Change the True constant to a control.  One of the regular participants on these Forums has commented that using the Abort button to stop a VI is like using a tree to stop a car.  It works, but may have undesired consequences!
    1. Use a shift register on the For loop also.
    2. Inserting into an empty array leaves you with an empty array.  Initialize the array outside the loop to a size greater or equal to the maximum size you will be using.  Then use Replace Array Subest inside the loop.
    3. Just make an array of the cluster of points.  No need for the extra cluster.
    Lynn
    Attachments:
    TEST11.2.vi ‏11 KB

  • Need Help With NetBeans (Java Studio Enterprise 8)'s code generation

    Hi!
    I am using Java Studio Enterprise 8 with NetBeans 4.1 IDE bundled together with it. When trying to create GUI out from NetBeans Form Designer, I don't like the way it generates the code. When I try to use a JTextField, it uses "Fully Qualifed Class Names" (e.g: javax.swing.JTextField) on the code. How do I set NetBeans not to use it but rather use only the class name and generate import lines on top of the code? Also, how do I set it up that it will generate the variable declarations (which is on the uneditable blue portion of the code) on top rather than the default which is placed at the bottom of the class code body. I have tried tweaking the Options menu of this IDE but haven't got any luck...
    Hope you could help, and thanks in advance!

    To address the location of the var decl codegen section (or any codegen location issues), there is a workaround, admittedly, it is a bit tedious.
    Once the form code is generated, as Kris mentioned, open the class in an external editor so that you can edit the generated code.
    Then cut the entire var declaration section along with the begin/end gen-code markers and paste it to the section of the file you desire.
    When you add more components to your form, the codegen will find this section wherever it is and add to it.
    Alternatively, you could just move the non-protected code around the protected within the NB editor, but you would not be able to rearrange the order of the actual code-genned sections.
    craig

  • I have read 118 files (from a directory) each with 2088 data and put them into a 2 D array with 2cols and 246384row, I want to have aeach file on a separate columns with 2088 rows

    I have read 118 files from a directory using the list.vi. Each file has 2 cols with 2088rows. Now I have the data in a 2 D array with 2cols and 246384rows (118files * 2088rows). However I want to put each file in the same array but each file in separate columns. then I would have 236 columns (2cols for each of the 118 files) by 2088 rows. thank you very much in advance.

    Hiya,
    here's a couple of .vi's that might help out. I've taken a minimum manipulation approach by using replace array subset, and I'm not bothering to strip out the 1D array before inserting it. Instead I flip the array of filenames, and from this fill in the end 2-D array from the right, overwriting the column that will eventually become the "X" data values (same for each file) and appear on the right.
    The second .vi is a sub.vi I posted elsewhere on the discussion group to get the number of lines in a file. If you're sure that you know the number of data points is always going to be 2088, then replace this sub vi with a constant to speed up the program. (by about 2 seconds!)
    I've also updated the .vi to work as a sub.vi if you wa
    nt it to, complete with error handling.
    Hope this helps.
    S.
    // it takes almost no time to rate an answer
    Attachments:
    read_files_updated.vi ‏81 KB
    Num_Lines_in_File.vi ‏62 KB

  • Populating a javascript array with datatable data

    I want to populate a javascript array with datatable data.
    How do I do this?
    I want the javascript array to be populated as the datatable is displayed.
    Doing this way doesn't work.
    <h:dataTable value="#{pmManager.profiles}" var="pmProfile" binding="#{pmManagerUiBean.uiTable}" ">
    <script>
    allProfilenames[index]='#{pmProfile.profileName}';
              alert("index ="+index);
              alert("...1"+allProfilenames[0]);
              alert("...2"+allProfileRes[0]);
              index++;
    </script>
    <h:dataTable>

    In Javascript do something like this:
    document.getElementById('form1:dec_param');
    where form1:dec_param is the id of the component on the page source (html)

  • How to build a array with collected data

    Hi,
    I have collected data from serial port with VISA. Now I want to build a array with 100 date points. Should I connect VISA Read with Build Array directly? How to do it?
    PS: All of them are in a While Structure.
    Thank you!

    An inefficient way to create the array is to use the build array and a shift register as shown below. It's more effecient in terms of memory management to create the array and then use the replace array subset as shown in the other image. Of course, if you don't need the array inside the loop, just wire the value out of the while loop and on the exit tunnel, right click and select 'Enable Indexing'.
    Message Edited by Dennis Knutson on 07-03-2007 10:25 PM
    Message Edited by Dennis Knutson on 07-03-2007 10:26 PM
    Attachments:
    Crude Build Array.PNG ‏4 KB
    Better Build Array.PNG ‏6 KB

  • How to build a array with high sampling rates 1K

    Hi All:
    Now I am trying to develop a project with CRio.
    But I am not sure how to build a array with high sampling rates signal, like >1K. (Sigle-point data)
    Before, I would like to use "Build Arrary" and "Shift Register" to build a arrary, but I found it is not working for high sampling rates.
    Is there anyother good way to build a data arrary for high sampling rates??
    Thanks
    Attachments:
    Building_Array_high_rates.JPG ‏120 KB

    Can't give a sample of the FPGA right now but here is a sample bit of RT code I recently used. I am acquiring data at 51,200 samples every second. I put the data in a FIFO on the FPGA side, then I read from that FIFO on the RT side and insert the data into a pre-initialized array using "Replace Array subset" NOT "Insert into array". I keep a count of the data I have read/inserted, and once I am at 51,200 samples, I know I have 1 full second of data. At this point, I add it to a queue which sends it to another loop to be processed. Also, I don't use the new index terminal in my subVI because I know I am always adding 6400 elements so I can just multiply my counter by 6400, but if you use the method described further down below , you will want to use the "new index" to return a value because you may not always read the same number of elements using that method.
    The reason I use a timeout of 0 and a wait until next ms multiple is because if you use a timeout wired to the FIFO read node, it spins a loop in the background that polls for data, which rails your processor. Depending on what type of acquisition you are doing, you can also use the method of reading 0 elements, then using the "elements remaining" variable, to wire up another node as is shown below. This was not an option for me because of my programs architecture and needing chunks of 1 second data. Had I used this method it would have overcomplicated things if I read more elements then I had available in my 51,200 buffer.
    Let me knwo if you have more qeustions
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    RT.PNG ‏36 KB
    FIFO read.PNG ‏4 KB

  • Possible bug: Saving array with extended and double precision to spreadshee​t

    If one concatenates a double precision array and an extended precision array with the "build array" vi and then saves using "Write to Spreadsheet File" vi any digits to the right of the decimal place are set to zero in the saved file. This happens regardless of the format signifier input (e.g. %.10f) to the  "Write to Spreadsheet File" vi.
    I am on Vista Ultimate 32 bit and labview 9.0
    This is a possible bug that is easily circumvented by converting to one type before combining arrar to a spreadsheet. Nonetheless, it is a bug and it cost me some time.
    Solved!
    Go to Solution.
    Attachments:
    Spreadsheet save bug.vi ‏9 KB

    Hi JL,
    no, it's not a bug - it's a feature
    Well, if you would look more closely you would recognize the "Save to Spreadsheet" as polymorphic VI. As this polymorphic VI doesn't support EXT numbers internally (it only supports DBL, I64 and String) LabVIEW chooses the instance with most accuracy: I64 (I64 has 64 bits precision, DBL only 53...). So your options are:
    - set the instance to use as DBL (by right-click and "Select type...")
    - make a copy of this VI, save it with a different name and make it support EXT numbers (don't rework the polymorphic VI as you would break compatibility with other LV installations or future revisions)
    And yes, those coercion dots always signal some conversions - you should atleast check what's going on there...
    Message Edited by GerdW on 05-21-2010 10:01 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • ADF Faces with NetBeans Visual Pack

    Hello all,
    I have NetBeans 5.5.1 installed with the Visual Pack and I am looking to try out other libraries with it, in particular ADF Faces from Oracle.
    Does anyone know how to import the components into the NetBeans Visual Pack? They download from oracle as[b] adf-faces-impl-10_1_3_0_4.jar and not as a complib extension, which NetBeans prefers.
    Please if anyones has any experience with getting this to work let me know. Or if you think it can't work let me know as well?
    Hoping to hear from someone soon. Thanks in advance.

    Hello again,
    Anyone out there using ADF faces with NetBeans Visual Pack who can give some feedback?
    I want to be able to use the drag and drop capabilities of the Visual Pack with the ADF faces components, but I don't see how to configure this as they do not come pre-configured as a complib extension.
    Any feedback would be appreciated.
    Thanks and Regards.

Maybe you are looking for

  • I am trying to disable Triggers but this script not working?

    CREATE PROC DisableTriggers AS DECLARE @Table_Triggers SYSNAME DECLARE Cursor_Disabletriggers CURSOR FOR      SELECT  object_name(parent_id)     FROM   sys.triggers   OPEN Cursor_Disabletriggers FETCH NEXT FROM   Cursor_Disabletriggers     INTO @Tabl

  • Splitting Stereo Files

    How do you split stereo files in Logic? Anyone? Whenever I import a stereo file, it comes as one interleaved track. I change the track to accept stereo files (at the bottom of the fader in the lower left hand corner) and even when I double-click on t

  • Credit Management Company Code Level

    Dear Experts Is it possible to set credit limit for customer at company code level? eg. The same customer is maintained for diffrent company codes & one credit control area for all these company codes. Now the business wants to set up credit limit fo

  • Intit from ods to cube

    hai Experts, I am having a ods and i am doing init from that ods to 5 cubes. and know want to delete a init request from one cube and do the init for that single cube. Can we do this for a singlle cube. Regards. Singh.

  • New Window from Flash (getURL) Has No Parent

    I have a Flash application that is opening a new window via getURL. getURL(" http://www.microsoft.com", "EMMWindow"); The new window has a link that triggers a javascript that attempts to redirect the parent window via opener.location.href='x'; Howev