Hi,
I've been trying out this code http://www.dreaminco...er-application/, but I would like to add the function of adding/removing an event by clicking inside the calendar. Ideas on how I can do that? Any type of help is greatly appreciated!
GUI Calendar
Page 1 of 17 Replies - 5728 Views - Last Post: 03 May 2011 - 04:14 AM
Replies To: GUI Calendar
#2
Re: GUI Calendar
Posted 25 April 2011 - 03:43 AM
Just add a standard listener to it, but then find the cell that was selected with the following methods:
http://download.orac...ectedRows%28%29
http://download.orac...edColumns%28%29
Since you know only one cell will ever be selected at a time (as per the tutorial), this is a safe method for doing so.
http://download.orac...ectedRows%28%29
http://download.orac...edColumns%28%29
Since you know only one cell will ever be selected at a time (as per the tutorial), this is a safe method for doing so.
#3
Re: GUI Calendar
Posted 25 April 2011 - 04:22 AM
Could you explain it in a bit more detail? And how do I add a MouseListener? Because I tried this
But it didn't work.
handelerC handeler = new handelerC();
panel.addMouseListener(handeler);
private class handelerC implements MouseListener {
public void mouseEntered(MouseEvent event) {
statusBar.setText("hi");
}
public void mouseExited(MouseEvent event) {
statusBar.setText("bye");
}
public void mouseClicked(MouseEvent event) {
statusBar.setText("you clicked");
}
But it didn't work.
#4
Re: GUI Calendar
Posted 25 April 2011 - 02:48 PM
Don't you want to set the MouseListener on the JTable instead?
#5
Re: GUI Calendar
Posted 26 April 2011 - 04:30 AM
We want a MouseListener so we can click on different days and add text to that specific day. So if adding the MouseListener on the JTable will make that work, that's what I want!
#6
Re: GUI Calendar
Posted 26 April 2011 - 08:13 AM
That's exactly what you want. Check out the JTable rowAtPoint() and columnAtPoint() methods as well.
#7
Re: GUI Calendar
Posted 02 May 2011 - 05:55 AM
So I changed this part:
Returning true instead of false. And now I can write in the cells, but it isn't pretty, haha.
Someone told me that I could use something called TableCellEditor, but I don't really understand how that works. Is there anyone who feels like explaining it a bit?
tableModel = new DefaultTableModel(){public boolean isCellEditable(int rowIndex, int mColIndex){return false;}};
Returning true instead of false. And now I can write in the cells, but it isn't pretty, haha.
Someone told me that I could use something called TableCellEditor, but I don't really understand how that works. Is there anyone who feels like explaining it a bit?
#8
Re: GUI Calendar
Posted 03 May 2011 - 04:14 AM
Anyone?
Just a little help would be so appreciated!
Just a little help would be so appreciated!
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|