Handling events for
I have a JApplet (menuhandle.java) that adds a menubar. While handling events for the "Open" menu item under File menu(to make it show the OpenFileDialog box) a NullPointerException was thrown. How should this be overcome?
public void actionPerformed(ActionEvent e)
if (e.getActionCommand() =="Open")
chooser = new JFileChooser();
int returnVal = chooser.showOpenDialog(new menuhandle());
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
ExampleFileFilter filter = new ExampleFileFilter();
filter.addExtension("dcm");
filter.setDescription("Dicom files");
chooser.setFileFilter(filter);
if(returnVal == JFileChooser.APPROVE_OPTION)
File file=chooser.getSelectedFile();
if(filter.accept(file))
str=file.getName();
I need to display the Open File dialog box and also retrieve the file the user actually selected, in order to do certain manipulations with it. Can somebody tell me how to go about this?
Just a guess, but could the problem be related tothe
fact that for security purposes many file
manipulation functionality is disabled in applets?Indeed. The SecurityManager for unsigned applets does
not allow the use of JFileChooser
Thanx a lot. But if i make menuhandle .java as a simple class (without extending JApplet) and then try to use this class from inside another applet........will this work? Or will the SecurityManager still not allow the use?
Similar Messages
-
Callback functions to handle events for a specific system build block
I have two questions about customized event handling in Systembuild:
1- The SystemBuild Utility "sysbldEvent" can bo used to specify additional actions for the "openblock" and "navigate" events. However, it will be applied to all systembuild blocks.
Is there a way to limit its scope to a specific block or block type?
This has been done for the Altia block (which is a customized UCB block) - a double-click will open a special dialog box. Is this feature implemented using publicly available systembuild features or there are other special features used?
2- Is there any way to assign callbacks to other type of block events: copy, paste, etc ...
Thanks.Farshid,
There are a couple of options for creating custom dialogs/blocks.
SysbldEvent can be used. As you noted it will generate and event for all the blocks. You can not generate an event only for a specific block. However the Xmath function has two values sent to it. One is the type of event (blockopen or navigate) and the blockId. You can use blockId together with SBA commands to find out which block generated the event. If it is a block that you are not interested in then return 0 and SystemBuild opens the normal dialog. If it is the right block then you can open your own dialog or perform what ever action is needed. Finally return a 0 if you want SystemBuild to still open the normal dialog, or you can return 1 and no dialog is opened.
The Altia
block is a custom block. It is a standard UserCode block that has been customized to have differnt default parameters and different icon. In the SystemBuild editor (not catalog browser) select a block and the go to Edit>New Custom Block. The custom block can a have a MathScript function associated with it that gets called when the block is created. For more information on custom blocks see chapter 18 of the SystemBuild Users Guide (Help>Search MATRIXx Bookshelf from Xmath).
The final method is creating a component. For a component percent vars can remain internal or they can be available to the user. You can also provide a different set of parameters that are available to the user, and then provide equations for how they map to the internal percent vars. Information on Components is in Chapter 17 of the SystemBuild User's Guide.
Carl L
National Instruments -
Handling event for Tree Control Collapse
Hi,
Can any one suggest how to handle an event for 'Tree Node Collapse' . I have checked with all the exised tree events.
thanks,
VenuHi Venugopal,
If you are doing tree control programmin then i can suggest you a approach for tree node collapse and expand.
for doing this follow these steps.
1. create a toolbar (use class cl_gui_toolbar), add a button and assign a FCODE to it.
2. here you register the following the event for the toolbar.
gs_event-eventid = cl_gui_toolbar=>m_id_function_selected.
3. here you set the handler for the toolbar events
SET HANDLER gref_application->handle_function_selected
FOR gref_toolbar.
4. now in your class for gref_application you write a definition and implementation.
definition
handle_function_selected FOR EVENT handle_function_selected OF cl_gui_toolbar IMPORTING fcode.
implementation
CASE fcode.
when 'collapse'.
CALL METHOD xref_tree->collapse_all_nodes.
this method might change depending upon the class you use for creating the tree.
i hope this will help you.
in case of clarification do get back to me.
regards,
Kinshuk Saxena
PS mark helpful answers -
Want to handle event for component defined inside skin for host component
Hi,
Following is how my skinned button looks -
As can be seen, there is a checkbox - which is a part part button skin.
When mouse is over chckbox area and does clicked, I wanted to capture that event for checkbox as target. Objective is to mark checkbox as checked or unchecked when clicked on. I don't want checkbox to change its state when mouse is clicked over other area in button.
Don't know whether it is possible or not. If yes, what is the best way to do it.
Thanks in advance,
Prithveesingh Zankat.Hello!
I face the same problem with Failed to create delegate for component:
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to create delegate for component
XXX.YYY.ZZZ..ume.Ume. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoClassDefFoundError: com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClass
I think this started after upgrading from 7.01 SP3 to SP5, but I'm not sure.
What was it that solved your issue?
*I found the error. My ProjectProperties.wdProperties did not contain the references it needed.*
Edited by: Richard Linnander on Nov 23, 2009 2:33 PM -
ALV: how to handle event for multi (lead) row selection ?
Hi,
I use editable ALV and configure it for multi (lead) selection. Works fine.
But I could not find any event handler for reading the selected lines.
There is only the Event handler ON_LEAD_SELECT: this works only for 1 line
(the lead line). But I could not read multi lines. Who can help?
Thanks in advance, ChristianHi Christian,
did you try a custom button?
Try a call
node->GET_SELECTED_ELEMENTS
I cant remember if ALV sends event when multi-selection is on for each row selection.
ie as each row is selected, do you get control ?
If so, then you should still be able to call node->GET_SELECTED_ELEMENTS .
regards
Phil. -
How to Handle Events for JOptionPane buttons?
Hi All,
I need a help...
I am trying to develop a simple SWING application that consists of multiple elements (mainly text fields) and a Submit button. On pressing Submit button, it should validate all the fields and then do something else. But if some fields are left blank, then it should give a pop-up message and on clicking the OK button on the pop-up message, the focus should go to that text field which is left null.
The problem is I am not able to understand how to Capture this OK button click-event of the pop-up message. I mean how to do something when the OK/Cancle button of the pop-up window is clicked.
Please Help me.
Thanks in Advance,
UjjalAs already pointed out, JOptionPane has some static methods which show a dialog, and return an int, or a string. The whole point of this class is to remove the need for any event handling by the developer, that is, you simply call the showDialog method or whatever, and it returns a value telling you, for example, which button was pressed - no need for action listeners at all. The result of the showDialog method (or whichever you use) tells you which button was pressed. Check the javadocs for JOptionPane for details of several constants that indicate which button was pressed
The class exists to make simple dialogs trivial to generate - you're overcomplicating things! -
Handle Event for Characters At Serial Port in an eventstructure
I want to write an event driven application for serial communcation without polling for characters at serial port, instead I want to have an event case in the event structure for this event. Is this possible and how can i do it?
You should be able to execute the example that I posted with an event structure in parallel. I modified the last example so that on thread is waiting for the serial event and then another thread is executing an event structure that just increments a counter. You should be able to increment the counter any time you want and the serial event will complete as soon as a message is read independent of one another.
Unfortunately, I don't know how to (and I am not sure you can) setup an event structure to work with VISA or DAQ events. If you put your VISA Wait on Event inside of your event structure it will hold and prohibit any other events from executing until it is done. However, if any event fires it will block the other
events until it completes. If you uncheck the box under the your event properties you can prevent the front panel from locking. This will at least queue up the events.
I hope this helps out. Attached are some examples.
-Josh
Attachments:
visaRead.vi 42 KB
visaRead2.vi 49 KB
visaRead3.vi 49 KB -
How to handle events for Tab Control
Hi,
I have a Tab control with 4 tabs and I would like when I go to a specific tab all the contents of that tab being updated. Could you please help me with this?
How should I set the event structure
ThanksTab Control->Value Change is the event you want. You can then use a case structure to do whatever you need it to based on the "New Value".
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
How to handle Event in JACOB API
Hi,
I am read the outlook mail using JACOB[Java Com Bridge] API successfully, now i want to handle events for outlook mail using JACOB. and also i can able to catch the new mail event. but i am unable to catch any deleted mail and move mail from one folder to another folder. This is extremely important for my project. so any one please tell me how to handle and catch the Outlook deleted event and move event using JACOB.
Thanks in Advance,
With Regards,
GaneshWindows can be closed in a number of ways and the simplest way to trap them would be to handle Window Closing in code behind.
This is also the easiest way to show dialogs if that's how you wanted the warning message to appear.
This:
chxAllowToClose.IsChecked
Looks like a checkbox to me, seeing as you have IsChecked.
That presumably means you already have that bound to a viewmodel and visible to the user.
You can therefore just test that value from the view.
If you prefer to hide that instead then there are several options.
You could have a dependency property and a binding in code behind which binds to the viewmodel. Test that in your event.
Or
You could save the value when it changes to application.current.resources. Since dependency properties and bindings are a bit wordy this is easier.
Or
You could have just a variable in the view code behind and use messenger to tell that when the value changes from the viewmodel:
http://social.technet.microsoft.com/wiki/contents/articles/26070.communicating-between-classes.aspx
Please don't forget to upvote posts which you like and mark those which answer your question.
My latest Technet article - Dynamic XAML -
Can we apply an event handler only for a custom request in oim 11G?
Hi,
We would like to create a custom request for user creation, modification etc.
I saw that event handlers allow to add business rules by running java code during differents steps of processes.
I would like to know if we can trigger an event handler on a specific request and not on all user CREATION, UPDATE etc.
For example, we would like to have differents creation requests and a differents event handler on each request.
And can we add "logical" input on request form and read them in event handler?
For example, 3 inputs: day, month and year on the form which fill one user attribute "end contract date".
Regards,
Pierrethank you Akshat,
I saw part 19 in the developper's guide. If I understand, I can change the default CreateUserRequestData to define ALL form components that will be used in my differents user creation request templates.
I can use prepopulation adapter to pre populate field with java code.
I can use the plug-in point oracle.iam.request.plugins.StatusChangeEvent to run custom java code.
But they don't mention where you can run java code for a specific creation template named "MyUserCreationTemplate1" and other java code for an other specific creation tempalate" MyUserCreationTemplate2".
That makes me think we must retrieve the template name in java code and execute the appropriate business logic.
if request name==MyUserCreationTemplate1
Edited by: user1214565 on 31 mai 2011 07:42 -
How to handle at line-selection event for 2 different fields
Hi,
The requirement is there are 2 fields in a report output.
One is Material number
and the other is Material document number.
On clicking the material number, the user should be taken to MM03 screen.
On clicking the Material document number, the user should be taken to MB03 screen.
I am able to take care of the first one by putting a HOTSPOT on material number and I am using at line-Selection event, call transaction MM03 and it is working fine
I want to know how can I handle similarly for the document number?
Thanks,
Kumar.Hi,
chk this sample code.
Some part of code is higlighted which meets ur rewuirement.
REPORT z50871sd_rept_interactiverept NO STANDARD PAGE HEADING.
STRUCTURE DECLARATIONS*
INTERNAL TABLE DECLARATIONS*
WORKAREA DECLARATIONS*
TYPES : BEGIN OF st_kna1,
kunnr TYPE kna1-kunnr, "CUSTOMER NUMBER
name1 TYPE kna1-name1, "CUSTOMER NAME
END OF st_kna1.
TYPES : BEGIN OF st_vbak,
kunnr TYPE kna1-kunnr,
vbeln TYPE vbak-vbeln, "SALES DOCUMENT NUMBER
erdat TYPE vbak-erdat, "DATE ON WHICH THE RECORD WAS CREATED
audat TYPE vbak-audat, "DOCUMENT DATE
auart TYPE vbak-auart, "SALES DOCUMENT TYPE
ernam TYPE vbak-ernam, "NAME OF PERSON WHO CREATED THE OBJECT.
augru TYPE vbak-augru, "ORDER REASON
END OF st_vbak.
TYPES : BEGIN OF st_vbap,
vbeln TYPE vbak-vbeln,
posnr TYPE vbap-posnr, "SALES DOCUMENT ITEM
matnr TYPE vbap-matnr, "MATERIAL NUMBER
charg TYPE vbap-charg, "BATCH NUMBER
matkl TYPE vbap-matkl, "MATERIAL GROUP
posar TYPE vbap-posar, "ITEM TYPE
END OF st_vbap.
DATA : it_kna1 TYPE STANDARD TABLE OF st_kna1,
it_vbak TYPE STANDARD TABLE OF st_vbak,
it_vbap TYPE STANDARD TABLE OF st_vbap,
wa_kna1 TYPE st_kna1,
wa_vbak TYPE st_vbak,
wa_vbap TYPE st_vbap.
DATA : v_fld(15),
v_kunnr TYPE kna1-kunnr,
v_vbeln TYPE vbak-vbeln.
SELECT-OPTIONS*
PARAMETERS*
SELECT-OPTIONS so_kunnr FOR v_kunnr. "CUSTOMER NUMBER
PARAMETERS : p_max TYPE i. "NUMBER OF HITS
START-OF-SELECTION*
START-OF-SELECTION.
PERFORM get_customerdata.
SET PF-STATUS 'MENU1'.
AT LINE-SELECTION**
*AT LINE-SELECTION.*
*IF sy-lsind = 1.*
*PERFORM get_salesheader.*
*ELSEIF sy-lsind = 2.*
*PERFORM get_salesitemdata.*
*ENDIF.*
AT USER-COMMAND*
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'DISP'.
PERFORM get_salesheader.
WHEN 'ITEM'.
PERFORM get_salesitemdata.
WHEN 'VA03'.
SET PARAMETER ID 'AUN' FIELD wa_vbak-vbeln.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDCASE.
TOP-OF-PAGE*
TOP-OF-PAGE.
ULINE AT /1(56).
WRITE : /1 sy-vline ,
2(15) text-004 COLOR 1 ,
sy-vline ,
20(35) text-005 COLOR 1 ,
sy-vline.
ULINE AT /1(56).
TOP-OF-PAGE DURING LINE-SELECTION.*
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-lsind.
WHEN 1.
PERFORM get_topofpage1.
WHEN 2.
PERFORM get_topofpage2.
ENDCASE.
FORM GET_CUSTOMERDATA*
FORM get_customerdata.
SELECT kunnr name1
FROM kna1
INTO TABLE it_kna1
UP TO p_max ROWS
WHERE kunnr IN so_kunnr.
IF sy-subrc EQ 0.
LOOP AT it_kna1 INTO wa_kna1.
WRITE : / sy-vline,
2(15) wa_kna1-kunnr ,
sy-vline ,
20 wa_kna1-name1,
sy-vline.
HIDE : wa_kna1-kunnr , wa_kna1-name1.
CLEAR wa_kna1.
ENDLOOP.
ULINE AT : /1(56).
ELSE.
MESSAGE w000(z50871msg).
ENDIF.
ENDFORM. "GET_CUSTOMERDATA
FORM GET_SALESHEADER*
FORM get_salesheader.
SET PF-STATUS 'MENU2'.
GET CURSOR FIELD v_fld VALUE v_kunnr.
IF v_fld = 'WA_KNA1-KUNNR'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_kunnr
IMPORTING
output = v_kunnr.
SELECT kunnr vbeln erdat audat auart ernam augru
FROM vbak
INTO TABLE it_vbak
WHERE kunnr = v_kunnr.
IF sy-subrc EQ 0.
LOOP AT it_vbak INTO wa_vbak.
WRITE : / sy-vline ,
2(22) wa_vbak-vbeln ,
sy-vline,
27(25) wa_vbak-erdat ,
sy-vline ,
55(15) wa_vbak-audat ,
sy-vline ,
73(15) wa_vbak-auart ,
sy-vline,
91(16) wa_vbak-ernam ,
sy-vline,
109(13) wa_vbak-augru,
123 sy-vline.
HIDE : wa_vbak-vbeln.
CLEAR wa_vbak.
ENDLOOP.
*ULINE AT : /1(123).*
ELSE.
MESSAGE i015(z50871msg).
ENDIF.
ELSE.
MESSAGE i013(z50871msg).
ENDIF.
ENDFORM. "GET_SALESHEADER
FORM GET_SALESITEMDATA
FORM get_salesitemdata.
SET PF-STATUS space.
GET CURSOR FIELD v_fld VALUE v_vbeln.
IF v_fld = 'WA_VBAK-VBELN'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = v_vbeln
IMPORTING
output = v_vbeln.
SELECT vbeln posnr matnr charg matkl posar
FROM vbap
INTO TABLE it_vbap
WHERE vbeln = v_vbeln.
LOOP AT it_vbap INTO wa_vbap.
WRITE : /1 sy-vline,
2(13) wa_vbap-posnr ,
sy-vline,
18(18) wa_vbap-matnr ,
sy-vline,
40(13) wa_vbap-charg ,
sy-vline,
56(16) wa_vbap-matkl ,
sy-vline,
75 wa_vbap-posar,
112 sy-vline.
CLEAR wa_vbap.
ENDLOOP.
ULINE AT : /1(112).
ELSE.
MESSAGE i014(z50871msg).
ENDIF.
ENDFORM. "GET_SALESITEMDATA
FORM GET_TOPOFPAGE1
FORM get_topofpage1.
ULINE AT : /1(123).
WRITE : / sy-vline ,
2 text-000 ,
wa_kna1-kunnr ,
75 text-001 ,
wa_kna1-name1,
123 sy-vline.
ULINE AT : /1(123).
WRITE : / sy-vline ,
2(22) text-006 COLOR 1,
sy-vline,
27(25) text-007 COLOR 1 ,
sy-vline ,
55(15) text-008 COLOR 1 ,
sy-vline ,
73(15) text-009 COLOR 1 ,
sy-vline,
91(16) text-010 COLOR 1 ,
sy-vline,
109(13) text-011 COLOR 1,
123 sy-vline.
ULINE AT : /1(123).
ENDFORM. "GET_TOPOFPAGE1
FORM GET_TOPOFPAGE2
FORM get_topofpage2.
ULINE AT : /1(112).
WRITE : / sy-vline ,
2 text-000 ,
wa_kna1-kunnr ,
35 text-001 ,
wa_kna1-name1 ,
85 text-003 ,
wa_vbak-vbeln ,
112 sy-vline.
ULINE AT : /1(112).
WRITE : /1 sy-vline,
2(13) text-012 COLOR 1,
sy-vline,
18(18) text-013 COLOR 1 ,
sy-vline,
40(13) text-014 COLOR 1 ,
sy-vline,
56(16) text-015 COLOR 1 ,
sy-vline,
75 text-016 COLOR 1 ,
112 sy-vline.
ULINE AT : /1(112).
ENDFORM. "GET_TOPOFPAGE2
Regards
Sandeep Reddy -
How to handle event structures for two buttons and two counters.
*I have two buttons A and B, and have to compare the difference in hits between them. So do I place an event structure within a while loop for each button (2 buttons, 2 event structures, 2 while loops), or does it need to be one event structure with cases for both buttons whithin one while loop?
*How do I pass the values of buttons A and B's hit counters out of the while loop in order to calculate the differences between them after each increment, not just the final count after the stop button is hit?
*How would I make one stop button work to handle both buttons A and B? I tried to place the actual stop button in one button A's structure and its global in B's structure, but It wont seem to let me use a local variable for a latchable control
CheckerYou should probably have not started a new thread and waited until your question in the original thread was answered. You can modify altenbach's example for a second button. You have a single event structure with a new event for the second button. You have a second shift register to track the number of times the second button is pressed. Inside the while loop but outside the event structure, you just have a subtract function in or to report the difference. do not modify the posted example for the stop button. It works perfectly as is.
-
How to handle LostFocus event for TextField in J2ME?
Hi:
I want to handle LostFocus event for TextField in J2ME.
So can anybody help me.....
Thank YouMIDP API does not have LostFocus event.
You can try setting ItemStateListener for the TextField ([if needed, click here for details|http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/ItemStateListener.html]). API requires that +"...For implementations that have the concept of an input focus, the listener should be called no later than when the focus moves away from an item whose state has been changed. The listener should be called only if the item's value has actually been changed...."+ -
How to handle form close event or escape key press event for user defined f
Experts,
Please let me know how to handle form close event or escape key press event for user defined form...
Thanks & Regards,
Pravin.Hi
You can catch the form close event like this
If ((pVal.FormType = 139 And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)) And (pVal.Before_Action = True)) Then
Try
SBO_Application.SetStatusBarMessage(pVal.EventType.ToString())
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message)
End Try
End If
Hope this helps
Regards
Arun -
How to open page in new window while handling event on link.
Hi all
I have a requirement where page should be opened in new window when I click on link.My item style is 'link'.Despite of mentioning target frame _blank, I m not able to open it in new window.I m handling event by setting Action Type as fireAction.I hope this might be the reason because of that this happened. Can somebody suggest some solution so that I can open it in new window.
Thanks,
BhupendraHi ,
though i am not able to answer, i can get some answer for my question.
How the link item is handled thru the ActionType and event in the Client Action..?
The reason for this question is that we are trying to extend the customer search page in AR - EBSR12. there the search result page has the Account Name as a link and the Action event says viewAccountName and the action type says firePartialAction. I am trying to understand this so that i can add more parameters to the link so that i can use them in the target page of the link..
Any help is appreciated..
Thanks
Chidam
Maybe you are looking for
-
Records print on next page in samrtforms
Hi all gurus and experts of sap .... I had created P.O layout in smartforms .....when number of line items increased that time it breaks the page and footer area print on next page .... kindly suggest me how to print remaining lines on next subsquen
-
Process flow completed successfully but flagged as BUSY in OWB ?
Hi, I have several process flow jobs that are scheduled to run each night. All steps of the process flows completes successfully (checked in Workflow Manager and Warehouse Builder Browser), but the overall status is always set to BUSY in OWB Browser.
-
I am creating a web page that features an embedded chart made by MS Excel. I would like the chart to automatically update(refresh) to show viewers live information without having to refresh the entire page. I have found that there is a way to enable
-
Hi, My requirement is to create a new tcode(ZVF01) for VF01. In the new tcode, User should able to process/create ONLY billing document. All other fields like billing type and billing date should be disabled. So user will give only billing document.
-
Establishing default Font & Font Size
Is there a way to control the default font & font size when creating a new text box? Whenever I create a new text box it populates with Ariel font size 14 but I would prefer, for example, to start with Times New Roman size 12. Anyway to do this witho