Question: Modify the actionPerfomed method from the last program in the lecture notes (the LocalisedGUI class) to also display the current date and time according to
Modify the actionPerfomed method from the last program in the lecture notes (the LocalisedGUI class) to also display the current date and time according to the selected language code. You need to use the DateFormat class. For this exercise, you can choose the formatting style (whether the date and time will be displayed in a SHORT format, MEDIUM format or LONG format).
Program:
public void handleList(){ int index = list.getSelectedIndex(); locale = new Locale(languages[index]); resBundle = ResourceBundle.getBundle("bn026Bundle", locale); nf= NumberFormat.getInstance(locale); greeting.setText(resBundle.getString("greeting")); thousand.setText(resBundle.getString("thousand") + nf.format (1000)); } public static void main(String[] args) { new LocalisedGUI(); }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
