Capture focusLost event
Hello
I'm working with a JProgessBar and I would like it to capture focusLost event?
Is it possible to do this, without having to customize the src.
Thanx
JProgressBar my_bar = ...
my_bar.addFocusListener(new FocusAdapter()
public void focusLost(FocusEvent e)
// event code goes here
});This is possible because...
JProgressBar is a type of JComponent
All JComponents extend Container, which extends Component
All Components have the ability to add focus listeners.
Did this answer your question? Let me know if I missed something.
Similar Messages
-
Unable to capture button event in pageLayout Controller
Hi Guys,
I have the following layout
pageLayout
pageLayoutCO (controller)
----header (Region)
----------messageComponentLayout (Region)
-----------------MessageLovInpurt
-----------------MessageChoice(Item)
-----------------MessageTextInput
-----------------MessageLayout
----------HideShow (Region)
-----------------MessageLovInpurt(Item)
-----------------MessageChoice(Item)
-----------------MessageTextInput(Item)
-----------MessageComponentLayout (Region)
-----------------MessageLayout
------------------------SubmitButton(ID:SearchBtn)
------------------------SubmitButton(ID:ClearBtn, fires partial action named clear)
-----------header(Region)
I am not able to capture the event fired by the button ClearBtn in the controller of the pagelayout.....
The two methods I used as follows aren't worked:
if ("clear".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
if (pageContext.getParameter("ClearBtn") != null) {
what should i do in order to capture the button event in the pageLayout Controller
Thanks in advance
Mandy
Edited by: user8898100 on 2011-8-2 上午7:49Mandy,
Its really strange that its not able to caputure the event in CO.
Below is the way in which we handle to Submit action at CO level.
/Check whether ClearBtn is same in case too.
if(pageContext.getParameter("ClearBtn")!=null){
System.out.println("Inside the Clear Btn Action");
Regards,
Gyan -
Unable to capture onClick event of htmlb:image in a controller
Hi,
I am trying to capture onClick event of an htmlb:image (which is present in my view) in DO_HANDLE_EVENT method of my controller.
Surprisingly, when I click the image, page does refreshes. But the event in not captured in do_handle_event method. Control never reaches that method. Whereas if I put onClick event of a button, it is easily captured in do_handle_event method.
Ex. code in my view is:
<%@page language="abap"%>
<%@extension name="bsp" prefix="bsp" %>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:image id = "searchimg"
src = "consvalue.jpg"
onClick = "search" />
<htmlb:button id="searchbutton" onClick="search"
text="Event Test"/>
Now, the button event is captured, but not the image event.
Any idea why this might be happening?
Regards,
KaushalHi Kaushal,
are image and button enclosed by <htmlb:form> ?
Please post your of do_handle_event, where you look for the event.
Regards,
Sebastian -
How to capture the event in driver JSplitPane
Hi all, i have some problem with the JSplitPane.
What i want to do is that:
i need to capture the event throw when the user press the button in the driver of the JSplitPane, this is because i want to know wich side of the splitpane is complet visible.
Thanks for your time!
LucaI thought I would do up an example just for fun. As you drag the splitter bar the size of the two components and the splitter component is reported to the console along with the divider location. Interestinly, on my system (Windows XP, Java 1.41_02) when you move the bar downwards the divider location is consistantly two pixels past the height of the top component but when you drag the bar upwards the divider location and the height of the top component are the same.
Does anyone have any ideas why that would be?
Here is the test app:package splitPaneMonitor;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JFrame;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
public class SplitPaneFrame extends JFrame implements PropertyChangeListener {
public SplitPaneFrame() {
super ("Split pane test");
// Create the components to show in the split pane
myTopComponent = new JTextArea ("This is the top component", 10, 40);
myBottomComponent = new JTextArea ("This is the bottom component", 15, 40);
// Create the split pane
mySplitter = new JSplitPane (JSplitPane.VERTICAL_SPLIT , true, myTopComponent, myBottomComponent);
mySplitter.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY, this);
getContentPane ().setLayout(new BorderLayout ());
getContentPane ().add (mySplitter, BorderLayout.CENTER);
public void propertyChange (PropertyChangeEvent evt) {
if (evt.getPropertyName () == JSplitPane.DIVIDER_LOCATION_PROPERTY) {
System.out.println ("Split pane divider moved");
Dimension size = myTopComponent.getSize ();
System.out.println (" The top component's size is: " + size.height +" h, "+ size.width + " w");
myBottomComponent.getSize (size);
System.out.println (" The bottom component's size is: " + size.height +" h, "+ size.width + " w");
mySplitter.getSize (size);
System.out.println (" The splitter's size is: " + size.height +" h, "+ size.width + " w");
System.out.println (" The splitter divider location is: " + mySplitter.getDividerLocation ());
private JTextArea myTopComponent;
private JTextArea myBottomComponent;
private JSplitPane mySplitter;
public static void main(String[] args) {
SplitPaneFrame appFrame = new SplitPaneFrame ();
appFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
appFrame.pack();
appFrame.setVisible (true);
} -
How to Capture Button event on TrainBean navigation
Hi All
i m being required to capture a button event in train bean Navigation, i m doing customization in Iexpense Module,here in Create IExpenseReport i need to capture the events of Remove,Return etc.how is it possible any clue would be very helpful.
Thanx
Prataptry this..
if (GOTO_PARAM.equals(pageContext.getParameter(EVENT_PARAM))
"NavBar".equals(pageContext.getParameter(SOURCE_PARAM))
// This condition checks whether the event is raised from Navigation bar
// and Next or Back button in navigation bar is invoked.
int target = Integer.parseInt(pageContext.getParameter(VALUE_PARAM));
// We use the parameter "value" to tell use the number of
// the page the user wants to visit.
String targetPage;
switch(target)
case 1: targetPage = "/oracle/apps/dem/employee/webui/EmpDescPG"; break;
case 2: targetPage = "/oracle/apps/dem/employee/webui/EmpAssignPG"; break;
case 3: targetPage = "/oracle/apps/dem/employee/webui/EmpReviewPG"; break;
default: throw new OAException("ICX", "FWK_TBX_T_EMP_FLOW_ERROR");
HashMap pageParams = new HashMap(2);
pageParams.put("empStep", new Integer(target));
pageContext.setForwardURL("OA.jsp?page=" + targetPage,
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
pageParams,
true, // Retain AM
OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrumbs
OAWebBeanConstants.IGNORE_MESSAGES);
--Prasanna -
Not able to capture button event in pageLayout Controller
Hi Guys,
I have the following layout
pageLayout ------------------------ pageLayoutCO (controller)
----messageComponentLayout (Region)
----------messageComponentText (item)
----------messageComponentText (item)
----------messageComponentText (item)
----------messageLayout (Region)
----------------header(Region)
----------------------button (item) (say BTN1) (fires partial action)
I am not able to capture the event fired by the button BTN1 in the controller of the pagelayout..... but if i set a controller at the messageComponentLayout iam able to capture the event.
what should i do in order to capture the button event in the pageLayout Controller
Thanks in advance
Tom.Tom,
Two things:
1)The button ur using is of type submitbutton or button?.In this scenario it should be button.
2)The correct coding practice is using:
if("QUERY".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
instead of
String _event = pageContext.getParameter("event");
if("QUERY".equals(_event))
because you never know if Oracle in any upgrade or patch change the value of the constant EVENT_PARAM in class OAWebBeanConstants.
3)If first point is followed by you, just match the exact event name in code and in property inspector for the button.
--Mukul
--Mukul -
How to capture the event in ALV grid display?
Hi experts,
How to capture the event in an ALV grid display which is editable. I have to capture the TAB key or ENTER key.
regards,
Arul Jothi.Hi Arul,
Take a look at sample program BCALV_EDIT_03. (Find string "register ENTER" in the program to see how to register)
Basically you have to Register edit events using method call REGISTER_EDIT_EVENT and then write a handler method for event DATA_CHANGED..
If you are using a REUSE..GRID fm then first get the grid reference using function module GET_GLOBALS_FROM_SLVC_FULLSCR and then repeat the above procedure..
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni -
Capturing the event on clicking the af:train stop icon
We are using an af:train as follows
<fnd:applicationsPanel>
<f:facet name="appsPanelTrain">
<af:panelGroupLayout layout="horizontal" halign="center"
id="panelGroupLayout2">
<af:train value="#{controllerContext.currentViewPort.taskFlowContext.trainModel}"
id="train1"/>
</af:panelGroupLayout>
</f:facet>
</fnd:applicationsPanel>
I see the train stops on top of my page as expected. I can skip the train stops by directly clicking on the stops on top of the page.
Is there a way to capture the event of this click?This should help
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/97-deferred-trainstop-navigation-1528557.pdf -
Capturing JButton event in a JList
All,
I have a JList that renders each list item with some special formatting of a JLabel and a Jbutton. The button is an 'OK' button that must be acknowledged. When the OK button is acknowledged it should be deleted from the list model. I am having trouble capturing the event of the button. I am not interested in the list selection event per se just the selected Index, which I know how to get. Any ideas on getting to the button click event even though it is in a list?
Thanks much.I'm not sure I understand exactly what you're doing (you have a JButton inside a JList?), but to answer your last question, you get access to the button click even the same way you would with any other JButton:
JButton myListButton = new JButton("click me");
myListButton.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
// remove button from list or do whatever
// other processing is required -
FocusLost event for JTable during cell editing
When a cell in a JTable is getting edited, how can I get notified of the focusLost event? I added the focus listener using JTable.addFocusListener, but the focusLost of the listener is not called when a cell inside the table is getting edited (it works fine otherwise). I am aware of the client property terminateEditOnFocusLost to solve this problem in 1.4 but I can't use it since I am still on 1.3.1_04.
Suggestions welcome.http://forum.java.sun.com/thread.jsp?forum=57&thread=431440
-
FocusLost event on same component generated multiple times... why?
This is a reiteration of the topic of a post from Jan. 2006 by Toxter.
Although Toxter got his problem resolved, the question of the title of his post (same as mine) was never answered.
Suppose you want to validate text of a component (say, a JTextField) by checking the text when the component loses focus, by implementing the focusLost method in a FocusListener. The listener catches focusLost events from the given component and does validation and if found invalid, opens a warning dialog (say, a JOptionPane). Suppose further that in your implementation of the focusLost method, after returning from the JOptionPane call, you call requestFocusInWindow() on the JTextField so the user can make the correction straight-away. What happens, weirdly, is that you get multiple recurrences of a focusLost event from the very same textfield component, generating multiple JOptionPane popups, before the user is actually able to access the textfield and make a correction.
No reason was given as to why this happens. Toxter reported that focusLost would get called twice. I routinely get 3 occurrences.
In any case, why does this happen?
There are at least a couple of other workarounds besides the one accepted by Toxter:
1) you can drop the call to textField.requestFocusInWindow... without that call you don't get multiple occurrences of focusLost FocusEvents
2) you can wrap the call to requestFocusInWindow in a call to SwingUtilities.invokeLater (within the run method of an anonymous Runnable):
if( !validatePositiveIntegerField(txtFld) )
JOptionPane.showMessageDialog(this, INPUT_ERR_MSG,
INVALID_ENTRY_TITLE, JOptionPane.WARNING_MESSAGE);
SwingUtilities.invokeLater(new Runnable()
public void run()
txtFld.requestFocusInWindow();
}Workarounds are great but it's nice to understand the underlying causes of problems too... If anyone (Toxter, do you know?) can give even just a brief nutshell explanation as to why this occurs, I'd like to hear it.
Thanks in advance.Use an InputVerifier:
http://forum.java.sun.com/thread.jspa?forumID=57&threa
dID=776107&start=6Thanks for the reply, camickr. Several workarounds were already noted. That wasn't the question. The question was: what is the underlying cause of the multiple occurrences of focusLost events from the given JTextField which cause the JOptionPane to pop up multiple times? On the face of it, it seems to be a bug in how focus events are getting generated. Here is a bit of code that will generate the problem:
public void focusLost(FocusEvent e)
if( e.getSource() == txtFld && !validatePositiveIntegerField(txtFld) )
JOptionPane.showMessageDialog(this, INPUT_ERR_MSG, INVALID_ENTRY_TITLE,
JOptionPane.WARNING_MESSAGE);
txtFld.requestFocusInWindow();
}In my previous post, I pointed out that the multiple focusLost events can be avoided if one either drops the call to txtFld.requestFocusInWindow() altogether, or else wraps that call in the run method of a Runnable executed with SwingUtilities.invokeLater. But the question I posed was, why is the code above causing multiple occurrences of focusLost events from the txtFld component?
Any help in getting an explanation of that seemingly buggy behavior would be appreciated.
Cheers -
Capturing the events and performing a predefined action
I want a mechanism to capture the events:
eg: If a new document is opened , I want a text frame to be created on that document as soon as it gets opened.
what interfaces, classes can help me here? andy sample code avilable which shows how to capture events?Operating System
System Model
Windows 7 Ultimate (build 7100)
Gigabyte Technology Co., Ltd. M61PME-S2P
Enclosure Type: Desktop
Processor
Main Circuit Board
2.80 gigahertz AMD Athlon X2 240
256 kilobyte primary memory cache
1024 kilobyte secondary memory cache
64-bit ready
Multi-core (2 total)
Not hyper-threaded
Board: Gigabyte Technology Co., Ltd. M61PME-S2P
Bus Clock: 200 megahertz
BIOS: Award Software International, Inc. F2 12/30/2008
Drives
Memory Modules
320.07 Gigabytes Usable Hard Drive Capacity
125.82 Gigabytes Hard Drive Free Space
TSSTcorp CDDVDW SE-S084C USB Device [Optical drive]
SAMSUNG HD321HJ SCSI Disk Device (320.07 GB) -- drive 0, s/n S13RJ90SB04688, SMART Status: Healthy
1984 Megabytes Usable Installed Memory
Slot 'A0' has 2048 MB
Slot 'A1' is Empty
Local Drive Volumes
c: (NTFS on drive 0) *
319.97 GB
125.76 GB free
d: (NTFS on drive 0)
105 MB
65 MB free
* Operating System is installed on c:
The media files are avi and are in my videos folder (videos-windows 7) -
Sap business One (capture control events)
How do I capture keyboard events(especially those with Control like CTRL-R) in SBO??
Hi Payal,
You can catch the key down event in your Item_Event handler as follows:
If pVal.Modifiers = SAPbouiCOM.BoModifiersEnum.mt_CTRL And pVal.CharPressed = 82 Then
'do something
End If
Hope it helps,
Adele -
Capturing the event!!!urgent
Hi all,
i have a checkBox on a page.My requirement is to capture the event of the CheckBox being clicked,like writing some javascript Functions like onClick.
kan anyone provide me some clarity like, is this possible.
I am being to fetch the user checked value once i caputre the event.
For time being i have created a Apply button to capture the user selection of checkBox.
The code is here
if(pageContext.getParameter("Apply")!=null)
String checkboxn = pageContext.getParameter("NoFlag");
if ("on".equals(checkboxn))
updatedCheckValue="Y";
But my client does not want any additional Buttons on the page.
So i need to captire the vent through some javascript.You don't need a javascript to do this. As Tapash mentions, you can define a fireAction on the messageCheckBox Bean and handle this event in your controller code.
Thanks, Srinath. -
CS02, On click of SAVE button, need to capture some event related with this
Hi,
My requirement is like,
I change the material BOM using CS02 tcode.
When, I complete the changes, and click on SAVE button, I dont find any event triggering in the system.
Can any help in capturing some event related to this?
The reason why I need this is ..during the workflow runtime, the user is presented with the workitem to change the Material BOM with CS02 tcode. And, if sometimes, by mistake, the user is unable to complete the changes of the workitem, and comes back of CS02 without change completion, then the workitem is disapperaing from the inbox, with out completing the intended task of the workitem. So I want to make the workitem appear repeatedly in the user's inbox, till the desired action is done.
ThanksSai,
You need to use a Loop..While statement by validating the decision step.
Use a varaiable to store 'Y' or 'N'.
intially, have the value as 'N' and if the required outcome is taken. Eg: Accept,Reject.. then change the value to 'Y', which will go to the next step of workflow.
if 'N', it will again create a new workitem with the same content to the same agent.
Hope this helps.
bye,
Sudhir.
Maybe you are looking for
-
Centro wired headsets wont work i have read the other posts on this
I've been reading posts on this topic. will try to find some wd40 or a paperclip when I get out of this airport! but I dont know if this is my problem. because when my headset is plugged in you hear no sound coming from the "earpiece" but the minu
-
Linking for Variance Report.
Dear Sir, Please help me urgent basis.... I have created a one report go to KKO5(Report printer) and after go to KKO1 (Create Product Costing Report), but tell me where go and check report in SAP.. Exp. Transaction Code:- KE30 (Run Profitability Rep
-
Dynamically built query on execution How to save the data in Object Type
Hi, In pl/sql I am building and executing a query dynamically. How can I stored the output of the query in object type. I have defined the following object type and need to store the output of the query in it. Here is the Object Type I have CREATE OR
-
DMS Uploading of password protected DOCS
I'm using BAPI_DOCUMENT_CREATE2 to upload documents into DMS. When a document is password protected or read-only, the BAPI fails saying it cannot access the document. Via CV01N I can attach these documents, but not programatically. Any ideas how I
-
I need to restore my apple ID, but it send the info to the wrong e-mail when that e-mail isn't on my ID information. How do I send it to the correct e-mail?