How to create a function that will return a value of a JComboBox PLEASEHELP

this is my psuedo code,. but it's still not worked. Plase help..
String vpText;
String abc = getit();
String s_alert[] ={"WARNIGNS","CAUTIONS","NOTES"};
JComboBox CBweapon = new JComboBox();
for (int i=0;i<s_weapon.length;i++) {
CBweapon.addItem (s_weapon);
private String getit(){
CBweapon.addActionListener(new ActionListener (){
public void actionPerformed(ActionEvent e){
wpText = (String)CBweapon.getSelectedItem() ;
return;
return wpText;

Maybe I'm missing some subtle point here, but why not just do this:
private String getit(){
return CBweapon.getSelectedItem() ;
It doesn't make sense to me to have a method which calls actionListener like this, as if you are going to be calling it over and over again. You want to only call actionListener(...) ONE time, and every time an event is triggered, that code will be executed automatically.

Similar Messages

  • How to call a Function that will return me boolean value

    Hi all ,
    I am try to call a function that is included in my ApplictionModule the following is my method code
    public boolean callUpdateDepartmentNameFunction(int deptNo,String newName)
    boolean result=false;
    System.out.println("first");
    CallableStatement plsqlBlock =null;
    System.out.println("sec");
    String statement="BEGIN :3 = update_dname_func(:1,:2); END;";
    System.out.println("third");
    plsqlBlock=getDBTransaction().createCallableStatement(statement,0);
    try{
    System.out.println("forth");
    plsqlBlock.registerOutParameter(3,OracleTypes.BOOLEAN);
    plsqlBlock.setInt(1,deptNo);
    plsqlBlock.setString(2,newName);
    plsqlBlock.execute();
    result=plsqlBlock.getBoolean(0);
    catch(SQLException sqlException)
    throw new SQLStmtException(CSMessageBundle.class,CSMessageBundle.EXC_SQL_EXECUTE_COMMAND,statement,sqlException);
    finally
    try{
    plsqlBlock.close();
    catch(SQLException e)
    e.printStackTrace();
    } return result;
    while am runing my page is am getting error like
    Error
    1. JBO-29000: Unexpected exception caught: oracle.jbo.SQLStmtException, msg=JBO-27121: SQL error during statement execution. Statement: BEGIN :3 = update_dname_func(:1,:2); END;
    2. JBO-27121: SQL error during statement execution. Statement: BEGIN :3 = update_dname_func(:1,:2); END;
    3. Invalid column type
    callUpdateDepartmentNameFunction_deptNO          
    callUpdateDepartmentNameFunction_newName          
    callUpdateDepartmentNameFunction
    regards,
    Prabeethsoy P

    Hi,
    http://download-uk.oracle.com/docs/html/B25947_01/bcadvgen005.htm#sm0297
    has an example of how to call a stored procedure with out parameters. Please correct your code accordingly
    Frank

  • How to create a Column that will "carry over" values

    I have the first 5 colums of the following table and I would like to create the last column (Carryover). The calculation for carryover (current row) is PRIOR_DAYS_OF_SUPPLY(current row)-DAYS_BTW_REFILL(current row)-carryover (prior row)
    This is tricky since the value is dependent on the prior row value of the SAME column. I have tried the window functions but still cannot get it to work.
    P_ID     RX_DATE     DAYS_OF_SUPPLY     PRIOR_DAYS_OF_SUPPLY     DAYS_BTW_REFILL     CARRYOVER
    100     10/20/2005     30               0
    100     11/28/2005     30     30     39     0
    100     12/21/2005     30     30     23     7
    100     1/13/2006     60     30     23     14
    100     3/3/2006     30     60     49     25
    100     4/14/2006     30     30     42     13
    100     6/9/2006     30     30     56     0
    100     7/7/2006     30     30     28     2
    100     7/31/2006     30     30     24     8
    200     10/20/2005     30               0
    200     11/28/2005     30     30     30     0
    200     12/21/2005     30     30     35     0
    200     1/13/2006     60     30     25     5
    200     3/3/2006     30     60     70     0
    200     4/14/2006     45     30     32     0
    200     6/9/2006     30     45     41     4
    200     7/7/2006     30     30     30     4
    200     7/31/2006     30     30     32     2
    Any help would be greatly appreciated,
    Sam

    I may not be explaining my issue well enough. I believe that 10g has new funciontality that can solve this. Since I am in 9i, I would like to have something that does the same thing as the following 10g SQL:
    create table foo (P_ID number(3) ,R_DT date , DOS number(3) ,
    PDOS number(3), DBTWR number(3), CO number(3));
    insert into foo values (100,to_date('10/20/2005','mm/dd/yyyy'),'30',0,null,null );
    insert into foo values (100,to_date('11/28/2005','mm/dd/yyyy'),'30','30','39',0);
    insert into foo values (100,to_date('12/21/2005','mm/dd/yyyy'),'30','30','23',7);
    insert into foo values (100,to_date('01/13/2006','mm/dd/yyyy'),'60','30','23',14);
    insert into foo values (100,to_date('03/3/2006','mm/dd/yyyy'),'30','60','49',25);
    insert into foo values (100,to_date('04/14/2006','mm/dd/yyyy'),'30','30','42',13);
    insert into foo values (100,to_date('06/9/2006','mm/dd/yyyy'),'30','30','56',0);
    insert into foo values (100,to_date('07/7/2006','mm/dd/yyyy'),'30','30','28',2);
    insert into foo values (100,to_date('07/31/2006','mm/dd/yyyy'),'30','30','24',8);
    insert into foo values (200,to_date('10/20/2005','mm/dd/yyyy'),'30',0,null,null);
    insert into foo values (200,to_date('11/28/2005','mm/dd/yyyy'),'30','30','30',0);
    insert into foo values (200,to_date('12/21/2005','mm/dd/yyyy'),'30','30','35',0);
    insert into foo values (200,to_date('01/13/2006','mm/dd/yyyy'),'60','30','25',5);
    insert into foo values (200,to_date('03/3/2006','mm/dd/yyyy'),'30','60','70',0);
    insert into foo values (200,to_date('04/14/2006','mm/dd/yyyy'),'45','30','32',0);
    insert into foo values (200,to_date('06/9/2006','mm/dd/yyyy'),'30','45','41',4);
    insert into foo values (200,to_date('07/7/2006','mm/dd/yyyy'),'30','30','30',4);
    insert into foo values (200,to_date('07/31/2006','mm/dd/yyyy'),'30','30','32',2);
    ================
    Quote:
    select p_id,r_dt,dos,pdos,dbtwr,cry
    from foo
    model return all rows
    main grr
    partition by ( p_id)
    dimension by (row_number() over
    (partition by p_id order by r_dt ) as rn )
    measures (r_dt,dos,pdos,dbtwr,co, 0 as cry )
    ignore nav rules sequential order
    cry[any]= case when (pdos[cv()]-dbtwr[cv()] +cry[cv()-1])
    < 1 then 0
    else pdos[cv()]-dbtwr[cv()]+cry[cv()-1]
    end
    )

  • Please Help regard function that will return values of each JComboBox items

    I'd like to create a function that will return values of each item on the JComboBox at a time when
    I click on each item of a comboBox. I had this following codes, but didn't work.
    Please help me !!!Please correct it... thanks a million
    String wp;
    String text;
    String A[] = {"WARNIGNS","CAUTIONS","NOTES"};
    JComboBox ABC = new JComboBox();
    for (int i=0;i<A.length;i++) {
    ABC.addItem (A);
    text = Get_It(); //assigns each value of JComboBox's item to variable text when clicks at each item
    //of a comboBOx
    private String Get_It(){
    ABC.addActionListener(new ActionListener (){
    public void actionPerformed(ActionEvent e){
    wp = (String)CBweapon.getSelectedItem() ;
    return wp;

    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    public class AlertFrame extends JFrame {
    String s_alert[] ={"WARNIGNS","CAUTIONS","NOTES"};
    JComboBox CBweapon;
    String wpText;
    public AlertFrame() {
    super("Alerts");
    Container contentPane = getContentPane();
    contentPane.setLayout(null);
    setSize(600,600);
    CBweapon = new JComboBox();
    for (int i=0;i<s_weapon.length;i++) {
    CBweapon.addItem (s_weapon);
    contentPane.add(CBweapon);
    CBweapon.setActionCommand("");
    //set position for components
    CBweapon.setBounds(370 + insets.left,295+ insets.top, 150,30);
    System.out.println(getit()); //calling getit() function
    //this function will be return a String of JcomboBOx value if click on each item of combobox
    private String getit(){
    CBweapon.addActionListener( new ActionListener (){
    public void actionPerformed(ActionEvent e){
    wpText = (String)CBweapon.getSelectedItem() ;
    return wpText;
    public static void main(String args[]) {
    AlertFrame af = new AlertFrame();
    af.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    **I have no errors on compile or run, but it didn't return a string value to System.out.println(getit());
    It maybe because of the "void" of public void actionPerformed(ActionEvent e){
    wpText = (String)CBweapon.getSelectedItem() ;
    Please help me

  • How to call a procdure that will return me list of values(JSF,ADF BC)

    hi all,
    any one can help me how to call a procedure that will return me list of value with using adf and jsf

    I did this with a LoginModule that returned a list of user roles. Below is the Java call
    stmt = conn.prepareCall(authquery);
            stmt.registerOutParameter(1, OracleTypes.CURSOR);
            stmt.setString(2,username);
            stmt.setString(3,new String(password));
            // realm is null if not set
            stmt.setString(4,_application_realm);
            stmt.execute();
            rolesResultSet = (ResultSet)stmt.getObject(1); 
            stmt.close();authquery is the name of a procedure that returned a ref Cursor
    CREATE OR REPLACE PACKAGE "DBPROCLM" IS
      TYPE principal_ref IS REF CURSOR;
      function get_user_authentication(p_username in varchar2, p_password in varchar2, p_realm varchar2) return principal_ref;
    END;
    CREATE OR REPLACE PACKAGE BODY "DBPROCLM" IS
      FUNCTION get_user_authentication (p_username in varchar2, p_password in varchar2, p_realm varchar2)
      RETURN principal_ref
      AS
        var_username varchar2(100);
        var_userid number(10);
        var_password varchar2(100);
        role_cursor principal_ref;
        FAILED_AUTHENTICATION exception;
      BEGIN
        select userid, username, password into var_userid, var_username, var_password from sec_users where username = p_username;
        if (var_password = p_password) then
          begin
            if (p_realm is null) then
              open role_cursor for
                select rolename from user_roles_view where userid = var_userid;
            else
              open role_cursor for
                select rolename from user_roles_view where userid = var_userid and realm=p_realm;
            end if; -- p_realm check
          end;
          -- if password doesn't match, raise Excpetion for LM to
          -- abort the authentication process
        else raise FAILED_AUTHENTICATION;
        end if;
        RETURN role_cursor;
      END get_user_authentication;
    END;You only ned to expose the call to teh procedure in a method (e.g. on ADF BC Application Module) and create a method binding for it.
    Frank

  • How to create a form that will allow the applicant to upload their photo

    I have Adobe Acrobat 9 Pro Extended and I know how to create forms that require text input.
    How to create a form that will allow the applicant to upload their photo? I alo wish to know how to upload a photograph so that I can test the form I created.
    Thank you
    Adrian Watts

    test@ORA10G> with x as (
      2    select '234-1111' as customer, to_date('2-Jan-2008','dd-Mon-yyyy') as call_date, 'Order product' as reason from dual union all
      3    select '234-1132', to_date('3-Jan-2008','dd-Mon-yyyy'), 'Request info' from dual union all
      4    select '231-1154', to_date('4-Sep-2007','dd-Mon-yyyy'), 'Request info' from dual union all
      5    select '234-1111', to_date('2-Nov-2007','dd-Mon-yyyy'), 'Order product' from dual union all
      6    select '234-1132', to_date('9-Jan-2008','dd-Mon-yyyy'), 'Request info' from dual union all
      7    select '231-1154', to_date('9-Sep-2007','dd-Mon-yyyy'), 'Request info' from dual union all
      8    select '234-1111', to_date('5-Dec-2007','dd-Mon-yyyy'), 'Order product' from dual union all
      9    select '234-1131', to_date('7-Dec-2007','dd-Mon-yyyy'), 'Request info' from dual union all
    10    select '231-1154', to_date('1-Sep-2007','dd-Mon-yyyy'), 'Request info' from dual union all
    11    select '234-1111', to_date('8-Jan-2008','dd-Mon-yyyy'), 'Order product' from dual union all
    12    select '234-1131', to_date('3-Dec-2007','dd-Mon-yyyy'), 'Request info' from dual union all
    13    select '231-1154', to_date('4-Nov-2007','dd-Mon-yyyy'), 'Forward to Sales' from dual)
    14  --
    15  select customer,max(call_date), reason
    16  from x
    17  where reason = 'Request info'
    18  group by customer, reason;
    CUSTOMER MAX(CALL_ REASON
    231-1154 09-SEP-07 Request info
    234-1131 07-DEC-07 Request info
    234-1132 09-JAN-08 Request info
    test@ORA10G>
    test@ORA10G>pratz

  • How to create a program that will accept a series of strings of 0 and 1 onl

    how to create a program that will accept a series of strings of 0 and 1 only then displays 0 as 48 and displays 1 as 49.

    Isn't one thread enough for your homework?
    http://forum.java.sun.com/thread.jspa?threadID=5253850&messageID=10051155#10051155

  • SSAS- DAX expression : Is there any DAX function that can return multiple values ?

    Hi,
    Iam in search of a DAX function that can return multiple values as result. please find below scenario where i want to implement the same.
    I have three  Tables: Table A (typeid, Cost, Qty ) ,Table B (typeid, Cost, Qty ) , Table C ( typeid,Typename ) .
    Table A                                       Table B                               
    Table C
    type id  cost  Qty             type id   Cost    Qty                 
    typeid  typename
    1           100    100                3         300     
    300                  1           aa
    2           200    200                4          400    
    400                  2           bb
                                                                                             3           cc
                                                                                             4          
    dd 
    i have to club cost and Qty of two tables(four measures)  as two measures in the  UI report. There are more columns in these tables that restrict the  UNION of the tables.(for the sake
    of understanding , i have not mentioned the othr columns). In the UI report(Execl 2013-power pivot) iam plotting these measures against the
    Table C.Typeid. Hence the measures drill down against each 
    Table C. Typeid as shown below:
    Typeid  Table A.cost  Table A.Qty  TableB.cost  TableB.Qty                              
    1              100             100
    2              200             200
    3                                                    
    300             300      
    4                                                    
    400             400
    My requirement is to club these measures so that the report will be as below
    Type id  cost   Qty
    1          100    100
    2          200    200
    3         300     300
    4         400      400
    Since i cannot club these in model,as a work around, i created a calculated measure in excel(Analyze tab->Calculations->olap tools->calculated measure) with the condition as below:
    new cost = IIF (ISEMPTY(TableA.cost)="TRUE",TableB.cost,TableA.cost)
    new Qty = IIF(ISEMPTY(TableA.Qty)="TRUE",TableB.Qty,TableA.Qty) and dragged these new measures into the report. It was working fine as expected.
    But  this functionality of Creating calculatedmeasure in excel report is possible only in 2013 excel version.
    Now the requirement is to get the same result in 2010 excel. Can you please help me in implementing the same in 2010 excel? or any other alternative method to bring the columns in model itself. I tried to create a measure in table A with DAX expression as
    : new cost :=CALCULATE(SUM(Table B.cost),ISBLANK(TableA.cost)) -> but this will return only 1 result .i need Sum(Table A.cost) also if it is not blank.
    Thanks in advance

    You can use SUMX ( 'Table A', 'Table A'[Cost] + 'Table B'[cost] )
    However, if you install the latest version of Power Pivot in Excel 2010, it supports the ISEMPTY function, too.
    http://support.microsoft.com/kb/2954099/en-us
    Marco Russo http://www.sqlbi.com http://www.powerpivotworkshop.com http://sqlblog.com/blogs/marco_russo

  • I need instructions on how to create a button that will email a pdf form to someone else on a websit

    I NEED ASSISTANCE CREATING A BUTTON THAT WILL EMAIL A PDF FORM FROM A WEBSITE TO WHOEVER THE VIEWER WANTS TO

    Just a bit more info. E-mail can be used, but has potential problems -- often related to the client machine that you have no control over. Use the data submissions (either FDF or XML) rather than the full PDF so you do not have to deal with Reader Rights and the related license issues. The FDF and XML data files are easily imported into the original form so that you see what the client sees. With those aspects in mind, just go ahead and try one. Be aware that you can add form fields using the form tools in the Advanced Editing tools, OR use the forms menu that will take you to Designer. You might want to try both to see the pros and cons. Be sure to keep such a test simple so you are not wasting time on your final form just for testing. I typically create a 1 page form that has all of the possible fields for such a test.

  • How to create an action that will crop two sections from one scanned image?

    I'm trying to create an action that will automate the process of cropping the left and right pages from a series of two-page book scans.
    I tried to create a 2 step action which first crops the left half of a scan (by setting the left margin to 0in and the right margin to 6in) and then the right half of the scan (by setting the left margin to 6in and the right margin to. 12in), however when executing, only the left half appears to be cropped.
    I imagine this is due to the fact that once one side of the initial scan is cropped, the other side disappears.
    Is there any way around this?

    Basically i need to create a new document out of a folder full of images.
    You may have to look into Scripting to achieve something like this.
    You could ask in the Scriptimg Forum
    Photoshop Scripting
    But maybe it would suffice to insert the Menu Item
    File – Scripts – Load Files into Stack
    into the Action and then iterate through the Layers with [ or ] and reset the opacities and Blend Modes – but as Actions would not be able to change the number of repetitions of the operation conditionally a custom Script would still seem preferable. 

  • How to create a function that returns multiple rows in table

    Dear all,
    I want to create a funtion that returns multiple rows from the table (ex: gl_balances). I done following:
    -- Create type (successfull)
    Create or replace type tp_gl_balance as Object
    PERIOD_NAME VARCHAR2(15),
    CURRENCY_CODE VARCHAR2(15),
    PERIOD_TYPE VARCHAR2(15),
    PERIOD_YEAR NUMBER(15),
    BEGIN_BALANCE_DR NUMBER,
    BEGIN_BALANCE_CR NUMBER
    -- successfull
    create type tp_tbl_gl_balance as table of tp_gl_balance;
    but i create a function for return some rows from gl_balances, i can't compile it
    create or replace function f_gl_balance(p_period varchar2) return tp_tbl_gl_balance pipelined
    as
    begin
    return
    (select gb.period_name, gb.currency_code, gb.period_type, gb.period_year, gb.begin_balance_dr, gb.begin_balance_cr
    from gl_balances gb
    where gb.period_name = p_period);
    end;
    I also try
    create or replace function f_gl_balance(p_period varchar2) return tp_tbl_gl_balance pipelined
    as
    begin
    select gb.period_name, gb.currency_code, gb.period_type, gb.period_year, gb.begin_balance_dr, gb.begin_balance_cr
    from gl_balances gb
    where gb.period_name = p_period;
    return;
    end;
    Please help me solve this function.
    thanks and best reguard

    hi,
    Use TABLE FUNCTIONS,
    [http://www.oracle-base.com/articles/9i/PipelinedTableFunctions9i.php]
    Regards,
    Danish

  • Need to create a function that will act like the save as browser function

    I need to create a button on a web page that will open up a save dialog box and then save the current web page as an .html file on the persons hard drive. The reason for this is because the window is a pop up that does not have the browser menu or any toolbars showing just the what we call print view. This window was used only as a print view so people can print the form out but now the powers that be want a save button as well so the people can save it to there HD. I can do this in IE using javascript but no other browser allows that so I need to create something in java. I have read about the setHeader() to download the file but I am sort of new and from what I've read it all sounds like you will be downloading a specific file and not the web page as a file. Anyone have any ideas as to how I can accomplish this? It doesn't have to be the save as dialog box just a way the person can get the current web page on their HD for viewing offline and done at the press of a button. Thanks.

    You'll be wanting to output a PDF or the like instead of a web page. That's the solution to your problem.
    Please next time consider using a line break or two when you post. Thank you for your consideration.

  • Searching for how to create a page that will recreate it self and image uploader!

    Greetings,
    Does any one knows how I could create client side page that would always recreate it self when a new clients to signs up and become a member to my blog site, so they could manage and add friends to their page and upload image to their album? The idea is to have pages added like it is on Facebook, when a member signs up.
    If I server side software is need in order to achieve this goal; what type of server side software do I need for this design? Please contact me if you have any idea.
    I also would like to receive any information on where to find script that will help visitors upload images to my site.
    I have done with other parts of my web design adding this idea is all I need to finish. Your help is immensely appreciated.
    Joplateau.

    You may want to ask in a more generalized forum such as http://forums.adobe.com/community/design_development/webdesign. This one is specifically for Adobe Contribute (which won't do what you want) and is seldom visited. Good luck.

  • How to create an easteregg that will reveal an image

    I created a flash movie which resembles a control panel. I created a image of the group of people that worked on the project and I want the image to be hidden until the user types a key combination that would trigger the image to appear and dissapear when clicked. This url is something like what I was looking for,  (www.virtualmarketingblog.com/how-to-create-alert-boxes-in-flash/) but I want an image to appear instead, can this be customized?  The only problem is, I'm not really good at actionscript. Is there any tutorials out there that may show an easy way to do this. The attached file is a sample of my interface.
    Thanks

    here's code for multikey as2 detection:
    http://www.kirupa.com/forum/showthread.php?t=211149

  • How to create dynamic stamp that will prompt for Cause number and exhibit number?

    I have a need to have a three line custom stamp that will look like the following but will allow a user to input the Cause number then the exhibit number, then successively number exhibits that the stamp is applied to:
    EXHIBIT
    12:74130
    001
    Exhibit will always be the same, but the cause number would need to be modifiable per batch possibly and I would like to be able to update the exhibit number to have a unique number on each page of exhibits....or just each exhibit.
    Can that be done?
    thanks!

    It sounds like you are trying to use a retail serial as an enterprise serial and would like to bypass it's restrictions by deactivating it . . . I assume that's not possible, but perhaps I don't understand your issue.
    I doubt you'll get a good answer on the forum. Try support, your sales rep, or a help link on the licensing web site (if there is one).
    Ben

Maybe you are looking for