Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5383
| Newsgroups | comp.lang.java.gui |
|---|---|
| Date | 2013-10-20 07:11 -0700 |
| Message-ID | <8f1ddeb0-aebc-435d-a8d9-f0fbe69d4e5f@googlegroups.com> (permalink) |
| Subject | How to add time delay in JFrame ? |
| From | Khoa Bach Tran <curianhg@gmail.com> |
First of all, sorry for my bad english.
Now I have to demo how the sort code work on Java JFrame but the problem is I dont know how to make the delay between the switch.
How can I add the delay when mark the column with color ? Already searched on many threads by googles but i'm too newbie to know how the code work with Swing timer.
public void MarkColumn(JLabel column) {
column.setBackground(new Color(255, 153, 0));
//Delay 1.5 seconds;
}
public void UnmarkColumn(JLabel column) {
column.setBackground(new Color(51, 153, 255));
//Delay 1.5 seconds;
}
void sort()
{
for (int i = 0; i < list.size() - 1; i++) {
MarkColumn(columns.get(i));
for (int j = list.size() - 1; j > i; j--) {
MarkColumn(columns.get(j));
if (list.get(j).getPoint() < list.get(j - 1).getPoint()) {
SinhVien tg = list.get(j - 1);
list.set(j - 1, list.get(j));
list.set(j, tg);
}
UnmarkColumn(columns.get(j));
}
UnmarkColumn(columns.get(i));
}
}
Very appreciated for your helps.
Back to comp.lang.java.gui | Previous | Next — Next in thread | Find similar
How to add time delay in JFrame ? Khoa Bach Tran <curianhg@gmail.com> - 2013-10-20 07:11 -0700 Re: How to add time delay in JFrame ? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2013-10-20 13:44 -0700
csiph-web