Create multiple JLabel object

hi i have create an application that load multiple image from file JLabel using the for loop beause everytime the for loop will create a new JLabel imageJLabel() therefore i would like to know is that anyway that i could create multiple object JLabel like this
for(int i=0;i<count;i++)
JLabel imageLabel + i = new JLabel();
i hope to do it like this
JLabel imageLabel1 = new JLabel();
JLabel imageLabel2 = new JLabel();
JLabel imageLabel3 = new JLabel();
This is the code:
try
while(rs.next())
                    tName.addElement(rs.getString("Name"));
                    tGoals.addElement(rs.getString("Goals"));
                    count++;
System.out.println("The numbers of records " + count);
}catch(SQLException sqlex)
System.out.println("Error....");
howPicPanel.setLayout(new GridLayout(count,1,5,5));
showRatePanel.setLayout(new GridLayout(count,1,5,5));
for(i=0;i<count;i++)
     JLabel imageLabel = new JLabel();
Icon teampic = new ImageIcon("image/image.gif");
imageLabel.setIcon(teampic);
imageLabel.setText(String.valueOf(tName.elementAt(i)));
imageLabel.setToolTipText(String.valueOf(tName.elementAt(i)));
showPicPanel.add(imageLabel);

for(int i=0;i<count;i++)
JLabel imageLabel + i = new JLabel();
}Won't work, but this will:
JLabel [] labels = new JLabel[count];
for( int i=0; i<count; i++ )  {
  labels[i] = new JLabel();

Similar Messages

  • Creating Multiple Resource Objects for OOTB Connectors

    All,
    I am trying to create a second AD User resource object for the OOTB connector. I would like to think that the AD Connector (and all connectors, for that matter) was designed to handle the creation of multiple Resource Objects for the same Resource Types, but am I wrong? It doesn't seem like the OIM Connector can handle this easily.
    Has anyone created multiple resource objects for a connector? Is this a fairly simple task, or will it require a large effort? Is it even possible? Any pointers?
    Thanks!

    I will provide a little help with the duplication. I found the best way to do it is to import the original connector. Go through the different pieces making each one have a unique name, that is not part of any of the other piece names. You need to have unique names for the following:
    1. Resource Object
    2. Process Definition - Provisioning
    3. IT Resource
    4. Form - Process
    5. Scheduled Task
    After you import the connector, rename each of the following to something unique. I would also update your process form to have a default value of your IT Resource, as well as your scheduled task values to point to the new unique names. Export the 5 items, no dependecies. The adapters will all be the same. Use find and replace for the values and then import the new XML. If it works, duplicate the XML for each of the new workflows you want to create.
    -Kevin

  • Creating multiple resource objects at once

    Hi,
    Business roles are multivalued attributes and in order for OIM to manage them, I am creating them as resources. These resources will have role id and role name as its fields. I have close to 50 biz roles in the system. Is there any way I can create them in bulk than having to create the resource obj, process defn. and process forms for each of them manually?
    Thanks,
    Supreetha

    You can create one workflow and uniquely identity the objects names such as:
    RO_NAME, PROV_PROC_DEF, APPR_PROC_DEF, UD_FORM and so on to identify all the objects. Export the workflow. Come up with either code, or some way to find and replace these values with your list of names for your other workflows. Then import the workflows.
    You could try and come up with code that takes a template, and then generates a new xml file with a list of values.
    -Kevin

  • Creating multiple rectangle objects

    Hi all
    Just having a bit of trouble with a drawing applet i'm creating. At the moment i want the user to be able to click on the screen and the mouse presses and releases define the size of the rectangle. This isn't a problem its just that now i want them to be albe to add more shapes by clicking a new Shape button. at the min my code seems to get stuck in the while loop in the paint method i think, and then it says that the applet is disposed?
    Any ideas where i could be going wrong?
    Cheeers for any pointers
    Heres the code
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.util.*;
    public class drawingApplet extends Applet
                           implements ActionListener, MouseListener
         private Button newShape = new Button("New");
         private Button button2D = new Button("2D");
         //arraylist for objects
         ArrayList shapesArray = new ArrayList();
              boolean drawObject = true; //Drawing Mode
         boolean moveObject = false;
              private Color color = Color.black;
         int x1,y1,x2,y2,x3,y3,x4,y4 = 0;
         int startX,startY,width,height = 0;
         Rectangle myRectangle = new Rectangle(startX,startY,width,height);
              public void init()
              Panel pEast = new Panel();
              pEast.setLayout(new GridLayout(7,1));
              pEast.add(newShape);
              pEast.add(button2D);
              setBackground(Color.gray);
              newShape.addActionListener(this);
              button2D.addActionListener(this);
              addMouseListener(this);
        public void paint(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              g2.setColor(color);
              //create Rectangle Object
              myRectangle = new Rectangle(50,50,50,50);
              shapesArray.add(myRectangle);
              Iterator it = shapesArray.iterator();
              while(it.hasNext())
                   //DRAW Object
                   if(drawObject == true){
                        g2.draw(myRectangle);
              }//--> End of While loop
         }     //--> End of Paint()
         //--> Start of actionPeformed()
        public void actionPerformed(ActionEvent a)
            if (a.getSource()== button2D){
                   drawObject = true;
                   moveObject = false;
              }else if(a.getSource()== newShape){
                   //add rectangle to arraylist
                   shapesArray.add(myRectangle);
            repaint();}
        }//--> End of actionPerformed()
        //--> Start of section dealing with Mouse Events
        public void mouseClicked(MouseEvent e)
        public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
        public void mousePressed(MouseEvent e)
              x1 = e.getX();
              y1 = e.getY();
              if(myRectangle.contains(x1,y1)){
                   drawObject = false;
                   moveObject = true;
              }else{ //draw the object
                   drawObject = true;}
         }//--> End of mousePressed()
         public void mouseReleased(MouseEvent e)
              //get the positions of where the mouse was released
              x2 = e.getX();
              y2 = e.getY();
              if(drawObject == true){
                   if (x1 != x2 && y1 != y2){
                   //maths to work out where to draw the object
                   if(x1 < x2 && y1 < y2){//1
                        startX = x1;
                        startY = y1;
                        height = y2 - y1;
                        width = x2 - x1;}
                   else if (x1 > x2 && y1 > y2){//2
                        startX = x2;
                        startY = y2;
                        height = y1 - y2;
                        width = x1 - x2;}
                   else if (x1 > x2 && y1 < y2){//3
                        startX = x2;
                        startY = y1;
                        height = y2 - y1;
                        width = x1 - x2;
                   else if (x1 < x2 && y1 > y2){//4
                        startX = x1;
                        startY = y2;
                        height = y1 - y2;
                        width = x2 - x1;}
              }else if(moveObject == true){
                   if (x1 != x2 && y1 != y2){
                        startX = x2;
                        startY = y2;
                        width = myRectangle.width;
                        height = myRectangle.height;
              repaint();
         }//--> End of mouseReleased()
    }Also if anybody has some examples i could look at i would be very grateful. Cheers!!

    /*  <applet code="AddingRectangles" width="400" height="300"></applet>
    *  use: >appletviewer AddingRectangles.java
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class AddingRectangles extends Applet implements ActionListener, MouseListener
        private Button newShape = new Button("New");
        private Button button2D = new Button("2D");
        //arraylist for objects
        ArrayList shapesArray = new ArrayList();
        boolean drawObject = true; //Drawing Mode
        boolean moveObject = false;
        private Color color = Color.black;
        int x1,y1,x2,y2,x3,y3,x4,y4 = 0;
        int startX,startY,width,height = 0;
        Rectangle selectedRectangle;
        public void init()
            Panel pEast = new Panel();
            pEast.setLayout(new GridLayout(7,1));
            pEast.add(newShape);
            pEast.add(button2D);
    //        setBackground(Color.gray);
            newShape.addActionListener(this);
            button2D.addActionListener(this);
            addMouseListener(this);
        public void paint(Graphics g)
            Graphics2D g2 = (Graphics2D)g;
            g2.setColor(color);
            //create Rectangle Object
    //        myRectangle = new Rectangle(50,50,50,50);
    //        shapesArray.add(myRectangle);
            Iterator it = shapesArray.iterator();
            while(it.hasNext())
                g2.draw((Rectangle)it.next());
        } //--> End of Paint()
        //--> Start of actionPeformed()
        public void actionPerformed(ActionEvent a)
            if (a.getSource()== button2D){
                drawObject = true;
                moveObject = false;
            }else if(a.getSource()== newShape){
                //add rectangle to arraylist
    //            shapesArray.add(myRectangle);
            repaint();
        }//--> End of actionPerformed()
        //--> Start of section dealing with Mouse Events
        public void mouseClicked(MouseEvent e){}
        public void mouseEntered(MouseEvent e){}
        public void mouseExited(MouseEvent e){}
        public void mousePressed(MouseEvent e)
            x1 = e.getX();
            y1 = e.getY();
            selectedRectangle = null;
            Iterator it = shapesArray.iterator();
            Rectangle r;
            while(it.hasNext())
                r = (Rectangle)it.next();
                if(r.contains(x1,y1)){
                    drawObject = false;
                    moveObject = true;
                    selectedRectangle = r;
                    break;
            // no rectangle selected
            if(selectedRectangle == null)
                selectedRectangle = new Rectangle(x1, y1, 0, 0);
                drawObject = true;
        }//--> End of mousePressed()
        public void mouseReleased(MouseEvent e)
            //get the positions of where the mouse was released
            x2 = e.getX();
            y2 = e.getY();
            if(drawObject == true){
                if (x1 != x2 && y1 != y2){
                    //maths to work out where to draw the object
                    if(x1 < x2 && y1 < y2){//1
                        startX = x1;
                        startY = y1;
                        height = y2 - y1;
                        width = x2 - x1;
                    else if (x1 > x2 && y1 > y2){//2
                        startX = x2;
                        startY = y2;
                        height = y1 - y2;
                        width = x1 - x2;
                    else if (x1 > x2 && y1 < y2){//3
                        startX = x2;
                        startY = y1;
                        height = y2 - y1;
                        width = x1 - x2;
                else if (x1 < x2 && y1 > y2){//4
                    startX = x1;
                    startY = y2;
                    height = y1 - y2;
                    width = x2 - x1;
                if(Math.abs(x2 - x1) > 0 && Math.abs(y2 - y1) > 0)
                    shapesArray.add(new Rectangle(x1, y1, width, height));
            }else if(moveObject == true){
                if (x1 != x2 && y1 != y2){
                    startX = x2;
                    startY = y2;
                    width = selectedRectangle.width;
                    height = selectedRectangle.height;
            repaint();
        }//--> End of mouseReleased()
        public static void main(String[] args)
            Applet applet = new AddingRectangles();
            Frame f = new Frame("Adding Rectangle");
            f.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
            f.add(applet);
            f.setSize(400,300);
            f.setLocation(200,200);
            applet.init();
            applet.start();
            f.setVisible(true);
    }

  • Multiple resource objects provision issue in OIM10g

    Hi Team,
    We're facing an issue regarding multiple access policy trigger for a specific resource object in OIM.
    The scenario is whenever we try to process the enablement or creation of users through flat file recon, users are created / enabled with multiple resource objects in their resource profiles.
    When we checked in User Resource Access History report, we observe that the access policy has been triggering multiple times for these users resulting in users with multiple resource objects. Amongst these one shows provisioned/Enabled and the other shows provisioning/in some cases Provisioned/Enabled.
    Please advise as this has become an ongoing issue and also has led into data mess-up.
    Appreciate your help on this one..
    Regards,
    Sagar

    The terminology sounds a little confusing to me:
    If you mean you wanna create multiple IT Resources for a single IT Resource Instance so that the user can select the appropriate IT Resource during request creation -> All good upto here. But then since the Object/Request Form attached to a resource would be the same, so any user would always see the same form fields for creationg request.
    Example: Users creating request for Oracle Database Accounts but different server locations
    If it means you just need to create multiple Resource Objects then its a straighaway standard requirement and could be handled with normal Connector Development methodology.
    Example: Users creating requests for different resources like Oracle Database Accounts & Active Directory Accounts

  • How to create multiple infoobjects?

    Hi Experts ,
    I have a requirement where i need to create more than 70 infoobjects. Is there any standard report or function module where we can create multiple infoobjects and a detailed log if any infoobject got any error in between. I know creating infoobjects through  RSA1 one by one but looking out for any program where we can create multiple infoobjects.

    Dear Adi,
    While there are FM to activate  and Delete Multiple InfoObjects,,,We dont have any proces  of creating Multiple Info Objects ata time..
    Because each infoobject ahs differnt properties and different charactersitcs...some this is not feasible..
    Hope this helps u..
    Best Regards,
    VVenkat...

  • Multiple Dependent Object Creation

    I would like to create multiple dependent objects as a single transaction. I have the following custom objects:
    WorkingGroup extends DirectoryGroup
    WorkingUser extends DirectoryUser
    WorkingUserProfile extends ExtendedUserProfile
    When a WorkingGroup is created, it needs to create the following objects:
    4xAccessControlList
    1xWorkingUser + 1xWorkingUserProfiles
    1xFolder
    And it needs to set relational references between them.
    WorkingGroup needs Folder
    Folder needs an ACL
    WorkingUser needs WorkingGroup, WorkingUserProfile, and an ACL
    I want to create the WorkingGroup and have that (preferably in an override but at minimum within a transaction) create the objects it requires. Otherwise when there is an error, my integrity is blasted and I have objects that cannot be easily deleted.

    Andrew,
    Your probably best off avoiding overrides and simply using a
    transaction.
    Overrides should typically be used to change the way the
    repository interacts with itself and with external applications.
    I like to think of them as analagous to Database table-level
    triggers.
    From what you have outlined, it sounds like you want
    a "WorkingGroupCreator" object which can create an instance of
    WorkingGroup and all it's associated ACLs, Profiles and so forth.
    The Creator object should do everything within a Transaction.
    If any operation fails, all the work of the Creator is
    rolledback.
    You probably want a "WorkingGroupDeletor" as well. This will
    clean up all the objects associated with the WorkingGroup in a
    transactional manner.
    I imagine that your WGC might have a form like:
    public class WorkingGroupCreator
    public WorkingGroupCreator(LibrarySession ls,
    String groupName,
    String userName,
    DirectoryObject[] members,
    //save values in private members
    public WorkingGroup create()
    begin transaction
    group = createGroup()
    user = createUser()
    profile = createUserProfile(user)
    acls[] = createAcls(group, user)
    folder = createFolder(group, user);
    applyAclsToFolder(folder, acls)
    completeTransaction();
    finally
    If transaction not completed
    abortTransaction()
    return group;

  • How do I create multiple objects during runtime?

    I don't know how to create multiple objects during runtime, here's my problem:
    I get a String as input. Then I create an object called newobject. I put the object in a hashtable with the above string as key.
    Then comes the problem, in order to create a new object, I have to rerun the same class, which uses the same name (newobject) to create a 2nd object. Now my hashtable doesn't reference to my 1st object anymore...
    Is there anyway I can fill up the hashtable with different objects, and make each key point to each object it was supposed to?
    For those who want to see a bit of the program:
    public class PlayBalloon{
    public Hashtable ht = new Hashtable();
    for(){
    Balloon pB = newBalloon;
    newBalloon=new Balloon(pB);
    ht.put("Some input from user", newBalloon);
    for(){
    ht.get(s).draw;<= s=string, draw=own meth. in Balloon
    }

    I think i can see the problem that you are having. You have, in effect, duplicate keys in your hashtable - ie, two strings used as keys with the same name.
    The way that a hashtable works is as follows...
    When you ask for a value that is mapped to a key it will go through the table and return the first occurence it finds of the key you asked for. It does this by using the equals() method of whatever object the key is (in your case it is a String).
    If you cant use different Strings for your keys in your hashtable then i would consider writing an ObjectNameKey class which contains the String value that you are trying to put in the hashtable and an occurrence number/index or something to make it unique. Remember to override the equals method in your ObjectNameKey object or else the hash lookup will not work. For example
    class ObjectNameKey {
        private String name;
        private int occurence;
        public ObjectNameKey(String name, int occ) {
            this.name = name;
            this.occurence = occ;
        public String getName() {
            return name;
        public String getOccur() {
            return occurence;
        public boolean equals(Object o) {
            if (!(o instanceof ObjectNameKey)) {
                return false;
            ObjectNameKey onk = (ObjectNameKey)o;
            if (onk.getName().equals(name) && onk.getOccur() == occurence) return true;
            return false;

  • Creating multiple instances of a class in LabVIEW object-oriented programming

    How do you create multiple instances of a class in a loop?  Or am I thinking about this all wrong?
    For instance, I read in a file containing this information:
    Person Name #1
    Person Age #1
    Hobby #1
    Hobby #2
    Hobby #3
    Person Name #2
    Person Age #2
    Hobby #1
    Hobby #2
    Hobby #3
    Person Name #3
    Person Age #3
    Hobby #1
    Hobby #2
    Hobby #3
    If I define a Person class with name, age, and an array of strings (for the hobbies), how can I create several new Person instances in a loop while reading through the text file?
    FYI, new to LabVIEW OOP but familiar with Java OOP.  Thank you!

    First of all, let's get your terminology correct.  You are not creating multiple instances of a class.  You are creating Objects of the class.
    Use autoindexing to create an array of your class type.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Creating Views on multiple entity-objects

    Dear Forum,
    Is it possible to make associations and lookups based on multiple entity-objects.
    I made a custom view, say view1 based on two entity-objects, say entity1 and entity2.
    I used some fields from entity1 and some from entity2. There's a 1 to 1 association between the index of entity1 and entity2.
    Now I want to make a master-detail between entity1 and view1. I tried to make links and associations, but that didn't work.
    Any ideas?
    Kind regards,
    Arjen

    Arjen,
    I am a bit confused by what it is you need. It appears you may have Entity Object and View Objects mixed up. Entity Objects are one-to-one with database tables. So, for every table one Entity Object, and the other way around. Associations are, pretty much, one-to-one with foreign keys on the database. So, if two tables have a foreign key between them, the two Entity Objects will have an Association between them. In that respect, Entity Objects and Associations are usually 'strictly defined' by the database model.
    The layer of View Objects and View Links is where you 'get design control' in the Business Components arena. A View Object can be based on zero, one or more Entity Objects. Viewlink, defining 'Master-Detail' relationships between View Objects (and NOT Entity Objects!!) can but don't have to be based on Entity Associations (i.e. foreign keys), but can be based on any attribute in the 'Master' view to any attribute in the 'Detail' view.
    In this respect, your statement that you want to "make a master-detail between entity1 and view1" makes no sense. It sounds like you need to create a View2, and then make a View Link between View1 and View2.
    Kind regards,
    Peter Ebell
    JHeadstart Team

  • Create confirmation for multiple cost objects PO in SUS

    Hi,
    Is it possible to create confirmation for multiple cost objects PO ( order type 'MA') in SUS ?
    We are going to implement SRM 7.
    Thanks & regards,
    Afandi-

    Hi All,
    First of all, thanks for your responses..
    Right, about the issue, what I explained here was that I am indeed assigning only one cost object: the WBS element. The issue was that even though I am assigning only the WBS element, it was also assigning the cost to the cost center by default. I did some R&D and found the solution to the issue (I was also asked to look for OSS notes but was not satisfied that this issue needs an OSS note to be applied so tried my solution). The issue was in table: T788M (allocate costs to variable account assignment). Here, I created an entry and called it USERGROUP_2 (just a random name) and assigned the variable cost objects (only the WBS and the Cost center) to be displayed. In the next step, I assigned this usergroup to the country in quesion feature (TRVCO). By doing this, I tell the system that only these cost objects are to be considered when an employee wants to assign the cost object. If the system sees that there is no value from the drop down to choose from, it picks up the default cost object (cost center). This was a simple issue that I had to rattle my brains on... but the solution I mention above worked like a hot knife going through butter...
    If you guys face this issue, please try this else feel free to get in touch with me on my number below.
    Once again, thanks for your responses.
    Best regards,
    Tanmay Dhingra
    +91 880 6666 606

  • How can we create an entity object using multiple tables?

    Hi All,
    I'm a newbie to OAF.
    I'm trying to create a simple page using OAF.
    While creating Entity object, there is an option to add the database objects from which we can create our Entity Object.
    There we can enter only one database object.
    If suppose I need to create a Entity object by using mutiple data base objects, how can I add other database objects?
    Is there any option for multiple selection of database objects there?
    Thanks in Advance

    User,
    a). You should use the [url http://forums.oracle.com/forums/forum.jspa?forumID=210]OA Framework Forum for this question.
    b). Entity objects always correspond to a single table. I think you want to create a View object instead.
    c). Really, you want to be using the OA Framework forum.
    John

  • Updation problem while creating multiple objects from enterprise portal

    Hi All,
    From enterprise portal i am calling an RFC 'BAPI_PROJECT_MAINTAIN' to create objects .
    While trying to create multiple objects simultaneously it gives error "sapuser is currently using, can't be created".
    It seems like as i am creating multiple objects by calling RFC repeatedly , while the first one is not updated fully i am sending the second value to be processed.
    Pl. tell me how to overcome this. Do I need to add any sleep time in EP or any other method is there in SAP to overcome this situation.
    thanks
    sandeep

    Dear Sandeep,
    I have discussed this problem with EP team lead in my organisation, i have given your email id to him he will forward the solution on your id.
    If usefull reward points helpfull....
    Regards,
    Rajneesh Gupta

  • Creating Multiple Windows

    Hi,
    I am trying to create a java applet that links to multiple windows when clicked. Basically I will have an applet with 2 buttons, one saying "show calculator," the other saying "mortgage." Upon clicking each one, it should open the corresponding window. The way I currently have it setup is first I have written the applet wiht the 2 buttons, right under it I have written the Mortgage application, then under that the calculator application. The problem I have now is that both the Mortgage and calculator applications have a main method, therefore, the filename must be named one of those application names (for example the mortgage is setup as: public class Mortgage; the calculator is setup as: public class calculator-both have different names-so I must save the file as Mortgage.java or Calculator.java), otherwise I will get an error. If I create each application in a different file, and for the button action if I set the corresponding file to
    true (eg. mortgage.setVisible(true);) i.e if I click on Morttgage in the applet, will it know to look for the mortgage file in the directory then show it? Or am I misunderstanding this? Please help. Thanks in advance.

    Thanks for the response. As s reference , this is what I have so far:
    //Button Applet
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.swing.border.TitledBorder;
    public class ButtonAppletDemo extends JApplet implements ActionListener
         private JButton jbtCalculator, jbtMortgage;
         //Initialize Applet
         public void init()
              //Create Panel P1 for Button
              JPanel p1 = new JPanel();
              p1.setLayout(new FlowLayout());
              p1.add(jbtCalculator =      new JButton("Simple Calculator"));
              //Create Panel p2 for Button
              JPanel p2 = new JPanel();
              p2.setLayout(new FlowLayout());
              p2.add(jbtMortgage = new JButton("Mortgage"));
              //Add panels to applet
              getContentPane().add(p1, BorderLayout.WEST);
              getContentPane().add(p2, BorderLayout.EAST);
              //Register listeners
              jbtCalculator.addActionListener(this);
              jbtMortgage.addActionListener(this);
         //Handle the button actions
         public void actionPerformed(ActionEvent e)
              if (e.getSource() instanceof JButton)
                   if ("Simple Calculator".equals(actionCommand))
                   MortgageApplication.setVisible(true);
                   else if("Mortgage".equals(actionCommand))
                   MenuDemo.setVisible(true);
    //Mortgage Application
    public class MortgageApplication extends JFrame implements ActionListener
    //Declare and create fields for interest rate, year, loan amount, monthly
    payment, and total payment
    private JTextField jtfAnnualInterestRate = new JTextfield(10);
    private JTextField jtfNumOfYears = new JTextfield(10);
    private JTextField jtfLoanAmount = new JTextfield(10);
    private JTextField jtfMonthlyPayment = new JTextfield(10);
    private JTextField jtfAnnualTotalPayment = new JTextfield(10);
    //Declare and create a Compute Mortgage Button
    private JButton jbtComputeMortgage = new JButton("Compute Mortgage");
    //Constructor
    public MortgageApplication()
         //Set propertied on the text fields
         jtfMonthlyPayment.setEditable(false);
         jtfTotalPayment.setEditable(false);
         //Right Align text fields
         jtfAnnualInterestRate.setHorizontalAlignment(JTextField.RIGHT);
         jtfNumOfYears.setHorizontalAlignment(JTextField.RIGHT);
         jtfLoanAmount.setHorizontalAlignment(JTextField.RIGHT);
         jtfMonthlyPayment.setHorizontalAlignment(JTextField.RIGHT);
         jtfAnnualTotalPayment.setHorizontalAlignment(JTextField.RIGHT);
         //Panel P1 to hold labels and text fields
         JPanel p1 = new JPanel();
         p1.setLayout(new GridLayout(5,2));
         p1.add(new Label("Interest Rate"));
         p1.add(jtfAnnualInterestRate);
         p1.add(new Label("Years"));
         p1.add(jtfNumOfYears);
         p1.add(new Label("Loan Amount"));
         p1.add(jtfLoanAmount);
         p1.add(new Label("Monthly Payment"));
         p1.add(jtfMonthlyPayment);
         p1.add(new Label("Total Payment"));
         p1.add(jtfTotalPayment);
         p1.setBorder(new TitledBorder("Enter interest rate, year, and loan
    amount"));
         //Panel P2 to hold button
         JPanel p2 = new JPanel();
         p2.setLayout(new FlowLayout(FlowLayout.Right));
         p2.add(jbtComputeMortgage);
         //Add the components to the applet
         getContentPane().add(p1, BorderLayout.CENTER);
         getContentPane().add(p2, BorderLayout.SOUTH);
         //Register Listner
         jbtComputeMortgage.addActionListener(this);
    //Main Method
    public static void main(String[] args)
         MortgageApplication frame = new MortgageApplication();
         frame.setTitle("Mortgage Application");
         frame.setSize(400, 200);
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.setVisible(true);
    //Handler for Button
    public void actionPerformed(ActionEvent e)
         if(e.getSource() == jbtComputeMortgage)
              //Get values from text fields
              double interest =
    (Double.valueOf(jtfAnnualInterestRate.getText())).doubleValue();
              int year = (Integer.valueOf(jtfNumOfYears.getText())).intValue();
              double loan = (Double.valueOf(jtfLoanAmount.getText())).doubleValue();
              //Create a mortgage object
              Mortgage m = new Mortgage(interest, year, loan);
              //Display monthly and total payment
              jtfMonthlyPayment.setText(String.valueOf(m.monthlyPayment()));
              jtfTotalPayment.setText(String.valueOf(m.totalPayment()));
    // MenuDemo Application
    public class MenuDemo extends JFrame implements ActionListener
    // Text fields for Number 1, Number 2, and Result
    private JTextField jtfNum1, jtfNum2, jtfResult;
    // Buttons "Add", "Subtract", "Multiply" and "Divide"
    private JButton jbtAdd, jbtSub, jbtMul, jbtDiv;
    // Menu items "Add", "Subtract", "Multiply","Divide" and "Close"
    private JMenuItem jmiAdd, jmiSub, jmiMul, jmiDiv, jmiClose;
    // Main method
    public static void main(String[] args)
    MenuDemo frame = new MenuDemo();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
    // Default constructor
    public MenuDemo()
    setTitle("Menu Demo");
    // Create menu bar
    JMenuBar jmb = new JMenuBar();
    // Set menu bar to the frame
    setJMenuBar(jmb);
    // Add menu "Operation" to menu bar
    JMenu operationMenu = new JMenu("Operation");
    operationMenu.setMnemonic('O');
    jmb.add(operationMenu);
    // Add menu "Exit" in menu bar
    JMenu exitMenu = new JMenu("Exit");
    exitMenu.setMnemonic('E');
    jmb.add(exitMenu);
    // Add menu items with mnemonics to menu "Operation"
    operationMenu.add(jmiAdd= new JMenuItem("Add", 'A'));
    operationMenu.add(jmiSub = new JMenuItem("Subtract", 'S'));
    operationMenu.add(jmiMul = new JMenuItem("Multiply", 'M'));
    operationMenu.add(jmiDiv = new JMenuItem("Divide", 'D'));
    exitMenu.add(jmiClose = new JMenuItem("Close", 'C'));
    // Set keyboard accelerators
    jmiAdd.setAccelerator(
    KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
    jmiSub.setAccelerator(
    KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    jmiMul.setAccelerator(
    KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK));
    jmiDiv.setAccelerator(
    KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK));
    // Panel p1 to hold text fields and labels
    JPanel p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(new JLabel("Number 1"));
    p1.add(jtfNum1 = new JTextField(3));
    p1.add(new JLabel("Number 2"));
    p1.add(jtfNum2 = new JTextField(3));
    p1.add(new JLabel("Result"));
    p1.add(jtfResult = new JTextField(4));
    jtfResult.setEditable(false);
    // Panel p2 to hold buttons
    JPanel p2 = new JPanel();
    p2.setLayout(new FlowLayout());
    p2.add(jbtAdd = new JButton("Add"));
    p2.add(jbtSub = new JButton("Subtract"));
    p2.add(jbtMul = new JButton("Multiply"));
    p2.add(jbtDiv = new JButton("Divide"));
    // Add panels to the frame
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(p1, BorderLayout.CENTER);
    getContentPane().add(p2, BorderLayout.SOUTH);
    // Register listeners
    jbtAdd.addActionListener(this);
    jbtSub.addActionListener(this);
    jbtMul.addActionListener(this);
    jbtDiv.addActionListener(this);
    jmiAdd.addActionListener(this);
    jmiSub.addActionListener(this);
    jmiMul.addActionListener(this);
    jmiDiv.addActionListener(this);
    jmiClose.addActionListener(this);
    // Handle ActionEvent from buttons and menu items
    public void actionPerformed(ActionEvent e)
    String actionCommand = e.getActionCommand();
    // Handle button events
    if (e.getSource() instanceof JButton)
    if ("Add".equals(actionCommand))
    calculate('+');
    else if ("Subtract".equals(actionCommand))
    calculate('-');
    else if ("Multiply".equals(actionCommand))
    calculate('*');
    else if ("Divide".equals(actionCommand))
    calculate('/');
    else if (e.getSource() instanceof JMenuItem)
    // Handle menu item events
    if ("Add".equals(actionCommand))
    calculate('+');
    else if ("Subtract".equals(actionCommand))
    calculate('-');
    else if ("Multiply".equals(actionCommand))
    calculate('*');
    else if ("Divide".equals(actionCommand))
    calculate('/');
    else if ("Close".equals(actionCommand))
    System.exit(0);
    // Calculate and show the result in jtfResult
    private void calculate(char operator)
    // Obtain Number 1 and Number 2
    int num1 = (Integer.parseInt(jtfNum1.getText().trim()));
    int num2 = (Integer.parseInt(jtfNum2.getText().trim()));
    int result = 0;
    // Perform selected operation
    switch (operator) {
    case '+': result = num1 + num2;
    break;
    case '-': result = num1 - num2;
    break;
    case '*': result = num1 * num2;
    break;
    case '/': result = num1 / num2;
    // Set result in jtfResult
    jtfResult.setText(String.valueOf(result));

  • How do I create multiple TEBs with one submit button on one page in Captivate 7

    I've read other posts on this topic (which refer primarily to earlier versions of Captivate) and am still at a loss as to how to put multiple text entry boxes on a page with one submit button. Here's my scenario:
    I am creating test questions.
    Each test question has multiple text entry boxes (for numbers only).
    Student should be able to enter numbers into the textboxes in any order.
    Then there is one Submit button that should initiate validating all the text entries, and move to a scoring page (so I can test it). (What would be best is if this button not only did the above, but also submitted scores to the LMS.  But that is not my question at this time.)
    I'd like this question to be set up as a template so that I can duplicate it, be able to add or delete text boxes and change the values required in the text boxes.  
    Here is an image of a sample question page with multiple TEBs. The yellow boxes tell the student where they need to enter text:
    Any help or direction to help is appreciated!!

    I think the problem here is that Arlhoolie wants all of the different TEBs to behave as if they were part of a single interaction that submits only ONE result to the quiz.  Using multiple TEBs in Captivate means that you have multiple scored objects and therefore multiple results being submitted to the quiz.
    If you want a single Success or Failure result submitted to the quiz based on the results from multiple interactive objects then there really is no simple way to do it.  But you could try using the Infosemantics Interactive Master widget to combine all the TEBs as slave objects that report to the Master Widget, which then reports a single score to the quiz based on the results from the slave objects.
    You can learn more about the Master widget here:
    http://www.infosemantics.com.au/adobe-captivate-widgets/interactive-master
    http://www.infosemantics.com.au/interactivemaster/help
    You can download a free trial version of the widget here:
    http://www.infosemantics.com.au/adobe-captivate-widgets/download-free-trial-widgets
    One caveat you should be aware of is that this widget is not HTML5 compatible.

Maybe you are looking for

  • Slowing down

    Not sure where else to post this. Having problems with my Imac being extremely slow on start up and in general. Ran first aid section of disk utility program. Ran the verify disk permissions and repair disk permissions no problem. Ran verify disk and

  • Final Cut HD 4.5 and 10.4.4

    After updating to 10.4.4 final cut HD 4.5 will no longer open. every time i go to open the program it begins to load but then stops and an error message comes up saying the program unexpectadly quit. I am on a 15" powerbook 1.5ghz. thanks. casey

  • How do I log onto airport, how do I get to the DMZ on the router?

    How do I log onto airport, how do I get to the DMZ on the router?

  • Is there a Report Painter mass generate?

    We are in the process of upgrading to ECC 6.0 and all of our Z* Report Painters were not regenerated.  We can do them one at a time in trans code 'GRR3'.  I was wondering if there was a way to mass generate all Z* Report Painters at once?

  • Portability of files using third-party Live Effects/filters?

    I'm using Phantasm in my Illustrator file to adjust colors. (http://www.astutegraphics.com/products/phantasm/) I need to send my final files to a production house to get them printed. If they don't have Phantasm on their computers, are my color adjus