Naming components created in a loop?

I asked this once before, but none of the answers work in this case.
I am creating a series of components as children of a viewstack based on XML loaded.  I am looping through the XML and instancing a component for each node.
private function createSteps():void{
var stepNumber:uint = 1;
var numSteps:uint = dataXML.length;
        for each(var step:XML in dataXML){
var recipeStep:CyorStep = new CyorStep();
mainViewStack.addChild(recipeStep);
recipeStep.label = stepNumber +". "+ step.stepTitle;
recipeStep.itemChoicesList = step..item;
recipeStep.prompt.text = step.prompt;
recipeStep.stepCaption.text = step.bodyText;
recipeStep.stepTitle.text = step.stepTitle;
if (stepNumber == numSteps){
recipeStep.nextBtn.label = "FINISH";
recipeStep.addEventListener("GO_PREVIOUS",prevStep);
recipeStep.addEventListener("GO_NEXT",nextStep);
stepNumber++
The problem is all these objects have randomly generate names.  How can I assign each object a name as I instance it, as in:
var recipeStep1:CyorStep = new CyorStep();
var recipeStep2:CyorStep = new CyorStep();
and so on?

OK, close.  What I have done is created an array to hold them:
[Bindable]
public var stepModules:Array = [];
Then modified my creation loop like this:
private function createSteps():void{
var stepNumber:uint = 1;
var numSteps:uint = dataXML.length;
var recipeStep:CyorStep;
        for each(var step:XML in dataXML){
//var recipeStep:CyorStep = new CyorStep();
recipeStep = new CyorStep();
recipeStep.name = "recipeStep"+stepNumber.toString();
mainViewStack.addChild(recipeStep);
recipeStep.label = stepNumber +". "+ step.stepTitle;
recipeStep.itemChoicesList = step..item;
recipeStep.prompt.text = step.prompt;
recipeStep.stepCaption.text = step.bodyText;
recipeStep.stepTitle.text = step.stepTitle;
...etc...
stepModules.push(recipeStep);
stepNumber++;
        trace(stepModules[0].stepCaption.text);
This trace statement gives me the caption of the first item created, fine.  However, I have a datagrid that needs to be updated with the contents of the "drop" datagrid of the drag-n-drop in the component, so I tried setting its dataprovider to dataProvider="{stepModules[0].chosenList.dataProvider}" but I get nothing.  I can't figure out why, or if there's a step I need to do to get the dropped items to appear in the second grid as well as where they're dropped.

Similar Messages

  • How to create an infinite loop that cannot be cancelled?

    Hi , im new around java and i need a program that keeps on repeating after each each input/uses(generally meant for different user) and cannot either stop using "Cancel" or "x" while stopping only using the "stop" button
    I got a few lines of codes that look like this : String arg = "";
    do{
    JOptionPane.showInputDialog("hi");
    }while ( arg != "y" || arg!= "Y");
    and it cannot be stop with both cancel and"x"(which i wanted)
    but when i used this logic with
    Valid validUserInput = new Valid();
    do {
    userInput = validUserInput.validUserInput(a);
    switch(userInput){
    case 1 : validUserInput.optionOne(b);break;
    case 2 : validUserInput.optionTwo(c);break;
    case 3 : validUserInput.optionThree(d,e);break;
    default : validUserInput.validUserInput(f);
    }while(looping != "" || looping != " ");
    it does not really work(while it will keep looping, it can be easily stop by pressing cancelled or "x")
    So is there any logic or method that can prevent the program from being stop?
    Thankyou!

    elricscript wrote:
    "That is helpful. It gives him a direction where he can focus his research. Namely, 'how to run a program in kiosk mode' rather than 'how to create an infinite loop that cannot be cancelled.'"
    No... He already mentioned he wants to "e.g Interactive kiosk", so saying "properly kiosk it" isn't adding any new information. Rather it's just giving the person a dead point of: you're doing it wrong. Pointing out someone is wrong is not a positive enlightenment. Pointing someone in the right direction is more productive.
    >"That is helpful. It gives him a direction where he can focus his research. Namely, 'how to run a program in kiosk mode' rather than 'how to create an infinite loop that cannot be cancelled.'"
    No... He already mentioned he wants to "e.g Interactive kiosk", so saying "properly kiosk it" isn't adding any new information.
    Yes it is. He asked how to do it using some Swing trickery, and I said it won't work. Which is true. The OP didn't already know that, clearly, hence the question. Now he does. That's pretty much new information if you ask me.
    Rather it's just giving the person a dead point of: you're doing it wrong.Right. He is. However, the problem is now no longer related to Java, and not something I can help him with. You should try that: not answering questions you don't know the answer to. It's actually more helpful than posting misleading, wrong answers.
    Pointing out someone is wrong is not a positive enlightenment. I'm giving basic technical help, not yoga lessons.
    Pointing someone in the right direction is more productive.As already stated, I am as ignorant of how to make a Java application into a kiosk app as the OP is. What value can I add in light of that information? I began by answering a question that was not stated to be about kiosks. Once the question moved outside of my area of knowledge, I stopped trying to answer.
    I notice you're not giving him any help, being more interested in admonishing others as you are.

  • Can we create our own loops? Basic question.

    Hi,
    Can we create our own loops in Logic Pro. I see in all the tutorials. They are either taking input from external instruments OR use existing apple loops.
    I have tried FL studio demo to create our own loops. But there is no trial version for Logic Pro. Need your inputs before I purchase it.
    Thank you.
    Anji

    Yes you can!
    It is as simple as selecting a Region (optional trimming recommended) and choose the Export command.
    A Dialog window opens up that lets you enter the metadata
    Apple had its separate "Apple Loop Utility" app (now only available in the developer package) that allowed you to create loops in a standalone app. The built-in loop capability in Logic uses part of that engine.
    Hope that helps
    Edgar Rothermich
    http://DingDingMusic.com/Manuals/
    'I may receive some form of compensation, financial or otherwise, from my recommendation or link.'

  • Is there a way to create an endless loop of one playlist?

    I have a playlist where I would like to create an endless loop. Is there a way to accomplish this task? Software Version 1.2.
    Someplace I read about going into Settings and down to "repeat" and selecting "all." The settings on my iPod Nano does not show "repeat" in the Settings.

    Start your playlist and tap on the screen while the song is playing. Tap on the repeat symbol showing on the screen then select the repeat list symbol on the left hand side.
    http://manuals.info.apple.com/en_US/iPod_nano_6thgen_User_Guide.pdf
    Message was edited by: deggie

  • What are the "Add to Loop Library" requirements for creating automatically conforming loops?

    I am trying to create my own loops that conform to the tempo and key of a song. I have made several loops in this way by selecting a region that is exactly 4 bars, for example, and then selecting "Add to Loop Library". If the sample is cut correctly, the "Type:" field is enabled which allows you to make it a Loop and therefore have it automatically conform to the song tempo.
    In the past I have made loops that were very long, up to 128 beats, for the purpose of making mashups using instrumental tracks that I want to conform to the song. I now can't seem to create a large loop but I am not sure why. I know it is possible, but I don't know the steps I took to get there.
    What are the exact requirements that allow a loop to be added to the loop library while also conforming to song key and tempo?

    In the past I have made loops that were very long, up to 128 beats
    The longest loop I managed to save as "Loop" had 55 measures (220 beats, 203 bpm). Longer loops could only be saved as "One shot". And the loop had to be cut at the end, not simply be trimmed by dragging the end of the region. The tempo matters; for a slow song the loop can only have fewer measures.

  • When I export a AAF file from Protools 9 and Import the file into Logic ProX the drum track is out of sync.  I created the drum loop using NI Maschine.  Has anyone else seem this??

    When I export an AAF file/project from Protools 9 using an external drive and import the AAF into Logice Pro X the drum track does not play correctly.  It is out of sync with the rest of the track.  I created the drum loop as a plugin using Native Instruments Maschine. Has anyone else had this problem??  Also how would I go about exporting the midi tracks from the Protools session.  The midi track does not show when the file is imported to Logic Pro X.  The midi data should export with the AAF file correct??

    Are you using any plugins in Logic?
    In Preferences/Audio  under the General tab, how do you have the plug-in-latency compensation set?

  • How to create a button loop until mouse is released?

    How would I go about creating a button loop that continuously increments while the button is being pressed and stops incrementing on release?

    Just want to post the finished code for anyone who is interested.
    var interval;
       var count=0;
    //PlayerCastBar
      //Bar
       //X Pos
       i_Mercinova.PCBBXPDecrease.onPress = function()
         interval=setInterval(incrementPCBBXPDecrease, .01);
        function incrementPCBBXPDecrease()
         count++;
         _root.playercastbar.i_Castbar._x=(_root.playercastbar.i_Castbar._x-2)
       i_Mercinova.PCBBXPDecrease.onRelease = function()
         clearInterval(interval);
         count==0;
       i_Mercinova.PCBBXPIncrease.onPress = function()
         interval=setInterval(incrementPCBBXPIncrease, .01);
        function incrementPCBBXPIncrease()
         count++;
         _root.playercastbar.i_Castbar._x=(_root.playercastbar.i_Castbar._x+2)
       i_Mercinova.PCBBXPIncrease.onRelease = function()
         clearInterval(interval);
         count==0;
    It does exactly what I wanted it to.  Again, Thank You Very Much, Ned!! 

  • How do I go about this? Creating table while looping through dates?

    How do I do this? Creating table while looping through dates?
    I have a table with information like:
    ID---Date---Status
    1-------04/23-----Open
    1-------04/25-----Open
    2-------04/24-----Closed
    3-------04/26-----Closed
    What I want to do is create another table based on this per ID, but have all the dates/statuses on the same line as that ID number (as additional columns). The problem is that the number of columns needed is to be dynamically decided by the number of dates.
    To illustrate my example, I'm looking to achieve the following:
    ID---04/23 Status---04/24--Status---04/25--Status---04/26--Status
    1----Open--------------<null>-------------Open---------------<null>
    2----<null>------------Closed-------------<null>-------------<null>
    3----<null>------------<null>-------------<null>-------------Closed
    What would be the best way to go about this?
    Can someone please point me in the right direction?
    Would I need to do some looping?
    Thanks in advance!

    thedunnyman wrote:
    How do I do this? Creating table while looping through dates?
    I have a table with information like:
    ID---Date---Status
    1-------04/23-----Open
    1-------04/25-----Open
    2-------04/24-----Closed
    3-------04/26-----Closed
    What I want to do is create another table based on this per ID, but have all the dates/statuses on the same line as that ID number (as additional columns). The problem is that the number of columns needed is to be dynamically decided by the number of dates.
    To illustrate my example, I'm looking to achieve the following:
    ID---04/23 Status---04/24--Status---04/25--Status---04/26--Status
    1----Open--------------<null>-------------Open---------------<null>
    2----<null>------------Closed-------------<null>-------------<null>
    3----<null>------------<null>-------------<null>-------------Closed
    What would be the best way to go about this?
    Can someone please point me in the right direction?
    Would I need to do some looping?
    Thanks in advance!I hope you are asking about writing a query to DISPLAY the data that way ... not to actually create such a massively denormalized table ....

  • How to create a step loop control in a screen

    Hi,
    Basically, what I need to do is to create a fully dynamic screen. I want to send the structure name and the fiednames and the function will create a screen will all the required fields.
    I explored many possibilities and the best one seems to be using the step loop control in a screen. I know, this is really old technology but I do not care as long as this work great !
    I saw that the function group MASSFREESELECTIONS is doing it, this look pretty simple, fast and fully dynamic...
    My only problem is that I'm not able to create a step loop control in a standard screen.... is it an obsolete function that was removed from the control list ?
    Thanks
    Dany
    Message was edited by:
            Dany Charbonneau

    Hi,
    STEP LOOPS
    Step Loops are type of screen table . Step loops are repeated blocks of field in a screen. Each block contains one or more fields and these blocks are repeated. Step loops aren’t like actual table. You can scroll vertically but not horizontally. Three steps are associated with creation of step loops:
    • Creation of step loops on screen, which includes declaring fields on the screen and then defining the step, loops for these fields.
    • Passing data to the step loop is exactly similar to the passing of data to table controls.
    • In step loop, you don’t need to define the step loop as such in the module pool program but the cursor needs to be defined in the program.
    Types of Step Loops
    • Static – Static Step Loop (SSL) have fixed size that cannot be changed during the runtime. If user resizes the window, the size of the static step loop is not changed.
    • Dynamic – Dynamic Step Loop (DSL) is variable in size. When the user resizes the window, the system increases or decreases the number of the step loop blocks.
    You can have only one dynamic step loop and can have as many static loops in your transaction.
    Programming with the Static and dynamic step loop is exactly same. For the system or for the user it doesn’t make any difference whether it is static or dynamic step loop. Only attribute, which you fix during designing of the step loop, is type attribute for step loop F for fixed i.e static and V for variable i.e. dynamic.
    Writing code for Step Loop in the flow logic.
    PBO.
    Loop at itab cursor cl.
    Module set.
    Endloop.
    PAI.
    Loop at itab.
    Endloop.
    Empty loop is must for both table control and step loop
    LOOP AT statement for step loops and Table controls is similar. Loop At statement transfers the data to screen table. You need to have the Module to assign the values for the screen table.
    In module pool program you need to define the cursor.
    Date: CL TYPE i.
    Cursor parameter tells which line of step loop display should start.
    “Module Set” in module pool program assigns the values to step loop fields, which is similar to table controls.
    Refer to this program <b>DEMO_DYNPRO_STEP_LOOP</b>
         hope u can get some idea about table control & step loop in this line.
    http://www.sapfans.com/sapfans/repos/comelite.htm
    Check this link,
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm
    <b>Reward points</b>
    Regards

  • Accessing components created thru AS addChild

    I am working on an application that requires me to add
    componts on the fly, based on the field type as entered into the
    database. (code attached).
    So, I have no idea how many componets will be added, or what
    types they will be.
    On click of a save button, I need to be able to access the
    values typed in to the boxes. Normall its textbox.text, but since I
    don't know the names of the boxes, I'm stumped.
    I have tried adding the name of the component to an array
    just before I use the .addChild() in the switch statments, but that
    only gives me an array of the names, and looping through the array,
    using array(i).text gives me an error.
    Any ideas? I'm stuck on this. Maybe there is a better way of
    adding the boxes to the page than what I'm doing.
    Thanks!

    I strongly urge you to consider using mx:Repeater. It does a
    lot of work for you , including creating arrays of references to
    repeated components. If you give some tag in the repeater an id,
    say mytext", then you can access the instances of that component
    using mytext[n].text, where "n" is the index of the dataProvider
    item.
    Doing this below does NOT create an id you can use to
    reference the component instance:
    myEditor.id = "Answer"+i.toString();
    If you want to stick with manual addChild, you will need to
    keep a reference to the created components yourself. One effective
    way is to use an associative array, like a hash table. This is just
    a dynamic "Object".
    private var _myEditors:Object = new Object();
    myEditor = new RichTextEditor();
    myEditor.text = "Answer question here";
    _myEditors["Answer"+i] = myEditor; //toString is not
    necessary here
    vbLabBk.addChild(myEditor);
    Then you can later access those instances like this:
    var myEditor:RichTextEditor = _myEditors["Answer"+i];
    But consider Repeater. It does this and much more for you,
    such as destroying unwanted child components when the data changes.
    Tracy

  • How do I create a sound loop with Garageband?

    Probably a simple question, but I'm very new to Garageband. I'm trying to make some sound loops to use as looping background music for a Flash website. How do I import an mp3 from my iTunes and the cut it down to a 10 second or so snippet, then have it loop for the background music? I'm guessing I want to export it as an mp3, correct?
    Any help is greatly appreciated!

    Hi
    An Audio region is the name of a rectangle in GB that represents the audio file.
    It's like a Bar that contains the data. The data can be audio or MIDI. So, drag the top right means place the mouse cursor over the top right corner of the bar and click-hold and drag... like you would drag a window or a picture to resize it in other applications.
    At the end of the Time Ruler is an arrow pointing left you can drag. This sets the end of the project. So drag it to where you want it to end (exactly where the region ends)
    or click on the two arrows looping (in a circle) button in he Transport bar at the bottom. This creates a cycle region (yellow bar in the Time Ruler). Drag and resize this to include only what you want:
    and choose Share > Export Song to Disk.
    There is a good offer on you might be interested to learn more about the basics and some of GB and other applications:
    https://www.macprovideo.com/trial/?st=7df&login
    This gives you FREE online access for 7 days to all the tutorials at macprovideo. I think you need to register and cancel before the 7 days is up if you don't want to continue the subscription. The tutorials for GB and other programs are very high quality so I didn't take the online sub offer but I buy and download the ones I want.
    JG
    Message was edited by: JG99

  • Named Criteria created, but it does not show up in the Data Controls view

    Hello there,
    I wish to use a data-bound ADF Mobile ListView in one of the pages on the app. However, only entries of the underlying data that fulfill a certain condition shall be displayed in the list. The condition basically is an "Equals" test against a bind variable in the pageFlowScope. Therefore, I have created a corresponding Named Criteria for the data control - proceeded like described here:
    https://blogs.oracle.com/adf/entry/create_named_criteria_in_ejb
    The Named Criteria, in my case, has been created and saved, yet it does not show up in the Data Controls view of JDeveloper. Therefore, I cannot drag it on a UI element to use it.
    I only have the "Operations" folder where the quick guide above also shows a "Named Criteria" folder.
    Refreshing or restarting JDeveloper did not solve this.

    It was all taken care of by Gaurav Aggarwal
    He got me all fixed up, Thank you for your concern.
    Daniel Walters

  • Adding mouselisteners to JPanels created through for loop

    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.io.File;
    import java.io.IOException;
    import java.util.Vector;
    import javax.swing.AbstractAction;
    import javax.swing.Action;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JViewport;
    import javax.swing.SwingConstants;
    import javax.swing.filechooser.FileSystemView;
    public class ScrollableWrapTest {
        public static void main(String[] args) {
            try {
                  ScrollableWrapTest st = new ScrollableWrapTest();
                final JPanel mainPanel = new JPanel(new WrapScollableLayout(FlowLayout.LEFT, 10, 10));
                mainPanel.setBackground(Color.WHITE);
                JScrollPane pane = new JScrollPane(mainPanel);
                pane.setPreferredSize(new Dimension(550, 300));
                Vector v = new Vector();
                v.add("first.doc");
                v.add("second.txt");
                v.add("third.pdf");
                v.add("fourth.rar");
                v.add("fifth.zip");
                v.add("sixth.folder");
                v.add("seventh.exe");
                v.add("eighth.bmp");
                v.add("nineth.jpeg");
                v.add("tenth.wav");
                JButton button = null;
                for(int i =0;i<v.size();i++){
                    JPanel panel = new JPanel(new BorderLayout());
                    Icon icon = st.getIcone(st.getExtension(v.elementAt(i).toString().toUpperCase()));
                      panel.setBackground(Color.WHITE);
                     Action action = new AbstractAction("", icon) {
                         public void actionPerformed(ActionEvent evt) {
                     button = new JButton(action);
                     button.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
                     JPanel buttonPanel = new JPanel();
                     buttonPanel.setBackground(Color.WHITE);
                     buttonPanel.add(button);
                     JLabel label = new JLabel((String)v.elementAt(i));
                     label.setHorizontalAlignment(SwingConstants.CENTER);
                     panel.add(buttonPanel , BorderLayout.NORTH);
                     panel.add(label, BorderLayout.SOUTH);
                     mainPanel.add(panel);
                    mainPanel.revalidate();
                st.buildGUI(pane);
            } catch (Exception e) {e.printStackTrace();}
        public void buildGUI(JScrollPane scrollPane)
             JFrame frame = new JFrame("Scrollable Wrap Test");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.add(scrollPane, BorderLayout.CENTER);
            frame.setLocationRelativeTo(null);
            frame.pack();
            frame.setVisible(true);
        public String getExtension(String name)
              if(name.lastIndexOf(".")!=-1)
                   String extensionPossible = name.substring(name.lastIndexOf(".")+1, name.length());
                   if(extensionPossible.length()>5)
                        return "";
                   else
                        return extensionPossible;
              else return "";
         public Icon getIcone(String extension)
              //we create a temporary file on the local file system with the specified extension
              File file;
              String cheminIcone = "";
              if(((System.getProperties().get("os.name").toString()).startsWith("Mac")))
                   cheminIcone = System.getProperties().getProperty("file.separator");
              else if(((System.getProperties().get("os.name").toString()).startsWith("Linux")))
                   //cheminIcone = FileSystemView.getFileSystemView().getHomeDirectory().getAbsolutePath()+
                   cheminIcone = "/"+"tmp"+"/BoooDrive-"+System.getProperty("user.name")+"/";
              else cheminIcone = System.getenv("TEMP") + System.getProperties().getProperty("file.separator");
              File repIcone = new File(cheminIcone);
              if(!repIcone.exists()) repIcone.mkdirs();
              try
                   if(extension.equals("FOLDER"))
                        file = new File(cheminIcone + "icon");
                        file.mkdir();
                   else
                        file = new File(cheminIcone + "icon." + extension.toLowerCase());
                        file.createNewFile();
                   //then we get the SystemIcon for this temporary File
                   Icon icone = FileSystemView.getFileSystemView().getSystemIcon(file);
                   //then we delete the temporary file
                   file.delete();
                   return icone;
              catch (IOException e){ }
              return null;
        private static class WrapScollableLayout extends FlowLayout {
            public WrapScollableLayout(int align, int hgap, int vgap) {
                super(align, hgap, vgap);
            public Dimension preferredLayoutSize(Container target) {
                synchronized (target.getTreeLock()) {
                    Dimension dim = super.preferredLayoutSize(target);
                    layoutContainer(target);
                    int nmembers = target.getComponentCount();
                    for (int i = 0 ; i < nmembers ; i++) {
                        Component m = target.getComponent(i);
                        if (m.isVisible()) {
                            Dimension d = m.getPreferredSize();
                            dim.height = Math.max(dim.height, d.height + m.getY());
                    if (target.getParent() instanceof JViewport)
                        dim.width = ((JViewport) target.getParent()).getExtentSize().width;
                    Insets insets = target.getInsets();
                    dim.height += insets.top + insets.bottom + getVgap();
                    return dim;
    }How can I add mouse listener to each of the 'panel' in 'mainpanel' created inside the 'for loop' using the code mainPanel.add(panel);Rony

    >
    How can I add mouse listener to each of the 'panel' in 'mainpanel' created inside the 'for loop' using the code mainPanel.add(panel);
    Change the first part of the code like this..
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.io.File;
    import java.io.IOException;
    import java.util.Vector;
    import javax.swing.AbstractAction;
    import javax.swing.Action;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JViewport;
    import javax.swing.SwingConstants;
    import javax.swing.filechooser.FileSystemView;
    public class ScrollableWrapTest {
        public static void main(String[] args) {
            try {
                  ScrollableWrapTest st = new ScrollableWrapTest();
                final JPanel mainPanel = new JPanel(new WrapScollableLayout(FlowLayout.LEFT, 10, 10));
                mainPanel.setBackground(Color.WHITE);
                JScrollPane pane = new JScrollPane(mainPanel);
                pane.setPreferredSize(new Dimension(550, 300));
                Vector<String> v = new Vector<String>();
                v.add("first.doc");
                v.add("second.txt");
                v.add("third.pdf");
                v.add("fourth.rar");
                v.add("fifth.zip");
                v.add("sixth.folder");
                v.add("seventh.exe");
                v.add("eighth.bmp");
                v.add("nineth.jpeg");
                v.add("tenth.wav");
                JButton button = null;
                MouseListener ml = new MouseAdapter() {
                        @Override
                        public void mouseClicked(MouseEvent me) {
                             System.out.println(me);
                for(int i =0;i<v.size();i++){
                    JPanel panel = new JPanel(new BorderLayout());
                    Icon icon = st.getIcone(st.getExtension(v.elementAt(i).toString().toUpperCase()));
                      panel.setBackground(Color.WHITE);
                     Action action = new AbstractAction("", icon) {
                         public void actionPerformed(ActionEvent evt) {
                     button = new JButton(action);
                     button.setPreferredSize(new Dimension(icon.getIconWidth(), icon.getIconHeight()));
                     JPanel buttonPanel = new JPanel();
                     buttonPanel.setBackground(Color.WHITE);
                     buttonPanel.add(button);
                     JLabel label = new JLabel((String)v.elementAt(i));
                     label.setHorizontalAlignment(SwingConstants.CENTER);
                     panel.add(buttonPanel , BorderLayout.NORTH);
                     panel.add(label, BorderLayout.SOUTH);
                     mainPanel.add(panel);
                     panel.addMouseListener( ml );
                    mainPanel.revalidate();
                st.buildGUI(pane);
            } catch (Exception e) {e.printStackTrace();}
    ...

  • How to go on creating activities in loop?

    Hi!
    Lead record type has activities associated with it.
    if a new lead is created, automatically an initial activity should be created with certain details and assigned to a particular sales rep. this i can do with workflow. this is fine.
    Now i want that, when ever the sales rep completes the activity and marks status of activity as _"Completed"_, automatically a new activity record should be created and details of newly created activity should be filled by the sales rep who marked the old activity status as "Completed". This cycle should go on.
    Also there has to be a stopper to this loop to which only a manager can have access.
    i tried with workflow. For that i created a custom picklist on activity record type with values as "Continue" and "Stop". I set the default value as "Continue". Only manger has access to this picklist. My logic was unless the manager sets the value of the picklist as "Stop", the activity should be created in loop. I did in this way:
    Workflow Name: Activity Loop
    record Type: Activity
    Trigger Event: When modified record saved
    Workflow rule condition: LookupValue("OCC_INDEX_CUST_LOV_EVT_ACT_0", "Continue") AND LookupValue("EVENT_STATUS", "Completed")
    But when i saw the available Workflow actions, there was no mention of creating a new activity in it. so now how should i create new activity when old activity is completed? i am struck up here. How can continue from this point?
    I don't mind going for any other way if it satisfies my requirement.
    thankx and regards
    Edited by: user10434678 on Feb 20, 2009 7:23 PM

    Hi !
    I'm afraid this won't be possible with workflows... Oracle made it not possible to create an activity via a workflow on the activity entity.
    Imagine that someone create something like "when a new activity is created, then create an activity", you'll agree that this will shut down the server !! I think that's why they don't allow this action on this kind of workflow.
    I'll suggest to have a checkbox on your lead record which will be something like "Next activity" and when the sales rep checks it, it will create the next activity and uncheck the box.
    Otherwise, try to fin out if this kind of functionnality will be possible in the next release (R16)...
    Hope this will help, feel free to ask more !
    Max

  • Creating a basic loop program in java

    I'm working on a program for school. The program asks the user for an in put number between 1-20. The program then outputs a square made of asterisks that corresponds with the number entered. for example :
    2 =
    3 =
    This is what I have so far, but I don't know how to create a straight line of asterisks for an input number of 3 or higher
    public class square {
    * @param args the command line arguments
    public static void main(String[] args)
    Scanner input = new Scanner( System.in);
    int number = 0;
    System.out.print( "Enter a number between 1 and 20\t" );
    number = input.nextInt();
    if (number <1)
    System.out.printf( " Number must be greater than 0 ");
    if (number >20)
    System.out.printf(" Number must not be greater than 20");
    if (number ==1)
    System.out.printf("*");
    if (number ==2)
    System.out.println ("**\n**");
    if (number >= 3)
    Any help would be greatly appreciated!
    Edited by: Methodx on Jan 22, 2009 9:24 PM

    You would need two for loops .
    In the inner loop , print either an asterix or a space based on wheter the point ur considering is on the edge of the square or inside the square.
    In the outer loop , skip to the next line.
    (0,0)    (0,1)    (0,2)     (0,3)
    (1,0)    (1,1)    (1,2)     (1,3)
    (2,0)    (2,1)    (2,2)     (2,3)
    (3,0)    (3,1)    (3,2)     (3,3)You can work out the condition to be used in the inner loop ( to wheter print an asterix or a space) by studying the values of the loop variables at the edge of the square.

Maybe you are looking for