I increase some functions of G Clock and release the version to 1.1
Update Items:
1. Increase a ComboBox, user could select 2 models to set alarm:
1.Countdown
2.Timing
2.Increase input columns of "Now Plan" and "Next
Plan", user could input their simple plan for remain.
3.Increase a button for quickly update "Next Plan" to "Now
Plan".
Codes:
The codes of Timing model as below:
UI排版/UI layout
I update a judgment code in button, program will judge the alarm function model by the selected combo box index.
btnSet.addMouseListener( btnEvent=new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
if(alarm_type_comb.getSelectedIndex()==0){ //模式選擇倒數計時
time_set = gfunc.countdown(hour_txt, minute_txt, second_txt, time_set);
}
else if(alarm_type_comb.getSelectedIndex()==1){ //模式選擇定時
time_set = gfunc.trageTiming(hour_txt, minute_txt, second_txt, time_set);
}
gfunc.buttonStatus(btnSet, time_set);
}
});
運算端/Function part
The codes of check timing as below:
public boolean trageTiming(JTextField hours, JTextField minutes, JTextField seconds, boolean a){
try{
hours_tmp=hours;
minutes_tmp=minutes;
seconds_tmp=seconds;
if(Integer.parseInt(hours_tmp.getText())<9){ //個位數時補0
hours_tmp.setText("0"+Integer.parseInt(hours_tmp.getText()));
}
if(Integer.parseInt(minutes_tmp.getText())<9){ //個位數時補0
minutes_tmp.setText("0"+Integer.parseInt(minutes_tmp.getText()));
}
if(Integer.parseInt(seconds_tmp.getText())<9){ //個位數時補0
seconds_tmp.setText("0"+Integer.parseInt(seconds_tmp.getText()));
}
}catch(NumberFormatException e){ //防止輸入非整數
hours.setText("");
minutes.setText("");
seconds.setText("");
return a=false;
}
alarm_type_comb.setEnabled(false);
Thread t = new Thread(new Runnable(){
String target_time=hours_tmp.getText()+":"+minutes_tmp.getText()+":"+seconds_tmp.getText();
public void run(){
while(!(clock().equals(target_time))&& time_set==true){ //迴圈直到 時間與目標相等(每一秒檢查一次)
try {Thread.sleep(1000);}catch (InterruptedException e) { }
}
if(clock().equals(target_time)) {timeUp();btnSet.setText("Time Up");}//時間到, 啟動鈴聲並讓按鈕顯示"Time Up"
}
});
if(a){
time_set=false;
t.interrupt();
}
else{
time_set=true;
t.start();
// System.out.println(a);
}
// System.out.println(time_set);
return time_set;
}
Goal of Update
1.
Add dynamic effects on time up
alarm.
Ex: color twinkling, window shake, etc…
2.
Add function that user can
select the alarm ring file by self.
3.
Add function that the G Click
window could be shrink to minimum size at the tool bar.
4.
Add effect that G Click window
will show on the top will time up.
User Manual
https://drive.google.com/file/d/0B2SpFawN0Ts6MU9WbVQ0ZmlNa3M/edit?usp=sharingProgram Link
=======================
如果你有好的想法或發現漏洞,歡迎提供建議
If you have good idea or find any bug, welcome to advice me.
一起成長吧!
That's grow up together!


沒有留言:
張貼留言