How to preven JButton of generated actions when the user keep pressing down
How to preven JButton of generated actions when the user keep pressing down the key or the short cut
The code below to show the issue when the user keep pressing Alt+ O
We want to prevent the JButton from generating multi actions just one action only
A sample of code shows the behaviour which has to be prevented. Continue pressing "Alt +O" and you will see the standard ouptput will print time stamps
Please notice, I am NOT interested in Mouse press which has a solution by adding a threshold ( setMultiClickThreshhold(long threshhold) on the JButton as an attribute.
public class TestPanel extends JPanel
private JButton btn;
public TestPanel()
btn = new JButton("Open");
this.add(btn);
registerCommand(new MyAction(), InputEvent.ALT_MASK,
KeyEvent.VK_O, btn, btn.getText(), 0);
public static void registerCommand(AbstractAction action,
int mask,
int shortCommand,
JComponent component,
String actionName,
int mnemonicIndex)
InputMap inputMap = component.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
KeyStroke knappKombination = KeyStroke.getKeyStroke(shortCommand, mask);
if ((component instanceof AbstractButton)
&& mnemonicIndex >= 0
&& mnemonicIndex < actionName.length()
&& (shortCommand >= KeyEvent.VK_A && shortCommand <= KeyEvent.VK_Z))
((AbstractButton) component).setDisplayedMnemonicIndex(mnemonicIndex);
if (inputMap != null)
ActionMap actionMap = component.getActionMap();
inputMap.put(knappKombination, actionName);
if (actionMap != null)
actionMap.put(actionName, action);
public static class MyAction extends AbstractAction
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e)
System.out.println(System.currentTimeMillis());
public static void main(String... args)
SwingUtilities.invokeLater(new Runnable()
public void run()
JFrame frame = new JFrame("Testing");
JPanel panel = new TestPanel();
frame.getContentPane().add(panel);
frame.setPreferredSize(new Dimension(500, 500));
frame.setMinimumSize(new Dimension(500, 500));
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}Edited by: user12130673 on 2013-feb-13 03:01
Use KeyStroke getKeyStroke(int keyCode, int modifiers, boolean onKeyRelease) with onKeyRelease=true instead?
Similar Messages
-
How to call an action when the user selects a radiobutton
Hai
PLease help me in providing the information.
In my Project i have two radio buttons as
New
Asssessment
when the user selects new button, i want to automatically call an action in the controller(.jpf file)
Simalarly when he selects the other radio button i need to call a separate action in the controller.
Remember i dont have the submit button.
I want to dynamically call an action when the user selects the radio button.
i dont have any field inthe radio button which actually takes action as an attribute .
please provide me the necessaryHi,
You can use JavaScript to call the action in interest upon the Radio Button Element Being Selected.Should be simple, and if your controller is part of the portlet dont forget to use the jpfScopeId to asscoiate the controller instance with the one in the portlet.
Let me know if you have any further questions. -
How to undo hybernate mode in laptop when the lid is laid down?
How to undo the default hybernate mode when the laptop is closed? It is neede to work with external monitor, keyboard and mouse, keeping the laptop shut.
Hello,in Windows 8.1 you should go to Control Panel, then to Power Options and there should be something like "Require a password on wakeup". There you can choose the action, that should be taken after closing the lid.
-
How can we perform an External Action in the User Creation Workflow
Hi,
How can External Actions be performed in a Workflow while User Creation i.e., what all External Actions can be don, how to do it ?
Can I get a Guide for the same ?
RegardsHi,
I am guessing you are talking about OIM.Modifying Action classes or workflow should be last options so just give more thoughts on your business requirement. There is no official guide available for Modifying action classes as Oracle does not recommend it.Modifying action class is similar to any web application modification and it will depends on your knowledge and skills of struts and OIM so if you are well verse with what you can go ahead and modifying actions classes.
Regards
Nitesh -
How can I generate data when the link is click on?
i have written a stackoverflow question ,
would like some input if you have any , thanks, i would like to stay away from using jquery
http://stackoverflow.com/questions/23143436/how-can-i-generate-data-when-the-link-is-click -on/23143813?noredirect=1#23143813I think you need to rephrase your question and be more specific. Also for me the images you are referring to do not exist. From your question I am interpreting it as "how do I program?"
-
How can I make a JButton enabled when the user types smthg in a JTextField?
Hello,
I have a JButton and a JTextField on a frame. The JButton is disabled, myButton.setEnabled(false).
How can I enable the button when the user types something in the text field? Just typing, not pressing enter.
Thank youThere isn't one, actually. What you need is a DocumentListener and you have to associate it with the document object associated with the field i.e.
field2.getDocument().addDocumentListener() (new DocumentListener() {
}); -
My COM add-in is developed using VS 2010 and VB. It's a shared COM add-in (not VSTO) and it works with Excel 2007 - 2013. My installer is signed with a code signing certificate but it would appear that my add-in's .dll should also be signed if the user has
checked the "Require application add-ins to be signed by a trusted publisher" option.
The "Sign the assembly" option is checked in my add-in's VB -> My Project -> Signing. I have a .snk file selected which I seem to recall generating 6 or 7 years ago when I ported the COM add-in from VB6 to .NET.
I have an up-to-date Comodo code signing certificate (a pfx file called MyCompanyCodeSigningCertificatePrivateKey.pfx) which I purchased to use with the installer and was wondering if and how I could use this.
I tried selecting my pfx file in the My Project -> Signing -> "Choose a strong name key file" dialog. It made a copy of the pfx file in my project folder but when I tried to build the project, I got the following error:
Error 1 Cannot import the following key file: MyCompanyCodeSigningCertificatePrivateKey.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the
following key container name: VS_KEY_C0B6F251F0FB6016
After a little research, I found out I might be able to use signtool to sign the dll in a post-build step.
I added the following command to the post-build event, before the command I use to regasm the assembly.
"path to signtool\signtool" sign /f "MyCompanyCodeSigningCertificatePrivateKey.pfx" /p "xxxx" /v "$(TargetPath)"
When I built the project, the dll appeared to get signed (the output window showed a bunch of confirming text as well as "Successfully signed: c:\MyAddIn\bin\Release\MyAddIn.dll") but the next step in the post-build (regasm myaddin.dll /codebase)
issued a warning RA0000 (see below) but reported "Types registered successfully".
Here's the message I get from regasm, even though the output window says the dll was sucessfully signed:
RegAsm : warning RA0000: Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be installed on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re-register it.
Types registered successfully
I'm not using a shim if that makes a difference.
How do I sign my add-in so it loads when the user has checked "Require application add-ins to be signed by a trusted publisher"?
Any tips would be appreciated.Hello,
Why do you need to use the regasm utility from the post-build action?
There is a difference between signing the assembly with a strong name and digital signature. The
How to: Sign an Assembly with a Strong Name article in MSDN explains how to sign an assembly with a strong name (.snk). See
How to digitally sign a strong named assembly for adding a digital signature.
You may also find the
What's the Difference, Part Five: certificate signing vs strong naming article helpful. -
How can I attach an additional action to the "reset" button in the drag and drop interaction?
Hello,
I would like to know how to attach an additional behavior to the "reset" button in my drag and drop exercise.
Here is the background:
In my drag and drop exercise, when the user drops the source on a target of his choice, certain elements appear and certain elements disappear
This means that depending on where he dropped the sources, certain elements will be visible and certain elements invisible when he is finished the activity
Because the sources are not re-draggable once he drops them, he will have the option to reset the exercise and start again from the beginning using the reset button
My challenge:
I would like exercise to return to its original state when the user selects the rest button . this means:
the dragged objects return to their orginal starting location (this is what naturally occurs when you hit the reset button)
any objects that had disappeared during the course of the activity reappear
objects that were not visible in the beginning , but had appeared during the course of the activity, again become invisible
So how can I add this action to the reset button?Allowing the user to redrag the souce after it has been dropped would work for my particular problem if I could bind an action to the event redragging, namely making the elements reappear that had disappeared and the elements disappear that had appeared when the user dropped it the first time.
-
How do I call a method when the user clicks on the delete button?
Hello , I need to implement the following :
If date from is less than sysdate , when the user clicks the "delete" button , he is shown an error message .
Can you please help how this can be done ? Thanks.Thanks. What are the steps for adding a custom delete button ?
Are these ok ?
1 ) Add an adf button
2) Add the following in the actions listener : #{bindings.Delete.execute}
3) Right Click button --> create method binding for action
4) Compare date ?
Thanks. -
How to clear text fields when the user navigates back to the screen
Hi,
Does anyone have any idea on how to clear the text input fields and dropdown boxes when the user navigates back to the screen, say for e.g. create screen?
My issue is that i have plenty of fields in the create screen within a form. Is there a way to avoid programaticaly blanking out every field and just do it at the form level using an api to reset to a state before the user entry?
ThanksThis code allows you to make it more generic, and you would need to tweak it if there are more than TextInput controls, but it should provide some ideas.
As far as using states, you could use SetProperty to set the text to empty, but that might be messier.
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.containers.FormItem;
import mx.controls.TextInput;
import mx.events.IndexChangedEvent;
import mx.core.Container;
private function clearSreen(evt:IndexChangedEvent):void{
var view:Container = tn.selectedChild as Container;
for each(var child:Object in view.getChildren()){
if(child is FormItem){
var subchild:DisplayObject = child.getChildAt(0);
if(subchild is TextInput){
TextInput(subchild).text = "";
]]>
</mx:Script>
<mx:TabNavigator id="tn" resizeToContent="true"
change="clearSreen(event)">
<mx:Form id="frm1" label="View Number One">
<mx:FormItem label="First name:">
<mx:TextInput/>
</mx:FormItem>
<mx:FormItem label="Last name:">
<mx:TextInput/>
</mx:FormItem>
</mx:Form>
<mx:Form id="frm2" label="View Number Two">
<mx:FormItem label="Address1:">
<mx:TextInput/>
</mx:FormItem>
<mx:FormItem label="Address2:">
<mx:TextInput/>
</mx:FormItem>
<mx:FormItem label="City:">
<mx:TextInput/>
</mx:FormItem>
<mx:FormItem label="State:">
<mx:TextInput/>
</mx:FormItem>
<mx:FormItem label="Zip code:">
<mx:TextInput/>
</mx:FormItem>
</mx:Form>
</mx:TabNavigator>
</mx:Application>
If this post answers your question or helps, please mark it as such. Thanks!
http://www.stardustsystems.com
Adobe Flex Development and Support Services -
How to get the Useru2019s position when the user doesnu2019t have CP relation
We have a custom program which will add / delete attributes (In transaction PPOSA_BBP). It is working fine for users which were assigned with CP relation But it fails for users which doesnu2019t have CP relation (since we are getting the position of users form HRP1001 then we are retrieving the existing attributes based on the position after that updating the attributes) as we are getting the position from HRP1001 it fails for users were no CP relation.
Help us how to get the Useru2019s position when the user doesnu2019t have CP relation. Suggest us any function module or how to query the HRP1001 or some other table if exists
Regards
PaulHi Paul,
Have a look at these tables.
Using table BUT000 the central business partner data are stored, f.e. partner type, partner names, partner number, partner guid, person number, etc. In table BUTBKK the bank data to a business partner are stored.
Central business partner address data
The table ADRC is used for the address of a business partner. Table BUT020 links the business partner number with the address number. Using table BUT021 several addresses to a business partner with different usages (modes), f.e. correspondence or delivery address, can be stored. The personal data of a business partner person are stored with key person number in table ADRP. The person number is assignd to a business partner person in table BUT000. Communication data of business partners as e-mail, telephone, fax, etc. are stored in the tables ADDR1 u2013 ADDR12. The business address of a contact person or an employee consists of the organization address (company resp. org.-unit) and of an address addition, which describes f.e. a building, a room number, etc. The address addition is stored in table ADCP and is identified by the keys address number of the organization address and person number.
Relationships between business partners
Table BUT050 contains the relationships between a business partner organization and a business partner person using relation types. The relation types are defined in table TBZ9, f.e. the relation type u2018has employeeu2019 corresponds to identifier u2018BUR010u2019, the relation type u2018has contact personu2019 corresponds to identifier u2018BUR001u2019. Table BUT051 stores communication data of a contact person relationship (compare to table ADCP). Table BUT052 stores several address numbers to one business partner relationship (including a standard flag).
Hope this helps,
Kind Regards,
Matthew -
How do I verify my iCloud account when the email address Apple wants to send the instructions to doesn't exist? I know I need to change the email account associated with iCloud but there doesn't seem to be a way to do so. Any help would be greatly appreciated!!
Did you create an entirely new ID or did you just change the Gmail address to a new email address on your existing ID?
-
How do you reset apple ID password when the safety email address is no longer active?
How do you resent Apple ID password when the safety email address is no longer active?
The Best Alternatives for Security Questions and Rescue Mail
a. Send Apple an email request at: Apple - Support - iTunes Store - Contact Us.
b. Call Apple Support in your country: Customer Service: Contact Apple support.
c. Rescue email address and how to reset Apple ID security questions. -
How do I uninstall or reinstall itunes when the itunes.mls file is missing and won't do either without it? Have done a search for the file extension on PC and two external hard drives. Doesn't show up.
Download the Windows Installer CleanUp utility from the following page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
http://majorgeeks.com/download.php?det=4459
To install the utility, doubleclick the msicuu2.exe file you downloaded.
Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time? -
How I display a customize message(with a trigger)when a user left a blank field? I want to the stop the insert statament if the user left the status field in blank. I create a trigger but now I can't enter a row, i used an instead trigger
too but doesn't work. I want to display a customize message when the user left the
status field in blank or null.
I have the following code:
CREATE TRIGGER [dbo].[BLANKFIELD]
ON [dbo].[Status]
FOR INSERT
AS
BEGIN
IF (SELECT COUNT(*) FROM inserted WHERE Status IS NULL) =1
PRINT 'Please Fill the Status field is required'
Rollback;
ENDI agree with other comments that you should do this with specifying that the column is NOT NULL to prevent it from being NULL and a constraint if you don't want it to be blank (spaces or the empty string - note that the empty string is not the same thing
as NULL).
But for completeness, the reason your trigger does not ever allow you to enter a row is the code
IF (SELECT COUNT(*) FROM inserted WHERE Status IS NULL) =1
PRINT 'Please Fill the Status field is required'
Rollback;
Since you don't have a begin/end block after IF, the only conditionally executed statement is the one immediately following the IF (that is the PRINT). So the Rollback is always executed whether or not the IF is true and so all updates are rejected.
So if you were to do this in a trigger you could do something like the following
CREATE TRIGGER [dbo].[BLANKFIELD]
ON [dbo].[Status]
FOR INSERT
AS
BEGIN
IF EXISTS(SELECT * FROM inserted WHERE Status IS NULL)
BEGIN
PRINT 'Please Fill the Status field is required';
Rollback;
END
END
(As José noted, there can be more than one row in the inserted pseudo table, so you don't want to test whether the COUNT = 1, instead just whether one or more rows exist where the Status is null. If you want to prevent Status is NULL, or all
spaces, or the empty string, then your IF statement would be
IF EXISTS(SELECT * FROM inserted WHERE ISNULL(Status, '') = '')
Tom
Maybe you are looking for
-
EJBHome vs EJBObject what is the difference and which one is better
Hi 1) What is the advantage of LocalHome & LocalObject over EJBHome and EJBObject interfaces?? 2) In which situation we need to use LocalHome & LocalObject interface?? 3) In which situation we need to use RemoteHome & RemoteObject interface?? Thanks
-
Battery in my Zeen for my e510 exploded
The battery in my Zeen for my HP Photosmart eStation All-in-One Printer series - C510 exploded and popped the back right off of the ZEEN. Now I cannot use it. I emailed HP but they just sent back a generic email to contact a number for PARTS custom
-
Problems while migrating PDK applications from Portal 7.1 to Portal 7.3
Hi All, I am facing a problem while migrating a PDK application from Portal 7.1 to Portal 7.3. Since Portal 7.3 doesnt support PAR files any more it provided with a tool to convert the PAR to an EAR file and deploy the resultant EAR to the new portal
-
Shape Layers: Undefined is not an object
I've used rd_GimmePropPath to get the Match Names for shape properties but I get an "undefined is not an object" error using the following: app.project.item(1).layer("Shape").("ADBE Root Vectors Group")("ADBE Vector Shape - Ellipse")("ADBE Vector Ell
-
Dear All, select gjahr,wtg001, wtg002, XYZ, case when wtg001 != 0 then concat(gjahr, '001') wtg001 as XYZ <------------------------ Here i want value of wtg001 in XYZ else case when wtg002 = 0 then concat(gjahr, '002') end end as g