For JTable MouseClick event
hello, every one, yestoday I make a program with JTable. I know how to do a muti_selection, but I only know use "ctrl + left mouse". I want to use "double click" instead of "ctrl + left mouse".
So, the problem is I don't know how to write code for it? Who can tell me how to do? Thand you.
http://java.sun.com/docs/books/tutorial/uiswing/
Add action listeners to the buttons.
Similar Messages
-
I have been having some inconsistencies with mouseEvents not firing. I have a mouseClicked event handler assigned to a radio button within a JTable. Occasionally it does not register clicks of the mouse - which obviously causes all manner of problems. I have traced the problem down and it appears to be that the mouseClicked is affected by moving the mouse between pressing and releasing - even if the mouse doesnt exit the radio button (mouseExited). I have got around this by changing to a mouseReleased but my question is:
Is this the normal behaviour or is there some sort of bug or perhaps some problem with the way they are being used.
I have researched further and this seems to happen to not just be tied to my circumstances - if you go to this address and run the MouseEventDemo you will see that if you move the mouse between clicking and releasing no mouseClicked event fires: http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html
Or am i being stupid?Hi georgemc,
With regards to whether its best to use with a radio button - probably not but that was just one example of where it is being used. The reason in that case i have needed to use a mouse event on the radio button is to be honest because i cant get a radio button correctly set up within my JTable and so i have had to create an extra column with another radio button and then emulate a radio buttongroup by having the negation of the boolean of the selected radio button set as the value of the other by my mouse listener! This mouse listener also caches changes for later saving back to db
In an ideal world i would have these two columns in a button group or possibly even better have on bit of data being represented as a pair of radio buttons
What type of listener would you suggest in the hypothetical situation that i had a working set of radio buttons within a JTable? -
How to handle mouseclicked events in a ListView node correctly?
Hi
We want to simulate table rows and headers with a ListView. We have an additional requirement that when a particular row is selected, a X icon will appear at the last column. Clicking which will remove the row from the table.
A snippet from the implementation is given below
public class SampleList extends ListView{
function getRow(row :Row, index:Integer, cell:ListCell):Node {
HBox {
var closeView : Image
content : [
Label {textWrap:true, text: bind row.id, layoutInfo: bind LayoutInfo {width:width * .2, height:height * .02 }}, //some column 1
Label {textWrap:true, text: bind row.name, layoutInfo: bind LayoutInfo {width:width * .12, height:height * .02 }}, //some column 2
close = ImageView {
image : Image{url:"close.png"}
disable: bind cell.selected and not cell.empty
pickOnBounds : true
onMouseClicked : function (event):Void{
if (not close.disable)
//delete from row from model (Row)
} //close column
override var cellFactory = function () {
def cell : ListCell = ListCell {
onUpdate: function() {
def item = cell.item;
cell.node = if (item == null) null; else getRow(cell.item as Row, cell.index,cell);
} The problem with the code is that the mouse clicked event used by the close button is multiplexed - Firstly - the application logic - it is used to delete the row from the model and secondly - the ListView control - uses it to trigger a item selection internally. As a result, if you click on a row which is not yet selected (in the sense that it is highlighted) at the exact location of the X icon, the row is deleted without it having been ever highlighted
If you note the code above, you will notice that the close image's mouseclicked event checks cell.selected before deleting it. And cell.selected is true even though the list has not been highlighted
Any workarounds for this problem would be appreciated
Thanks
DhruvaUser, please always tell us your jdev version.
In general you use a valueChangeListener which is fired when the user tabs out of the field...
Timo -
I'm trying to assign a mouseclick event listener to a simplebutton nested within a movie clip's later frames, starting at frame 2 and up. This card, however, is not added to my game until later, and when the player clicks on it/turns it over.
There are four files involved in this program:
#1 The main actionscript file, which corresponds to
#2 my dreamQuester .fla file.
#3 my artifactCard file movieClip's corresponding .as file,
#4 my combo1.as file corresponding to a an instance of a simpleButton named combo1 that is already
nested --and this instance is already named-- inside/as a child of said artifactCard movieclip.
What I've done so far isn't working:
In my main dreamQuester.as file, when a player clicks on an artifactCard, its MOUSE_DOWN event
listener takes them to this function (clickArtCard), where the trouble is at:
// player clicked on the artC card--which is a child of posArt1 on stage--to turn card over:
function clickArtCard(a_event:MouseEvent) {
var thisArtCard:artifactCard = (a_event.target as artifactCard);
thisArtCard.gotoAndStop(unclickedArt1); // go to frame number of artifact
// card where combo1 button is.
thisArtCard.removeEventListener(MouseEvent.CLICK,clickArtCard);
thisArtCard.buttonMode = false;
trace("combo1.combo is:" + combo1.combo);
trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1);
posArt1.artC.combo1.addEventListener(MouseEvent.MOUSE_DOWN, comboClickedWHO);
when the artC card--the static public instance of artifactCard--is clicked, it only gets to the
trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1); which returns this error message:
TypeError: Error #1010: A term is undefined and has no properties.
at MethodInfo-61()
So do how would I declare a static public variable of this simpleButton at the start of my main .as
file to make it defined to get a mouseDown actionListener into my pre-existing-and-named-instance
combo1 simpleButton?
perhaps there is a way, while the debug movie program is running, to click on the simpleButton and see exactly
what it's parent heirarchy is, to see the name of all parents above the simpleButton incase they are
different then what I think?
(just in case, I was hoping to squeeze a zip file containing these files to be less than 9MB incase someone was willing to look at my files to see what I've done so far, but 9 megs is just too big! even though all graphics I've imported where turned into vector graphics with trace bitmap. I wish there was a way to check the file size of each symbol in Flash CS4, here...)
Thank you so much for any help!
~EthanJust use a
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
function keyPressed(event:KeyboardEvent):void {
//trace(event.keyCode);
if(event.keyCode == ???){
// play the sound
Where I show the "???" you would replace with the keyCode for the key you want pressed for that sound. To determine the keyCode you can use the trace line that I have commented out.
Note that when testing in Flash you often need to disable the keyboard shortcuts in the Flash Player in order to be able to use alot of the keys. You will find this option in the Control menu options in the player. -
MouseClicked event = enter key doesnt work
Hello,
when I make some JButoon and add to it MouseClicked event (witch handles some code) everything works fine. But when I mark it with TAB then press ENTER button wont "doClick".
So I found out that actionPerformed might be the right handler, but I dont understand why there is also mouseClicked event?
Is actionPerformed event what I need (to work either with LMB or ENTER key) ?
Are there any disatvantages of actionPerformed event comparing to mouseClicked event?The spacebar, not the Enter key, is the default keyboard trigger for a button that has the focus (and not just in Java).
If you really want the focused button to respond to the Enter key, search this forum for"DefaultButtonFollowsFocus".
db -
Intercept a mouseclick event with a background running application
Ciao to everyone.
My name is Alessandro and "i have a problem"...
I want to count every click of my mouse with an application running in background.
How can i intercept any mouseclick event, also those occurring out of the application?
I work with Windows XP.
Thanks and excuse me for my bad english.As far as we know when a Java swing application loses focus you can not handle the click being generated by the user.
Have a look at the following source:
http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html
We have developed routines for that kind of handling in C+ and set up java JNI in order to retrieve them, but they are low level routines that need to handle interruptions from the main board (not recomended for average users).
Answer provided by http://www.consultoriajava.com -
What is wrong with the mouseClicked event?
there is a weird problem with my program: I constructed a panel with two componets(I constructed a new class for the component that extends TextArea);Both components are registered in a mouseClicked event(when I click the component, the text in the component will display).Eveything seems OK when I click one component first.But when I click other one, the text in the component will display twice,like I click twice. if I go back to first component,the text in the first one will display three times, like I clicked three times and so on.
Does anybody can give me some hints?
thanks in advanceplease check the codes related to event:
public class VectorCellEditor extends MultilineCellEditor implements MouseListener
public VectorCellEditor()
super();
public void initialize( InitialEvent ev,CellInfo info,Object o)
String str="";
if(o==null)
str ="";
else if(o instanceof String)
str =(String)o;
else if(o instanceof Vector)
String dateString =((Data)(((Vector)o).firstElement())).getDateString();
String dataString="";
for( int i = 0;i<((Vector)o).size();i++)
dataString = dataString+((Data)((Vector)o).elementAt(i)).toString()+"\n";
str = dateString+"\n"+dataString;
super.initialize(ev,info,str);
super.setEditable(false);
addMouseListener(this);
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e)
public void mouseMoved(MouseEvent e){}
public void mouseClicked(MouseEvent e)
String s = this.getText();
calendar.area.append(s);
} -
JTextArea problem: mouseClicked event irregular
My application allows user to add several CalcArea objects (a subclass of JPanel) in a big JPanel. Highlight of ClassArea class is given below.
Strangely, I find that once in a while, mouseClicked event is not fired. It is very critical for my user to select a particular CalcArea and modify/update the currently selected CalcArea. It is very much annoying to find that the mouseClicked event occurs irregularly. Please advise me how I can make sure mouseClicked event occurs when user clicks on the desired CalcArea. Thanks.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.math.*;
import javax.swing.border.*;
import java.awt.print.*;
public class CalcArea extends JPanel implements MouseListener, FocusListener
JTextArea ta;
DrawPanel dp; //subclass of JPanel
static int iCount=0;
static int selectedMemberID=-1;
int memberID; //unique ID (0-based)
//constructor
public CalcArea(String strID....)
} //constructor ends
public void mousePressed(MouseEvent e)
} //method mousePressed ends
public void mouseClicked(MouseEvent e) //***Problem here
selectedMemberID= memberID;
System.out.print("mseClicked***");
public void mouseReleased(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}Is there any way to solve it? I don't really understand what you are trying to accomplish, but maybe somthing like the following will help:
e.getComponent().getGraphics();
e.getComponent().getParent().getGraphics(); -
No calendar change for a single event in a recurrring string of events
Why won't iCal allow me to change the calendar for a single event in a string of recurring events? Why am I not allowed this, but can change other details and even get prompted whether I want these changes to take effect over the single event or all the recurring events????
Could this be implemented in a future version of iCal???
Thanks.How are you making the .ics file? What value has the METHOD: entry?
AK -
Setting up ESS for Training and Event Mgmt
Hello to all SAP HR experts,
i am now doing a project on SAP ERP HCM and would like to learn more about the things and steps i need to do to come up with a ESS for Training and Event Management. I have an account for SAP Netweaver and able to access Enterprise Portal (EP). Do i require to navigate in EP to use the items there or do i need to set up an adobe interactive form using SAP Netweaver Developer Studio, design the flow at Visual Studio(VC), then link all the VC at Guided Procedure? If that's the case how am going to extract the data which i have configured in the IMG path under Training and event mgmt (TEM) and also SAP Learning Solution(LSO)?
For an example: I have created Training Event Groups, Training Event Types and Courses. If i want to so a paperless ESS, how can i extract all this into the fields which i have designed in my adobe interactive form.
Please help me and guide me along
Thank you in advance:)
Regards,
JennyHi
There are 2 end user possibilities for Learning
One is PV7I and PV8I ITS services which are part of an old ESS role and can be used as integrated ITS versions
any ESS role via HpF or called directly via URL (without a Portal) - this will allow users to book course and events and view/change bookings etc
The other is Business Package for Learning 1.0 which requires a Portal (and other LSO dependancies to run)
this provides a wider range of Learning based activities including booking etc
Best wishes
Stuart -
How to create custom infotype for training and event management
hai freinds can any one tell me how to create custom infotype for training and event managment with following fields
PS No PA0000-> PERNR
Name - PA0001 -> ENAME
IS PS.No. PA0001-> PS no. of Immediate Superior
IS name PA0001 -> ENAME
thanx in advance
afzalHi,
Your question is not clear for me. Since it is a TEM infotype, it could be a PD infotype.
If you wish to create a PD infotype, use transaction PPCI to create the infotype.
But before that you need to create a structure HRInnnn (where nnnn is the infotype number) with all the fields relevant for the infotype.
If you wish to create a PA infotype, use transaction PM01 to create the infotype.
But before that you may be required to create a strcuture PSnnnn (where nnnn is the infotype number) with all the fields relevant for the infotype.
Regards,
Srini -
User exit / BADI for training and event management
Hi all,
Can anybody tell me if there is any user exit / BADI for training and event management module?
Thanks & regards,
LOIHi
BADI's for Training and Event Management
HRTEM00MASTERDATA HR: Training and Event Management - Master Data
HRTEM00NET_ACTIVITY Determine Activities of an Attendee (e.g. ESS PV8I)
HRTEM00NET_WEBST Set Cancellation Reason in ESS PV8I
HRTEM_CORR_NOTIF_REQ Customer Enhancement:Confirmation on Send (R/3 Mail, E-Mail)
HRTEM_HANDLE_BOOKING HR-TEM BAdI: Employee Leaves Company - Update TEM Data
HRTEM_INT_ZW HR-TEM: Badi for Integration TEM - Time Management
HRTEM_READ_OBJECT Customer Enhancement: Name Format
RHPV0001 Customer Enhancement for Additional Checks for Booking
Enhancemnet Spot:
HRTEM00MASTERDATA HR: Training and Event Management - Master Data
~~~Ganesh Kumar K. -
Configuration documents for Training and event management &apprisals?
hello xperts
can anyone forward me configuration documents for treaining and event management and apprisal? to [email protected]Thanks for your suggestions.
i can't go through new appraisal model with catalog & template, because client is not having ESS,MSS. appraisal has to done in the ECC only.
Done the customization like this :
created scales
created appraisal model and assign the scales
for appraisal, Employee can do from APPCREATE transaction rate his own ratings and save.
Now Appraiser (Manager) from APPCHANGE complete the appraisal.
now my requirement is (1) after saving the APPCREATE by the employee, notification has to go to his reporting manager only. (2) Manager can do review/change and complete the process to his Employees only (who are reporting to him)
how can i do this, standard functionality is there or i have to go for ABAP coding ? if ABAP coding what i have to ask them to do.
Please help in this requirement.
Thanks and Best Regards,
Praneeth kumar -
Workflow for training and event management
Hi,
I have to develope a workflow regarding event type prebooking whic will be pre-booked thru pv02 , now my requirement is to send a workitem text to manager ess account who will appprove or reject this event type.
After approval it shud make updation in database but not in the case of rejection .After that Manager preebook a event for those who are alredy approved for the same event type and after event booking it shud also update the attendance table or infotype .
Thanks .Hi,
Set the Values to the Business Object container
SWC_SET_ELEMENT CONTAINER 'profit' profit.
Read the Values in the attribute
swc_get_property SELF 'TravelerName' Lv_traveller
Also refer this [Link|https://wiki.sdn.sap.com/wiki/x/moOmAw]
Regards,
Surjith
Edited by: surjith kumar on Mar 26, 2009 9:45 AM -
How do I add a recurring event to repeat on the fifth recurring day of the month, for example, an event that only happen on the fifth Sunday of the month for those months that have a fifth Sunday?
Create one on the first Tuesday, select repeat/monthly and take the option at the bottom.
Maybe you are looking for
-
Computer keeps 'loosing' one of the two attached displays.
My graphics adapter is an 'ATI RADEON HD5770'. I have two displays attached, a 23" Cinema HD, and a 20" Cinema. It has worked OK for a year or so and now I have a problem where the computer 'looses' the 20" display (assgined as monitor 2) at power-
-
TS4457 Iphone 4s ios 7.1 facetime and calling problemd
I have the iphone 4s w/ ios 7.1. After a week I got it whenever I called someone they couldnt hear me but i could hear them. Siri works fine so its not the mic, voice memos also works too. And also on facetime I recieve calls but when I press ok its
-
Oracle 10g Enterprise Manager web service unable to start
I am unable to get Enterprise Manager web service for Oracle 10g to start in Windows. Anybody can tell me where to find out what is the problem and what are the possible problems and solutions? I do not wish to re-install or create a new database ins
-
Skype Keeps Quitting Unexpectedly
Hi, ever since today my skype application just decides to keep qutting unexpectedly on me as soon as i open the application up. Here is the error code. Can someone please help me fix this problem. Thanks Process: Skype [645] Path:
-
LaserJet 3105x printing to Tray 1 - Manual on macs prints from Tray 3
On every other model of LaserJet when the user selects "Tray 1 - Manual" under the mac print options the printer prompts the user to load paper into Tray 1 and waits indefinitely until paper is loaded. Now with the LaserJet 3015x, the printer just pr