If keyCode is not caught, catch which:
- 12月 24 週一 201808:23
jquery disable form submit on enter
If keyCode is not caught, catch which:
- 11月 06 週二 201220:56
[JAVA] Initializing an ArrayList in a constructor with parameters
Just a quick question, how would you go about initializing a new ArrayList in a constructor which takes its values as parameters?
For example say I have a class which has an ArrayList of strings called bookings. I've already written a constructor which sets all fields to default values, so sets bookings to a new ArrayList of strings. However, the task I've been given is to write a second constructor which uses parameters to set the field values instead of setting them to defaults. This is fine for all my other fields, but how would I do this with the ArrayList?
Ans:
For example say I have a class which has an ArrayList of strings called bookings. I've already written a constructor which sets all fields to default values, so sets bookings to a new ArrayList of strings. However, the task I've been given is to write a second constructor which uses parameters to set the field values instead of setting them to defaults. This is fine for all my other fields, but how would I do this with the ArrayList?
Ans:
- 3月 20 週二 201211:45
[轉貼] focus & key board listner problem in cell table in gwt
Question:
I have one small problem i.e. one textbox is their when click on the text box the popup is shows below the text box.The popup contains celltable
i write keypresslisner for textbox when i press Down And UP arrow the focus is set to be cellTable And also we still press down and up arrows its highlites the rows in celltable
Ans:
I have one small problem i.e. one textbox is their when click on the text box the popup is shows below the text box.The popup contains celltable
i write keypresslisner for textbox when i press Down And UP arrow the focus is set to be cellTable And also we still press down and up arrows its highlites the rows in celltable
Ans:
- 1月 11 週三 201215:42
[轉貼] GWT - Browser window resized handler
Q:
I am developing a GWT application that render a text on a canvas. I want to resize the canvas whenever browser window resized. The problem is if I used Window.addResizeHandler, the rendering process with each resize will be very slow. So I need a way to resize the canvas only when the user release the mouse button after finishing resize. Is there anyway to do that?
A:
I am developing a GWT application that render a text on a canvas. I want to resize the canvas whenever browser window resized. The problem is if I used Window.addResizeHandler, the rendering process with each resize will be very slow. So I need a way to resize the canvas only when the user release the mouse button after finishing resize. Is there anyway to do that?
A:
- 1月 10 週二 201216:40
[轉貼] GWT/Firefox: getOffsetHeight() always returns 0
Q: Using GWT 1.6.4, I have the following code to retrieve the dimensions of the browser window:
RootPanel panel = RootPanel.get();- 12月 22 週四 201118:11
Java 日期 v.s 字串 互轉
Java 日期轉字串範列
1.//目前時間2.Date date = new Date();3.//設定日期格式4.SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");5.//進行轉換6.String dateString = sdf.format(date);7.System.out.println(dateString);
Java字串轉日期範例
1.//欲轉換的日期字串2.String dateString = "20010-03-02 20:25:58";3.//設定日期格式4.SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");5.//進行轉換6.Date date = sdf.parse(dateString);7.System.out.println(date);
以上不支援 gwt, 若要在 gwt 字串日期互轉, 必須使用 DateTimeFormat
原因為:
GWT Doesnt support this java APi. It's explicit in documentation pages
GWT does not provide full emulation for the date and number formatting
classes (java.text.DateFormat, java.text.DecimalFormat,
java.text.NumberFormat, java.TimeFormat, et cetera). Instead, a subset
of the functionality of the JRE classes is provided by
com.google.gwt.i18n.client.NumberFormat and
com.google.gwt.i18n.client.DateTimeFormat
GWT provides the DateTimeFormat class to replace the functionality of
the DateFormat and TimeFormat classes from the JRE.
詳細用法, 請參考 http://code.google.com/intl/fr/webtoolkit/doc/1.6/DevGuideCodingBasics.html#DevGuideDateAndNumberFormat
參考資料: GWT官方文件 and http://cooking-java.blogspot.com/2010/03/java-string-to-date.html
- 12月 19 週一 201120:21
[轉帖] Using GWT 1.6’s DatePicker Widget as PopUp
I assumed the new date picker would entail also an edit field (based on readings in the corresponding wiki).
However this is not the case and you need to display it yourself on a panel. Ok admitted; it is better to have the flexibility to customize it yourself. For those – who like me are a bit rusty on their GWT – a sample piece of code of how to create a button with a popup panel containing the date picker and showing the date in a text box:
It is similar to the sample app that the webAppCreator cmd creates; it assumes an html with two elements defined.
However this is not the case and you need to display it yourself on a panel. Ok admitted; it is better to have the flexibility to customize it yourself. For those – who like me are a bit rusty on their GWT – a sample piece of code of how to create a button with a popup panel containing the date picker and showing the date in a text box:
It is similar to the sample app that the webAppCreator cmd creates; it assumes an html with two elements defined.
1