User Defined methods

Hi,
I have a query as to where are the user defined methos in jsp/servlets are stored after compilation.
and in a given jsp page 1.jsp when i include 2 files (2.jsp and 3.jsp). so when the 1.jsp gets loaded then in all how much total .class files get created?
Thanks

Sounds like homework question. At least I don't stop you from looking in the class folder yourself.

Similar Messages

  • Problem with user defined methods

    Hello,
    I have created a user-defined method using the constructer and a number of sub-methods. The toString method is supposed to return the maximum, minimum, average, and median for an input data set. This program compiles with no problem, but doesn't seem to calculate the statistics. The max, min, med, and mean are all 0. Any help would be appreciated. Thanks a lot.
    import java.util.*;
    public class SO{
    private String id;
    private int N;
    private double[] data;
    private double average;
    private double minimum;
    private double maximum;
    private double med;
         public SO(){
         public void readData(){
              Scanner keyBoard = new Scanner(System.in);
              System.out.println("Enter the id: ");
              id = keyBoard.nextLine();
              System.out.println("Enter the amount of data values in the id: ");
              N = keyBoard.nextInt();
              data = new double[N];
              System.out.println("Enter the values one line at a time: ");
              int j = 0;
              for(int h=0; h<=N-1; h++){
                   data[h] = keyBoard.nextDouble();
              Arrays.sort(data);
         public void setDataValue(int k, double v){
              data[k] = v;
              System.out.printf("Changing data[%d] to %f", k, v);     
         public double getDataValue(int k){
              double get = data[k];
              return get;
         private double mean(){
              double sum = 0;
              for(int k = 0; k<=N-1; k++){
                   sum = sum + data[k];
              average = sum/N;
              return average;
         private double min(){
              minimum = data[0];
              return minimum;
         private double max(){
              maximum = data[N-1];
              return maximum;
         private double median(){
              if(N%2 != 0){
                   med = data[N/2];
              else if(N%2 == 0){
                   med = (data[N/2] + data[N/2-1])/2.;
              return med;
         public void displayData(){
              System.out.printf("[");
              for(int k = 0; k<=N-1; k++){
                   System.out.printf("%.2f", data[k]);
                   if(k != N-1){
                        System.out.printf(", ");
              System.out.printf("]");
         public void sortData(){
              Arrays.sort(data);
              System.out.printf("[");
              for(int k = 0; k<=N-1; k++){
                   System.out.printf("%.2f", data[k]);
                   if(k != N-1){
                        System.out.printf(", ");
              System.out.printf("]");
         public void analyzeData(){
              System.out.println(this);     
         public String toString(){
              return id +"\n" + "minimum = " + minimum + "\n" + "maximum = " + maximum + "\n" + "median = " + med + "\n" + "mean = " + average;
         public static void main(String[] args){
              SO v = new SO();
              System.out.println("Read Data");
              v.readData();
              System.out.println("Display Data");
              v.displayData();
              System.out.println("Analyze Data");
              v.analyzeData();
              System.out.println("Set Data\n");
              v.setDataValue(0,98.75);
              v.displayData();
              System.out.println("Sort Data");
              v.sortData();
              System.out.println("Access Data\n");
              System.out.println("data[0] = " + v.getDataValue(0));
              System.out.println("\nDisplay v");
              System.out.println(v);
    }

    Sorry
    import java.util.*;
    public class SO{
       private String id;      
       private int N;          
       private double[] data;
       private double average;
       private double minimum;
       private double maximum;
       private double med;
         public SO(){
            public void readData(){
                 Scanner keyBoard = new Scanner(System.in);
              System.out.println("Enter the id: ");
              id = keyBoard.nextLine();
              System.out.println("Enter the amount of data values in the id: ");
              N = keyBoard.nextInt();
              data = new double[N];
              System.out.println("Enter the values one line at a time: ");
              int j = 0;
              for(int h=0; h<=N-1; h++){
                   data[h] = keyBoard.nextDouble();
              Arrays.sort(data);
            public void setDataValue(int k, double v){
                 data[k] = v;
              System.out.printf("Changing data[%d] to %f", k, v);     
            public double getDataValue(int k){
                 double get = data[k];
              return get;
            private double mean(){
                 double sum = 0;
              for(int k = 0; k<=N-1; k++){
                   sum = sum + data[k];
              average = sum/N;
              return average;
            private double min(){
                 minimum = data[0];
              return minimum;
            private double max(){
                 maximum = data[N-1];
              return maximum;
            private double median(){
                 if(N%2 != 0){
                   med = data[N/2];
              else if(N%2 == 0){
                   med = (data[N/2] + data[N/2-1])/2.;
              return med;
            public void displayData(){
                 System.out.printf("[");
              for(int k = 0; k<=N-1; k++){
                   System.out.printf("%.2f", data[k]);
                   if(k != N-1){
                        System.out.printf(", ");
              System.out.printf("]");
            public void sortData(){
                 Arrays.sort(data);
              System.out.printf("[");
              for(int k = 0; k<=N-1; k++){
                   System.out.printf("%.2f", data[k]);
                   if(k != N-1){
                        System.out.printf(", ");
              System.out.printf("]");
            public void analyzeData(){
                 System.out.println(this);       
            public String toString(){
                 return id +"\n" + "minimum = " + minimum + "\n" + "maximum = " + maximum + "\n" + "median = " + med + "\n" + "mean = " + average;
         public static void main(String[] args){
              SO v = new SO();
              System.out.println("Read Data");
                     v.readData();
                     System.out.println("Display Data");
                     v.displayData();
                     System.out.println("Analyze Data");
                     v.analyzeData();
                     System.out.println("Set Data\n");
                     v.setDataValue(0,98.75);
                     v.displayData();
                     System.out.println("Sort Data");
                     v.sortData();
                     System.out.println("Access Data\n");
                     System.out.println("data[0] = " + v.getDataValue(0));
                     System.out.println("\nDisplay v");
                     System.out.println(v);
    }

  • User defined methods as variable input

    Hello everyone.
    I'm reading through a teach yourself java programming guide and am a little confused about a couple things when it comes to variables and methods.
    I was wondering if it is "legal" to use a method as a variable input. Ex:
    variable = usermethod(num1, 23.43, 32.13); /* Assuming the variable and method parameters
    are of the same data type */
    I was also wondering if you can call a method as output to the stand output such as:
    System.out.println(usermethod(num1, 23.43, 32.13));
    I think that these are vaild uses but this book is not very clear on this point, it simply says that a user defined method is called from the method main and if it is a return type it will return a value. I assume that the returned value can be store in a variable using the syntax above, am I correct?

    Whenever the compiler sees a method name, it calls the method to get a return value from it. Both of those lines above are legal.
    You can use a method call pretty much anywhere you would put an expression; for example, if you had a function foo() which took an int, and you had another function bar() which returned an int, you could call foo() like this:
    foo(bar());Just make sure that methods you pass to other methods don't result in any unintended side-effects, such as printing to the screen.

  • Call a user defined method in web dynpro from interactive forms

    Hi All,
    how to call a user defined method in web dynpro java, when a selecting value from drop down list which is in interactive forms by adobe
    thanks.
    Edited by: venkat99 on May 24, 2010 4:52 PM

    Well, you can use F4 help, of course, check here: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/a1900622ec062be10000000a42189d/frameset.htm
    You need to select the value first and then use the submit button, which is mapped to the WD action submit (you have to set this up in WD designer!!). To use the submit button for more actions, you need to use something like a hidden field, where the value is set according to the action you want to do with your submit button. The submit sends this value back to WD, where you can switch the program code according to the value.
    Otto
    p.s.: and maybe this blog can help: /people/shruti.rathour/blog/2008/02/07/uploading-sap-interactive-form-on-the-abap-webdynpro-view

  • User defined method

    Heres the score, I have created this game but I need to create a new method (which I have never done before and need some guidance) When you play the game after each shot the programme should tell you if you are hot or cold, but this is not doing it after each shot, plus at the end of the game the programme should tell the user how good they were at the game. Anyway that bit works but i need to create a method for the "how close" part of the window. Any help would be great.
    import javax.swing.JOptionPane;
    public class CourseworkPart1{
         public static void main(String args[]) {
              int randomNum, usersGuess = 0, diffNum, numGoes = 0;
              String output= "";
              String output2 = "";
              //generate a random between 1 and 10 inclusive
              randomNum = (int) (Math.random()*10) +1;
              //Allows the user to guess three times
           for (int numAttempts = 1; numAttempts <=10; numAttempts++){
              //users guess
              usersGuess = Integer.parseInt(JOptionPane.showInputDialog("please enter a number"+ randomNum));
              //difference between random number and users guess
            diffNum = (usersGuess - randomNum);
            //users guess compared to the generated random number
              if (randomNum == usersGuess){
                   output = "You won";
                   numGoes = numGoes ++;
            //call method
                   //else {
                   //     output = "The Random number was " + randomNum ;
                   //How close is the players guess
                switch (diffNum){
                    case 1:
                        output = "hot";
                        break;
                    case -1:
                       output = "hot";
                        break;
                 case 2:
                       output = "warm";
                    break;
                 case -2:
                       output = "warm";
                    break;
                 default:
                        output = "cold";
                        break;
               //Players ratings
               switch(numGoes){
                      case 1:
                           output = "champion";
                           break;
                      case 2:
                       output = "professional";
                       break;
                      case 3:
                       output = "advanced";
                       break;
                      default:
                       output = "amateur";
                       break;
              //print message
              JOptionPane.showMessageDialog(null, output, "Player's Guess",
                                                      JOptionPane.INFORMATION_MESSAGE);
    System.exit(0);
    //User defined method

    public class AATest1
         public static void displayEvaluation(String rating)
              System.out.println("You were: " + rating);
         public static void main(String[] args)
              String str = "hot";
              displayEvaluation(str);
    }

  • How to read a user defined java method inside a javascript

    I have a scenario where I have a form with 2 fields and a submit button. On clicking submit button, I call a javascript which needs to call a user-defined method.
    Please provide solution to do this and also please provide any useful links that i can go follow.
    Thanks

    Java != javascript.
    You can not call java directly from javascript.
    The lifecycle:
    Request received
    Java/JSP runs produces an HTML page
    Java stops running
    Javascript runs on page when page is loaded.
    The only way to call java code again is to submit a request and get the result back in a response. Traditionally the response is a new JSP page to replace the old one.
    Using AJAX the response can be just information that you then alter the current page with.
    The first example given by skp71 will probably NOT be what you are after. The java code is executed when you load the page, NOT when you push the button which is most probably what you are after.
    AJAX is a solution, as is loading a new page.
    Cheers,
    evnafets

  • How to call User Define Function

    Hi,
    I need a help....
    In my Project I have Login.jspx page in which there is a textbox Username.
    I have second success.jspx page which has its success.java bean class in which i have define a method "display()".Now i want to cal display() in my success.jspx page.
    can anyone help me out what is the way to do this.
    Thanks in advance...
    Thanks,
    Nehal

    Hi Abhijit,
    Sure i can give you more details on the same:
    I have written a displayVal method in ForgotPassword.java bean class
    public String displayVal() {    
    String txtVal = AdfFacesContext.getCurrentInstance().getPageFlowScope().get("testValue").toString();
    nameID.setValue(txtVal);
    return txtVal;
    Now in ForgotPassword.jspx page i have one input text box named "nameID" in which i want to display some value from the user-define method called displayVal()
    now i am trying to call my user-define method in my ForgotPassword.jspx page:
    <af:inputText label="Name"
    binding="#{backingBeanScope.backing_FrgtPwd.nameID}"
    id="nameID"
    value="#{backingBeanScope.backing_FrgtPwd.displayVal}">
    </af:inputText>
    but is is showing an error that: backingBeanScope.backing_FrgtPwd.displayVal is not a property as this a method.
    So now my query is : Is there any way by which i can call my user-define method on the jspx page from the bean class of the same page.

  • How to create instance of user defined suite

    I have create one user defined suite interface (ISuite) and inherite it to IsuiteASB and IsuiteCSB . The purpose of creating user defined suite is to provide hyphenation for selected text. I want to add a method which will detect whether a text has been selected by user or not , if selected then I am calling one hyphator function. I am not able to create an instance of user defined suite . I am using following syntax: <br />in UpdateActionState I am using <br />   InterfacePtr<ISuite>suite(ac->GetContextSelection(),UseDefaultIID()); <br /><br />in one user defined method I am using <br />  InterfacePtr<ISuite>suite(Utils<ISelectionUtils>()->GetActiveSelection() , UseDefaultIID()); <br /><br />Both calls unsuccessfull. <br /><br />Which Interface I should use to detect whether Text has been selected by user or ITextUtils or any other. <br />Please tell me the preoper way to create interface suite and create instance of it. <br />Thank you.

    I've seen this wording before ... Wait -- you must be referring to the SDK. Better post your question in the SDK forum, we're just helpless end-users, and in this case, clueless as well.

  • How can i send user defined Object as a argument to the MBean methods in authentication provider to create user?

    I developed our own Authentication, Identity Assertion & Authorization providers
    for weblogic 8.1 SP1. In the authenticator MBean i have one method which takes
    user defined object as a argument and returns a user defined object. i am able
    to call all the methods which takes java objects(for example: String, int, ArrayList,
    HashMap, Etc...) as a argument and returns also a java object but when i user
    any user defined object then it gives exception. if in the argument i used user
    defined object then it is not able to call that method telling NoSuchMethodException.
    Is there any way to use user defined object as an argument to MBean method?
    can anyone please help us as we r in the final stage of the project?
    Thanks
    Lakshmi

    "Lakshmi Padhy" <[email protected]> wrote in message
    news:3fc2f50c$[email protected]..
    >
    I developed our own Authentication, Identity Assertion & Authorizationproviders
    for weblogic 8.1 SP1. In the authenticator MBean i have one method whichtakes
    user defined object as a argument and returns a user defined object. i amable
    to call all the methods which takes java objects(for example: String, int,ArrayList,
    HashMap, Etc...) as a argument and returns also a java object but when iuser
    any user defined object then it gives exception. if in the argument i useduser
    defined object then it is not able to call that method tellingNoSuchMethodException.
    >
    Is there any way to use user defined object as an argument to MBeanmethod?
    >
    I seem to remember that jmx only supports scalar datatypes. Ask in the
    weblogic.developer.interest.management newsgroup.

  • Invoking methods on JMX with user defined objects.

    Hello, All.
    Here is the problem description: We need to expose methods on JMX which takes some object of user defined class. We are not able to do that. Meaning, it is not getting enabled and if we invoke through code it says exception with serialization things. So we tried to make user defined class to implement serialization by making it to implement Serializable [though just adding serialization id]. But still we are getting the same problem. So I think we are missing some small step; as we are completely new this we are looking for some help in how to provide methods on jmx which accepts arguments of user defined type.
    Thanks,
    Prasanna.

    When executing an operation via JMX using JConsole, I get the following error:
    Problem invoking getManifest : java.rmi.UnmarshallException: Error unmarshalling return: nested is: java.lang.ClassNotFoundException: foo.bar.InernalServiceException (no security manager: RMI class loader disabled)
    Code snippet:
    public ArrayList getManifest(String s) throws InternalServiceException, MBeanException{
    String path = ".\\foo_services.jar"; // Invalid path on purpose to test exception...
    File file = new File(path);
    FileInputStream fileInput;
    try {
    fileInput = new FileInputStream(file);
    } catch (FileNotFoundException e) {
    String msg = "The manifest file is not found in the given path";
    if (logger.isErrorEnabled()) logger.error(msg);
    throw new InternalServiceException(msg, ErrorConstants.JMX_FILE_NOT_FOUND);
    If I throw new RuntimeException(msg, e) instead of InternalServiceException(msg, ErrorConstants.JMX_FILE_NOT_FOUND), it works and I get the appropriate exception.
    What is the reason for this?

  • How to get the tag of the User Defined Variables using the Get Tag method%3F

    For the cRIO modules under a cRIO Chasis, a tag value can be obtained using the Get Tag method with crio.Type to the TagName input of the method. When it comes to the User Defined Variables, what should be fed to the TagName input?

    For the cRIO modules under a cRIO Chasis, a tag value can be obtained using the Get Tag method with crio.Type to the TagName input of the method. When it comes to the User Defined Variables, what should be fed to the TagName input?

  • Adding user-defined number of text fields.

    Okay I am having problems, obviously. I am developing a program where the user will enter X and Y values and the program will calculate the relational data. However, I can't even get a start.
    First of all, the user defines the number of pairs of points they want to define. For example, they have 20 points, each with its own X and Y, so they click on 20 and then okay in the first window.
    The next window will then take their answer and display X and Y text fields for as many points as they defined. However, I can't figure out any way to do this.
    Feel free to run the program, the problem lies in the method setTextFields(). Help please!
    import javax.swing.*;               //FOR SWING COMPONENT CLASSES
    import java.awt.*;                  //FOR CONTAINER CLASS
    import java.awt.event.*;            //FOR EVENT HANDLING
    public class RegressInput extends JFrame
        private JComboBox listJComboBox;        //COMBO BOX TO HOLD HOW MANY PAIRS OF DATA POINTS THE USER HAS TO ENTER
        private JButton answerButton;           //BUTTON TO CLICK AFTER SELECTING PAIRS OF DATA POINTS
        private JPanel textFieldTopPanel;       //TEXT FIELD TOP PANEL
        private JPanel textFieldBottomPanel;    //TEXT FIELD BOTTOM PANEL
        private JPanel textFieldPanel;           //TEXT FIELD PANEL   
        private CardLayout cardSelector;        //DECLARE CARD LAYOUT OBJECT   
        private JPanel cardDeck;                //DECLARE CARD PANEL OBJECT
        public RegressInput(String title)
            super(title);               //CALL SUPERCLASS CONSTRUCTOR
            //CREATE A CONTAINER
            Container container = getContentPane();
            //INSTANTIATE CARD LAYOUT OBJECT
            cardSelector = new CardLayout();
            //INSTANTIATE PANEL OBJECT
            cardDeck = new JPanel();
            //SET LAYOUT OF CARD DECK PANEL TO CARD LAYOUT
            cardDeck.setLayout(cardSelector);
            //DEFINE LABEL FOR FIRST CARD
            Label question = new Label("How many PAIRS of data would you like to enter?");
            //BUTTON TO SUBMIT NUMBER OF POINTS TO PLOT
            answerButton = new JButton("OK");
            listJComboBox = new JComboBox( getArray() );//USE getArray() METHOD TO SET ITEM LIST OF THE COMBO BOX
            listJComboBox.setMaximumRowCount(10);       //SETS THE VISIBLE NUMBER OF ITEMS TO THE USER
            Label xValues = new Label("X Values");      //LABEL FOR X values
            Label yValues = new Label("Y Values");      //LABEL FOR Y values
            //BUILD CARD DECK
            JPanel comboBoxCard = new JPanel();     //CREATE FIRST CARD
            comboBoxCard.add(question);             //ADD question LABEL TO FIRST CARD
            comboBoxCard.add(listJComboBox);        //ADD listJComboBox TO FIRST CARD
            comboBoxCard.add(answerButton);         //ADD answerButton TO FIRST CARD
            textFieldTopPanel = new JPanel();       //CREATE TOP PANEL OF SECOND CARD
            textFieldTopPanel.add(xValues);         //ADD xValues Label TO SECOND CARD
            textFieldTopPanel.add(yValues);         //ADD yValues Label TO SECOND CARD
            textFieldBottomPanel = new JPanel();    //CREATE BOTTOM PANEL OF SECOND CARD
            textFieldBottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));    //SET LAYOUT FOR BOTTOM PANEL
            textFieldPanel = new JPanel();          //CREATE PANEL FOR SECOND CARD
            textFieldPanel.setLayout(new BorderLayout(10, 10)); //SET LAYOUT FOR SECOND CARD
            textFieldPanel.add(textFieldTopPanel, "North"); //ADD textFieldTopPanel TO NORTH
            textFieldPanel.add(textFieldBottomPanel, "South");  //ADD textFieldBottomPanel TO SOUTH
            cardDeck.add(comboBoxCard, "Step 1");       //ADD FIRST CARD TO DECK
            cardDeck.add(textFieldPanel, "Step 2");     //ADD SECOND CARD TO DECK
            container.add(cardDeck);                    //ADD CARD DECK TO CONTAINER
            //DEFINE BUTTON HANDLER OBJECT
            ButtonHandler buttonHandler = new ButtonHandler();
            //ADD ACTION LISTENER FOR BUTTONS
            answerButton.addActionListener(new ButtonHandler());
        }//END RegressInput() CONSTRUCTOR
        //METHOD TO CREATE AND RETURN AN ARRAY OF VALUES FOR JComboBox
        private String[] getArray()
            //CREATE ARRAY TO HOLD 30 VALUES
            int numbers[] = new int[29];
            //CREATE int IN ORDER TO START THE ARRAY AT 2 INSTEAD OF 1
            int number = 2;
            //ASSIGN VALUES FROM 2 TO 30 TO numbers[] ARRAY
            for(int count=0; count < 29; ++count)
                numbers[count] = number;        //SETS EACH INDEX TO number
                number++;                       //INCREMENTS number
            }//END for LOOP
            //CREATE pairs[] ARRAY TO HOLD 30 STRINGS
            String pairs[] = new String[29];
            //ASSIGN VALUES 1 TO 30 IN STRING ARRAY FOR COMBO BOX
            for(int count = 0; count < 29; ++count)
                pairs[count] = "" + numbers[count];
            }//END for LOOP
            return pairs;//RETURNS pairs[] ARRAY FOR THE LIST ITEMS IN listJComboBox
        }//END getArray() METHOD8
        //RETURNS THE ITEM SELECTED BY THE USER FROM THE JComboBox
        private int getValue()
            //ASSIGNS STRING VALUE OF THE JComboBox TO A WRAPPER
            Integer v = new Integer((String) listJComboBox.getSelectedItem());
            //ASSIGNS WRAPPER VALUE TO int
            int value = v.intValue();
            //RETURN VALUE OF SELECTED ITEM
            return value;
        }//END getValue()
        private void setTextFields()
        {//HERE LIES THE PROBLEM! WHAT GOES IN THIS METHOD????
            for(int count = 0; count < (2 * getValue()); ++count)
        }//END setTextFields()
        //BUTTON EVENT HANDLER CLASS
        private class ButtonHandler implements ActionListener
         //PROCESS EVENT
            public void actionPerformed(ActionEvent e)
                //WHICH BUTTON CAUSED THE EVENT?
                if(e.getSource() == answerButton)
                    cardSelector.last(cardDeck);
                    cardDeck.setSize(600,600);
                }//END if STATEMENT
            }//END actionPerformed()
        }//END ButtonHandler CLASS
    }//END RegressInput CLASSHere is main:
    import javax.swing.JFrame;
    public class TestSharpStats
         public static void main(String[] args)
            //DEFINE FRAME OBJECT
            RegressInput window = new RegressInput("Hi");     //SETS TITLE BAR
            window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      //CLOSES WINDOW
            window.setSize(400, 600);    //SET FRAME SIZE
            window.setResizable(true);  //PREVENTS USER FROM RESIZING WINDOW
            window.setVisible(true);     //SETS window TO VISIBLE
        }//END main()
    }//END TestSharpStats CLASS

    muit-post: http://forum.java.sun.com/thread.jspa?messageID=4442652

  • Adding user-defined data

    Okay I am having problems, obviously. I am developing a program where the user will enter X and Y values and the program will calculate the relational data. However, I can't even get a start.
    First of all, the user defines the number of pairs of points they want to define. For example, they have 20 points, each with its own X and Y, so they click on 30 and then okay in the first window.
    The next window will then take their answer and display X and Y text fields for as many points as they defined. However, I can't figure out any way to do this.
    Feel free to run the program, the problem lies in the method setTextFields(). Help please!
    import javax.swing.*;               //FOR SWING COMPONENT CLASSES
    import java.awt.*;                  //FOR CONTAINER CLASS
    import java.awt.event.*;            //FOR EVENT HANDLING
    public class RegressInput extends JFrame
        private JComboBox listJComboBox;        //COMBO BOX TO HOLD HOW MANY PAIRS OF DATA POINTS THE USER HAS TO ENTER
        private JButton answerButton;           //BUTTON TO CLICK AFTER SELECTING PAIRS OF DATA POINTS
        private JPanel textFieldTopPanel;       //TEXT FIELD TOP PANEL
        private JPanel textFieldBottomPanel;    //TEXT FIELD BOTTOM PANEL
        private JPanel textFieldPanel;           //TEXT FIELD PANEL   
        private CardLayout cardSelector;        //DECLARE CARD LAYOUT OBJECT   
        private JPanel cardDeck;                //DECLARE CARD PANEL OBJECT
        public RegressInput(String title)
            super(title);               //CALL SUPERCLASS CONSTRUCTOR
            //CREATE A CONTAINER
            Container container = getContentPane();
            //INSTANTIATE CARD LAYOUT OBJECT
            cardSelector = new CardLayout();
            //INSTANTIATE PANEL OBJECT
            cardDeck = new JPanel();
            //SET LAYOUT OF CARD DECK PANEL TO CARD LAYOUT
            cardDeck.setLayout(cardSelector);
            //DEFINE LABEL FOR FIRST CARD
            Label question = new Label("How many PAIRS of data would you like to enter?");
            //BUTTON TO SUBMIT NUMBER OF POINTS TO PLOT
            answerButton = new JButton("OK");
            listJComboBox = new JComboBox( getArray() );//USE getArray() METHOD TO SET ITEM LIST OF THE COMBO BOX
            listJComboBox.setMaximumRowCount(10);       //SETS THE VISIBLE NUMBER OF ITEMS TO THE USER
            Label xValues = new Label("X Values");      //LABEL FOR X values
            Label yValues = new Label("Y Values");      //LABEL FOR Y values
            //BUILD CARD DECK
            JPanel comboBoxCard = new JPanel();     //CREATE FIRST CARD
            comboBoxCard.add(question);             //ADD question LABEL TO FIRST CARD
            comboBoxCard.add(listJComboBox);        //ADD listJComboBox TO FIRST CARD
            comboBoxCard.add(answerButton);         //ADD answerButton TO FIRST CARD
            textFieldTopPanel = new JPanel();       //CREATE TOP PANEL OF SECOND CARD
            textFieldTopPanel.add(xValues);         //ADD xValues Label TO SECOND CARD
            textFieldTopPanel.add(yValues);         //ADD yValues Label TO SECOND CARD
            textFieldBottomPanel = new JPanel();    //CREATE BOTTOM PANEL OF SECOND CARD
            textFieldBottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));    //SET LAYOUT FOR BOTTOM PANEL
            textFieldPanel = new JPanel();          //CREATE PANEL FOR SECOND CARD
            textFieldPanel.setLayout(new BorderLayout(10, 10)); //SET LAYOUT FOR SECOND CARD
            textFieldPanel.add(textFieldTopPanel, "North"); //ADD textFieldTopPanel TO NORTH
            textFieldPanel.add(textFieldBottomPanel, "South");  //ADD textFieldBottomPanel TO SOUTH
            cardDeck.add(comboBoxCard, "Step 1");       //ADD FIRST CARD TO DECK
            cardDeck.add(textFieldPanel, "Step 2");     //ADD SECOND CARD TO DECK
            container.add(cardDeck);                    //ADD CARD DECK TO CONTAINER
            //DEFINE BUTTON HANDLER OBJECT
            ButtonHandler buttonHandler = new ButtonHandler();
            //ADD ACTION LISTENER FOR BUTTONS
            answerButton.addActionListener(new ButtonHandler());
        }//END RegressInput() CONSTRUCTOR
        //METHOD TO CREATE AND RETURN AN ARRAY OF VALUES FOR JComboBox
        private String[] getArray()
            //CREATE ARRAY TO HOLD 30 VALUES
            int numbers[] = new int[29];
            //CREATE int IN ORDER TO START THE ARRAY AT 2 INSTEAD OF 1
            int number = 2;
            //ASSIGN VALUES FROM 2 TO 30 TO numbers[] ARRAY
            for(int count=0; count < 29; ++count)
                numbers[count] = number;        //SETS EACH INDEX TO number
                number++;                       //INCREMENTS number
            }//END for LOOP
            //CREATE pairs[] ARRAY TO HOLD 30 STRINGS
            String pairs[] = new String[29];
            //ASSIGN VALUES 1 TO 30 IN STRING ARRAY FOR COMBO BOX
            for(int count = 0; count < 29; ++count)
                pairs[count] = "" + numbers[count];
            }//END for LOOP
            return pairs;//RETURNS pairs[] ARRAY FOR THE LIST ITEMS IN listJComboBox
        }//END getArray() METHOD8
        //RETURNS THE ITEM SELECTED BY THE USER FROM THE JComboBox
        private int getValue()
            //ASSIGNS STRING VALUE OF THE JComboBox TO A WRAPPER
            Integer v = new Integer((String) listJComboBox.getSelectedItem());
            //ASSIGNS WRAPPER VALUE TO int
            int value = v.intValue();
            //RETURN VALUE OF SELECTED ITEM
            return value;
        }//END getValue()
        private void setTextFields()
        {//HERE LIES THE PROBLEM! WHAT GOES IN THIS METHOD????
            for(int count = 0; count < (2 * getValue()); ++count)
        }//END setTextFields()
        //BUTTON EVENT HANDLER CLASS
        private class ButtonHandler implements ActionListener
         //PROCESS EVENT
            public void actionPerformed(ActionEvent e)
                //WHICH BUTTON CAUSED THE EVENT?
                if(e.getSource() == answerButton)
                    cardSelector.last(cardDeck);
                    cardDeck.setSize(600,600);
                }//END if STATEMENT
            }//END actionPerformed()
        }//END ButtonHandler CLASS
    }//END RegressInput CLASS
    Here is main:
    import javax.swing.JFrame;
    public class TestSharpStats
         public static void main(String[] args)
            //DEFINE FRAME OBJECT
            RegressInput window = new RegressInput("Hi");     //SETS TITLE BAR
            window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);      //CLOSES WINDOW
            window.setSize(400, 600);    //SET FRAME SIZE
            window.setResizable(true);  //PREVENTS USER FROM RESIZING WINDOW
            window.setVisible(true);     //SETS window TO VISIBLE
        }//END main()
    }//END TestSharpStats CLASS

    If your teacher taught you to program like this they should be shot. There is no need to comment every single line (especially in upper case). The comments stand out more that the code does and doesn't add any usefull information. Obviously comments are important, but you need to pick and choose when to use them.
    Swing related questions should be posted in the Swing forum.
    Also, don't use AWT components in a Swing application. Label is AWT. JLabel is Swing.
    I would use a JTable to input the matching pairs of data. Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/table.html]How to Use Table to get started.

  • Can Automation be used to send User-defined CC's to Environment objects?

    Hi, this is probably a really dumb question but I'll ask it anyway:
    I've bought a controller-environment for a synth (Alphajuno2, PG300 programmer) for Logic, the faders in the environment layer use sysex to communicate with the synth.
    Apparently it is possible to map an external midi-controller to these environment-faders, and that's all and fine, but what I'm after is a method of using automation to control the environment-faders. How would I go about doing it?
    I've only ever really automated some volume changes or plugin parameter changes, I've not yet automated faders in the environment, so how would I go about doing it?
    Would I create a fader which I'd link to the sysex-sending fader, and automate the fader, or maybe an environment-monitor (and add it to the arranger) and somehow configure a set of CC#'s to be automated with that arranger object, and then just cable them up to the various Sysex-sending faders (I do know enough to be able to set the input of those sysex-faders to match the CC#'s which the automation would be sending).
    Is this kind of "User-defined CC#'s in Automation" possible? How should I go about it?
    Message was edited by: esaruoho to further clarify it

    Is it just because there is currently no way whatsoever of Automation CC, and I should have known to use Hyper Draw to talk to an Environment object directly, which would then be connected to the Faders of choice?

  • Error while  adding records in user defined table

    Dear all,
                    I am adding a record in user defined table using   .add() method. the code is given below. while adding it raises the following error
    "-1[Microsoft]  [SQL Native Client] [SQL Server] Conversion failed when converting the nvarchar value '-3 @BG_MAILSETTINGS'  to data type int. (CINF).  "
    All the fields are varchar date type.  
                Dim oUDT As SAPbobsCOM.UserTable
                oUDT = oCompany.UserTables.Item("BG_MAILSETTINGS")
                With oForm.DataSources.UserDataSources           
                        oUDT.Code = "1"
                        oUDT.Name = "SMTPSERVER"
                        oUDT.UserFields.Fields.Item("U_SERVER").Value = .Item("EDTSMTPSVR").ValueEx
                        oUDT.UserFields.Fields.Item("U_EMAIL").Value = .Item("EDTFEMAIL").ValueEx
                        oUDT.UserFields.Fields.Item("U_PORT").Value = .Item("EDTSMTPPRT").ValueEx
                        oUDT.UserFields.Fields.Item("U_USERNAME").Value = .Item("EDTSMTPUSR").ValueEx
                        oUDT.UserFields.Fields.Item("U_PASSWORD").Value = .Item("EDTSMTPPWD").ValueEx
                        oUDT.UserFields.Fields.Item("U_AUTHENT").Value = .Item("CMBSMTPAUT").ValueEx
                        K = oUDT.Add
                        If K <> 0 Then
                            oCompany.GetLastError(iErrCode, sErrMsg)
                            MsgBox(CStr(iErrCode) & "-" & sErrMsg, vbCritical, "Error")
                            Exit Sub
                        End If
                 End with
    Could any one please say the solution for this.
    Many thanks,
    Manikandan.
    Edited by: Rui Pereira on Dec 23, 2008 3:49 PM

    Dear Manikandan P,
    Is there any change and check in stored procedure SBO_SP_TransactionNotification?
    Best Regards
    Jane Jing
    SAP Business One Forums team
    Edited by: Rui Pereira on Dec 23, 2008 3:56 PM

Maybe you are looking for