Question: **ANSWER** DOes the question not ask for display the current date and time according to the selected language code .Modify the actionPerfomed method from the

**ANSWER** DOes the question not ask for display the current date and time according to the selected language code.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). This is the program -Thanks

public LocalisedGUI(){ super("localisation demo for 3 locales"); this.setSize(300, 200); this.setVisible(true); this.setLayout(new BorderLayout()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); locale = Locale.getDefault(); nf = NumberFormat.getInstance(locale); resBundle = ResourceBundle.getBundle("bn026Bundle", locale); upper = new JPanel(); upper.setLayout(new FlowLayout()); this.add(upper, BorderLayout.NORTH); middle = new JPanel(); middle.setLayout(new FlowLayout()); this.add(middle, BorderLayout.CENTER); middle1 = new JPanel(); middle1.setLayout(new FlowLayout()); middle.add(middle1, BorderLayout.NORTH); middle2 = new JPanel(); middle2.setLayout(new FlowLayout()); middle.add(middle2, BorderLayout.CENTER); //create GUI's and add upper.add(lang= new JLabel(resBundle.getString("lang"))); list = new JList<>(languages); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); upper.add(list); middle1.add(greeting= new JLabel(resBundle.getString("greeting"))); middle2.add(thousand = new JLabel(resBundle.getString("thousand")+ nf.format(1000))); list.addListSelectionListener(new ListSelectionListener(){ @override public void valueChanged(ListSelectionEvent e){ handleList(); } }); } 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!