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
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 PHi,
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 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. -
Function that will return fee description for a given folderrsn
Could someone help me make this function work. I am not sure how to add the else clause and when it is done how to call it. I know to call it I will need to input a folderrsn e.g 158744 and then that should show the fee description for that folder.
Reson for the function is to be used by other users instead of a select statement everytime. I will save it in a package.
FUNCTION F_GETFEEDESC (folderrsn_in IN NUMBER)
RETURN varchar2
IS
v_feedesc varchar2(2000);
cursor c1
is
SELECT vaf.feedesc
INTO v_feedesc
FROM folder f, accountbillfee abf, validaccountfee vaf
WHERE f.folderrsn = abf.folderrsn
AND vaf.feecode = abf.feecode
and f.folderrsn = folderrsn_in;
begin
open c1;
fetch c1 into v_feedesc;
if c1%notfound then
v_feedesc := 'Not found';
else
end if;
close c1;
return v_feedesc;
END;
this function when called using a folderrsn like 158744, it should return the fee description for that folder.In the event that your table may have more than one record for any given value of folderrsn_in the open, fetch, close method will not suffer any difficulties, however using the select into method without adding a rownum = 1 clause to your where statement is setting the function up for sporatic failures.
Try this code instead:
FUNCTION F_GETFEEDESC (folderrsn_in IN NUMBER)
RETURN varchar2
IS
begin
SELECT vaf.feedesc
INTO v_feedesc
FROM folder f, accountbillfee abf, validaccountfee vaf
WHERE f.folderrsn = abf.folderrsn
AND vaf.feecode = abf.feecode
and f.folderrsn = folderrsn_in
and rownum = 1;
return v_feedesc;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN 'Not found';
END; -
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 advanceYou 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 want to check all functions of PCI 6534.I have read the user manual..I have some memory related questions.Please help me for that.
1.)If i am using the continuous output mode.and the size of generated data is less than 32 MB.If i want to preload the memory,what should i do?I want that first of all i load all my data to onboard memory & then i want to make start the transfer between 6534 & peripheral.Is it possible?As per me it should be.Plz tell me how should i do this?I think that in normal procedure the transfer between 6534-peripheral & outputting data from pc buffer to onboard memory works parallely.But i don't want this.Is it poss
ible?
(2).Similarly in finite input operation(pattern I/O) is it possible to preload the memory and then i read it?Because i think that the PC memory will be loaded automatically when 6534 acquires the data and then when we use DIO read vi the pc buffer data will be transferred to application buffer.If this is true,i do not want this.Is it possible?
(3) One more question is there if i am using normal operation onboard memory will be used bydefault right?Now if i want to use DMA and if i have data of 512 bytes to acquire.How will it work and how should i do it?Please tell me the sequence of operations.As per my knowledge in normal DMA operation we have 32 Bytes FIFO is there so after acquisition of 32 bytes only i can read it.How it will known to me that 32 bytes acquisition is complete?Next,If i want to acquire each byte separately using DMA interrupts what should i do?Provide me the name of sourse from which i can get details about onboard memory & DMA process of 6534 specifically
(4).In 6534 pattern Input mode,if i want to but only 10 bits of data.and i don't want to waste any data line what should i do?Hi Vishal,
I'll try to answer your questions as best I can.
1) It is definitely possible to preload data to the 32MB memory (per group) and start the acquisition after you have preloaded the memory. There are example programs on ni.com/support under Example Code for pattern generation and the 6534 that demonstrate which functions to use for this. Also, if your PC memory buffer is less than 32MB, it will automatically be loaded to the card. If you are in continuous mode however, you can choose to loop using the on-board memory or you can constantly be reading the PC memory buffer as you update it with your application environment.
2) Yes, your data will automatically be loaded into the card's onboard memory. It will however be transferred as quickly as possible to the DMA FIFO on the card and then transferred to the PC memory buffer through DMA. It is not going to wait until the whole onboard memory is filled before it transfers. It will transfer throughout the acquisition process.
3) Vishal, searching the example programs will give you many of the details of programming this type of application. I don't know you application software so I can't give you the exact functions but it is easiest to look at the examples on the net (or the shipping examples with your software). Now if you are acquiring 512 bytes of data, you will start to fill your onboard memory and at the same time, data will be sent to the DMA FIFO. When the FIFO is ready to send data to the PC memory buffer, it will (the exact algorithm is dependent on many things regarding how large the DMA packet is etc.).
4) If I understand you correctly, you want to know if you waste the other 6 bits if you only need to acquire on 10 lines. The answer to this is Yes. Although you are only acquiring 10 bits, it is acquired as a complete word (16bits) and packed and sent using DMA. You application software (NI-DAQ driver) will filter out the last 6 bits of non-data.
Hope that answers your questions. Once again, the example code on the NI site is a great place to start this type of project. Have a good day.
Ron -
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 jsfI 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 -
Function module that will return week details
Anyone know Sap FM that will return Week details(as below)for a given start and end dates (similar to the function module HR_99S_INTERVAL_BETWEEN_DATES which returns details for a month) independent of factory calendar
I am expecting
Inputs
Start Date - 01/01/2005
End Date - 05/05/2006
outputs
WK YEAR BEGDA ENDDA
02 2005 01/03/2005 01/09/2005
03 2005 01/10/2005 01/16/2005
04 2005 01/01/2005 01/23/2005
Thank, BillHi Bill,
FM is <b>GET_WEEK_INFO_BASED_ON_DATE</b>
Here's a test-program for your requirement:
REPORT zforum09 LINE-SIZE 255.
PARAMETERS:fdate LIKE sy-datum DEFAULT '20050103',
tdate LIKE sy-datum DEFAULT '20060505'.
DATA : BEGIN OF itab OCCURS 0,
week LIKE scal-week,
from LIKE sy-datum,
to LIKE sy-datum,
END OF itab,
next LIKE sy-datum.
next = fdate.
WHILE tdate > itab-to.
CALL FUNCTION 'GET_WEEK_INFO_BASED_ON_DATE'
EXPORTING
date = next
IMPORTING
week = itab-week
monday = itab-from
sunday = itab-to.
next = itab-from + 7.
APPEND itab.
ENDWHILE.
LOOP AT itab.
WRITE:/ itab-week+4(2),
itab-week(4),
itab-from,
itab-to.
ENDLOOP.
Regards Andreas -
i need make mac browsers with windows compatibility, because if i try to se priview from Dw to all browsers on windows PC it will look fine, but same file i trying to see on mac all browsers it will not showing proper..... Please help me for that.
ASk in the DW firum and be much more specific. Web page rendering issues are specific to specific versions of browsers and you may simply be using some bad code that messes up your page.
Mylenium -
i am having problem when i am updating my iphone 4 to ios 5 ..it get update n took 50 minutes then at the end when it was processing file ...suddenly an error comes that an unknown error accurred {9006}..please help me..how will i update my iphone 4
Error 9006: Following Troubleshooting security software frequently resolves this error. There may be third-party software installed that modifies your default packet size in Windows by inserting a TcpWindowSize entry into your Registry. Your default packet size being set incorrectly can cause this error. Contact the manufacturer of the software that installed the packet size modification for assistance.
-
Need help writing a MySQL query that will return only records with matching counter-parts
Since I don't know how to explain this easily, I'm using the
table below as an example.
I want to create a MySQL query that will return only records
that have matching counter-parts where 'col1' = 'ABC'.
Notice the 'ABC / GHI' record does not have a
counter-matching 'GHI / ABC' record. This record should not be
returned because there is no matching counter-part. With this
table, the 'ABC / GHI' record should be the only one returned in
the query.
How can I create a query that will do this?
id | col1 | col2
1 | ABC | DEF
2 | DEF | ABC
3 | ABC | GHI
4 | DEF | GHI
5 | GHI | DEF
*Please let me know if you have no idea what I'm trying to
explain.AngryCloud wrote:
> Since I don't know how to explain this easily, I'm using
the table below as an
> example.
>
> I want to create a MySQL query that will return only
records that have
> matching counter-parts where 'col1' = 'ABC'.
>
> Notice the 'ABC / GHI' record does not have a
counter-matching 'GHI / ABC'
> record. This record should not be returned because there
is no matching
> counter-part. With this table, the 'ABC / GHI' record
should be the only one
> returned in the query.
>
> How can I create a query that will do this?
>
>
> id | col1 | col2
> --------------------
> 1 | ABC | DEF
> 2 | DEF | ABC
> 3 | ABC | GHI
> 4 | DEF | GHI
> 5 | GHI | DEF
>
>
> *Please let me know if you have no idea what I'm trying
to explain.
>
Please be more clear. You say that 'ABC / GHI' should not be
returned,
and then you say that 'ABC / GHI' should be the only one
returned. Can't
have both... -
Hello Dear Moderator,
My skype id is pavank77
I had accidnetaly exceeded the unlimited india calling subscription on 1 april 2012 and my call would not connect, The subscription is still not active on 2 April 2012....According to skype as far as i searched in the forum it should be active today....
Please Help regarding this matter. Skype calling is important to me as i am far away from home.
I would highly appreciate your help.
Warm Regards,
PavanI am sorry to hear that your account has been suspended due to Fair Usage Policy.
For Skype to fully assist you with this concern, we can go through the email verification form by just clicking this link below:
https://support.microsoft.com/skype/hostpage.aspx?language=en&locale=EN-US&oaspworkflow=start_1.0.0....
1. Once you are on that page, choose Account and Password.
2. Choose Blocked Accounts.
3. Click on Next.
4. Click on Email Support.
5. Kindly fill out the form.
**Please make sure to enter as much information as you can for them to collate enough data to authenticate your identity. It is also important to include the Service Request number together with the issue <SR# - ISSUE>, on the subject field. Once the form is completed it will be forwarded to a special team who will handle your case. You will then receive a follow-up email and will be assisted further in resolving the issue/processing your request.
If one of my replies has adequately addressed your issue, please click on the “Accept as Solution” button. If you found a post useful then please "Give Kudos" at the bottom of my post, so that this information can benefit others. -
I have been using GRAB to capture screen displays. It has just stopped working since the last OSX Upgrade. Can anyone, please help restore functionality?
Thanks for that. I did as suggested but when I tried again, it still did not work. Another com.apple.Grab.plist appeared in the Library.
I now have the following files in Library
file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.LSSharedFil eList.plist
file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.LSSharedFil eList.plist.lockfile
file://localhost/Users/peterpatel/Library/Preferences/
file://localhost/Users/peterpatel/Library/Preferences/com.apple.Grab.plist.lockf ile
What do you suggest I do now? -
I need a function that will go through and encrypt all the strings
I want to use one way enryption and need a function that will
go through and encrypt all the strings in my password column in sql
server 2003.
I also need a function that compares a test password string
is equal to the hash value in the database. Can anyone give me some
advice in this?Apparently it's not as simple as I thought. My first instinct
was
update yourtable set password = '#hash(password)#'
but that will crash
This is inefficient, but you only have to do it once.
query1
select id, password thepassword
from yourtable
cfloop query="query1"
update yourtable
set password = '#hash(thepassword)#'
where id = #id# -
How to create a procedure function with a return value of ref cursor?
Can anybody provide a sample about how to create a procedure function with a return value of REF CURSOR?
I heard if I can create a function to return a ref cursor, I can use VB to read its recordset.
Thanks a lot.http://osi.oracle.com/~tkyte/ResultSets/index.html
Maybe you are looking for
-
TS1368 iTunes works fine until I try to go to itunes store, then blue screens
Itunes works fine until I try to go to itunes store, then blue screens. Why? using iTunes vs. 11.0.2.26 on Win7
-
How to improve this query speed ?....help me
How to improve the query speed. Any hints can u suggest in the query or any correction. Here i am using sample tables for checking purpose, When i am trying with my original values, this type of query taking longer time to run select ename,sal,comm f
-
Console CatOS MOTD small problem
Hello, I have a small problem when connecting to a console port. We make a connection via a terminalserver to the console port of a 6500 (Tacacs+). I like to have a banner before I login on CatOs. The problem with a MOTD is that only the banner is sh
-
TS3212 Old version of itunes can not be removed when performing update
Unable to uninstall old version of iturnes telling me that feature that I an trying to use is on a network resource that is unavailable. Itunes will not reconize my i pod without new itunes version. Any help please.
-
Logic 8.02 and Leopard 10.5.4
i just dared to update my Leopard as i was having major issues (i run Logic with TDM and DTDM under PT 7.4.2) and it seems to have solved all my problems. Much better performance on loading and no more DTDM errors on very loading a Logic session. Kon