Results 1 to 2 of 2
Thread: Problem with JList event.
- 05-28-2012, 07:12 PM #1
Member
- Join Date
- May 2011
- Posts
- 8
- Rep Power
- 0
Problem with JList event.
Hi,
I created a calendar, that JList represents the days of the week, its look like that :

I want to create event that every time i`ll click on one of the days (one of the JLists) i will add some appointment to this day.
I have a problem to know which exactly list i clicked.
This is the way i setup all my JLists :
Java Code:JList list; for (int i=0; i<Days; i++) { calendar.set(Calendar.YEAR, Calendar.MONTH, i); String TempStr[] = {Integer.toString(i+1) + "/" + Integer.toString(month) + "/" + Integer.toString(year)} ; list = new JList<String>(TempStr); list.addFocusListener(handler); pane.add(list,c); }
How do i get to the context on every list?
When i click on every list how can i know which exactly list i clicked?
I have tried to you at the FocusEvent, but list.getSelectedValue() show me null.
I hope that i was clear enough.
Thanks for helpers,
Or.
-
Re: Problem with JList event.
The FocusEvent object passed into the focusGained method will tell you which object set off the event. Call getSource() on the object, check to be sure that it's a JList, and then cast it to JList.
Similar Threads
-
JList problem?
By tom2zip in forum AWT / SwingReplies: 2Last Post: 01-12-2012, 07:12 AM -
Problem With jList
By amitabh in forum NetBeansReplies: 3Last Post: 06-03-2010, 06:28 AM -
JTabbedPane & JList Event Handling
By MuslimCoder in forum New To JavaReplies: 2Last Post: 10-05-2009, 05:44 AM -
JList and JButton event handler not working
By H3rtaherta in forum AWT / SwingReplies: 3Last Post: 11-22-2008, 12:00 AM -
JList problem
By zizou147 in forum Advanced JavaReplies: 1Last Post: 04-17-2008, 08:50 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks