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
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 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. -
How can I capture the event of selecting a listbar page item?
Is there any way that I can capture the event of clicking/selecting a listbar page item (not just selecting the listbar page) from the listbar activeX control in TestStand 3.0?
I was able to populate the list bar page with items, now how do I know if a user selects any one of those items?
Thanks for your time and assistance,
MarkUse the CursorMoved event.
-
How to Capture Print Event ??
Post Author: aarayas
CA Forum: General
Hi, I need Capture Print Event(), for report.In the the list to event from crystal report viewer not have event to print?? sorry for my bat english, i speak spanish; tranks,If there's no error being thrown by this function when you cancel the
printing, then you can't.
Edit: Just checked, and there isn't. -
Can't capture key event in applet
Hi,
Currently i'm developing an applet. However, i fail to capture the key event in the applet. The key that i fail to capture is VK_TAB. Any idea to handle this?
Thanks in advance!to capture key event, u need to
1. addKeyListener
2. focus on that component (yourApplet must focusable)
Maybe you are looking for
-
When I try to open a link from an email it gives me a choice to open but when I choose open it won't! I used to be able to click right on a store or anything and it would open connect to the store. Very strange
-
Can no longer change my HD icon
Replaced my 3G SSD with a 6G SSD, and used "Restore" in Disk Utility to transfer the info from the 3G to the 6G. I can boot into my usual user (set to admin) account, and everything seems to function fine. I wanted to change the custom icon to the
-
Can not reach installshield wizard during installation
Hi, I've gone through the index.htm guide, and its prerequisites. After I execute the setup.exe, I get a pop-up indicating that the VM is initializing and installshield is starting. Alas, as soon as the progress bar reaches the end, the install wizar
-
Storing 2d array in ArrayList?
Hi I'm storing a 2d int array (int[][]) in an ArrayList. But I cant convert it back to a 2d array again. Tried: indices.add(option.getIndexList()); indices.add(option[j].getIndexList()); int[][] Arr = (int[][])indices.toArray(new int[indices.size()][
-
Business rules engine faults..
Can someone please advise on what could cause this issue? We are using SOA suite 11.1.1.2 1. The rules engine takes an input as usual but doesn't send any output. 2. The BPEL process that invokes the rules sends out a bpelFault instead - (because the