*
* @throws UnknownKeyException
* if a key for a displayed text could not be found
*/
protected void build() throws UnknownKeyException {
final SwitchLanguage sl = SwitchLanguage.getInstance() ;
this.setLayout(new BorderLayout()) ;
this.setBorder(BorderFactory.createTitledBorder(
sl.getText(LanguageConstants.HISTORY_TITLE_BORDER))) ;
JPanel north = new JPanel() ;
north.setLayout(new BoxLayout(north, BoxLayout.X_AXIS)) ;
this.path = new JTextField(sl.getText(LanguageConstants.NO_FILE)) ;
this.path.setFont(this.ITALIC) ;
this.path.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)) ;
north.add(this.path) ;
this.browse = new JButton(
sl.getText(LanguageConstants.BROWSE_BUTTON)) ;
this.browse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int browseResult = HistoryView.this.fileChooser.
showOpenDialog(HistoryView.this.container) ;
if (browseResult == JFileChooser.APPROVE_OPTION) {
HistoryView.this.model.addFile(
HistoryView.this.fileChooser.getSelectedFile()) ;
}// if
}// actionPerformed(ActionEvent)
}) ;
north.add(this.browse) ;
this.add(north, BorderLayout.NORTH) ;
this.adapter = new RecentFiles(this.model.getRecentFileInfo()) ;
this.recentFiles = new JList(this.adapter) ;
this.recentFiles.addListSelectionListener(new FileSelectionListener()) ;
this.recentFiles.setSelectionMode(ListSelectionModel.SINGLE_SELECTION) ;
this.recentFiles.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
// if right mouse button clicked (or me.isPopupTrigger())
if (SwingUtilities.isRightMouseButton(me)
&& !HistoryView.this.recentFiles.isSelectionEmpty()
&& HistoryView.this.recentFiles.locationToIndex(me.getPoint())
== HistoryView.this.recentFiles.getSelectedIndex()) {
HistoryView.this.popupMenu.show(
HistoryView.this.recentFiles, me.getX(), me.getY()) ;
}// if
}// mouseClicked(MouseEvent)
}) ;
JScrollPane scroll = new JScrollPane(this.recentFiles) ;
scroll.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)) ;
this.add(scroll, BorderLayout.CENTER) ;
this.delete = new JMenuItem(sl.getText(LanguageConstants.DELETE_BUTTON)) ;
this.delete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
HistoryView.this.model.deleteCurrentSelection() ;
}// actionPerformed(ActionEvent)