Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions