pressed

How to change button image on click?

痴心易碎 提交于 2019-12-12 03:56:27
问题 I am using images and hrefs to create buttons. Code look like this: <a href="http://www.zive.sk"><img src="res/images/zive.png" alt="Zive.sk" id="ziveCircle"></a> Is there any way to change image src if user press button? Maybe some event handler which will determine that user has pressed image? It should act as normal button so when user press it and keep pressed it should change image src and when he releases the button then the href should be loaded (normal button behaviour). PS: I cannot

Test if a javax.swing.JButton is pressed down

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:55:24
问题 I would like to check whether a certain javax.swing.JButton (regular push-button) is pressed down (before it was released). Is there any option at all to check whether a button is down? The most trivial solution is to add a MouseListener that will respond to the mouse click and release events. But, this does not cover the case where the button was activated by the Enter key, or any other way. I don't want to disable activating the mouse by keyboards or other ways - I just want to know when is

Change background of Expandable List child view when an element in child layout is clicked

心不动则不痛 提交于 2019-12-10 23:08:31
问题 I need to change the background of the child view in Expandable list view when child is clicked. Child row layout is something like: <RelativeLayout> //Selector is placed for this layout .... <RelativeLayout> .... <RelativeLayout> .... <TextView> .... .... selector: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable= "@drawable/greyish"/> </selector> Now, when i clicked on TextView i

Disable pressed background color of button

倾然丶 夕夏残阳落幕 提交于 2019-12-10 12:12:54
问题 My button consists of only letters. Every time i press it, it has a black background. How do i disable the black background? I don´t want to change the color, i want to disable the pressed state. 回答1: You need to create selector under drawable folder and set color or image over there for different sates of the button. I have created one sample application for you and am pasting code snippet: Code for button_selector.xml that contains selector code for button which you will need to put under

Java KeyListener - How to detect if any key is pressed?

青春壹個敷衍的年華 提交于 2019-12-08 08:16:00
问题 I've added a KeyListener to a TextArea and wish to check if any key is pressed down. I have the following but it's too clumsy to check for all the letters and numbers: public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_A || e.getKeyCode() == KeyEvent.VK_B || e.getKeyCode() == KeyEvent.VK_C ||e.getKeyCode() == KeyEvent.VK_D etc...){ } } 回答1: You wouldn't need any if statements. The keyPressed method is fired whenever a key is pressed, so you're automatically thrown into the

tcl pause & waiting for key pressed to continue

限于喜欢 提交于 2019-12-07 10:39:22
问题 I'm looking for a way in tcl to pause the script (for example after some outputs with "puts") and wait for a key pressed from the user before continuing to output the remaining text. 回答1: With gratitude to Hai Vu's answer, if you're on a unix-like system with stty proc anykey {{msg "Hit any key: "}} { set stty_settings [exec stty -g] exec stty raw -echo puts -nonewline $msg flush stdout read stdin 1 exec stty $stty_settings puts "" } puts 1 anykey puts 2 Link to thorough discussion on Tcl

To increase a button's size when it is pressed in Android

荒凉一梦 提交于 2019-12-06 09:27:30
How can I make my button's size to increase slightly when it is pressed and decrease again when it is released? This is for highlighting the pressed button, by using size in addition to a different color. Regards, Kiki Make your Button a field, and modify its size in the OnTouchListener associated with it. Using an OnTouchListener you can listen for different MotionEvents , such as ACTION_DOWN and ACTION_UP . button.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout

Android button hover event

依然范特西╮ 提交于 2019-12-06 05:54:10
问题 I use a XML file to display a button with 2 states (normal, pressed). How can I find out when the button is pressed? Is there an event like onClick --> onPressed or how can I find it out? Here is the XML file I use: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/buttonbluepressed" /> <item android:state_focused="true" android:state_pressed

tcl pause & waiting for key pressed to continue

北战南征 提交于 2019-12-05 14:08:44
I'm looking for a way in tcl to pause the script (for example after some outputs with "puts") and wait for a key pressed from the user before continuing to output the remaining text. With gratitude to Hai Vu's answer, if you're on a unix-like system with stty proc anykey {{msg "Hit any key: "}} { set stty_settings [exec stty -g] exec stty raw -echo puts -nonewline $msg flush stdout read stdin 1 exec stty $stty_settings puts "" } puts 1 anykey puts 2 Link to thorough discussion on Tcl wiki: Reading a single character from the keyboard using Tcl You just use gets to read from stdin: proc pause {

Android button hover event

假如想象 提交于 2019-12-04 09:10:50
I use a XML file to display a button with 2 states (normal, pressed). How can I find out when the button is pressed? Is there an event like onClick --> onPressed or how can I find it out? Here is the XML file I use: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/buttonbluepressed" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/buttonbluepressed" /> <item android:state_focused="false" android