📄 firstpanel.java
字号:
help_manual_btn = new JButton( "MANUAL" ); help_manual_btn.setToolTipText( "Open the user's manual window" ); // help_manual_btn.setBorder( empty_border ); help_manual_btn.setMargin( btn_insets ); help_manual_btn.addActionListener( new HelpManualButtonListener() ); toolbar.add( help_manual_btn ); icon_URL = null; icon_URL = getURL( faq_icon_path ); if ( icon_URL != null ) help_faq_btn = new JButton( new ImageIcon( icon_URL ) ); else help_faq_btn = new JButton( "FAQ" ); help_faq_btn.setToolTipText( "Open the FAQ window" ); // help_faq_btn.setBorder( empty_border ); help_faq_btn.setMargin( btn_insets ); help_faq_btn.addActionListener( new HelpFAQsButtonListener() ); toolbar.add( help_faq_btn ); /* help_about_btn is a hidden button */ icon_URL = null; icon_URL = getURL( about_icon_path ); if ( icon_URL != null ) help_about_btn = new JButton( new ImageIcon( icon_URL ) ); else help_about_btn = new JButton( "ABOUT" ); help_about_btn.setToolTipText( "Open the About-This window" ); // help_about_btn.setBorder( empty_border ); help_about_btn.setMargin( btn_insets ); help_about_btn.addActionListener( new HelpAboutButtonListener() ); /* file_close_btn is a hidden button */ icon_URL = null; icon_URL = getURL( close_icon_path ); if ( icon_URL != null ) file_close_btn = new JButton( new ImageIcon( icon_URL ) ); else file_close_btn = new JButton( "CLOSE" ); file_close_btn.setToolTipText( "Close the logfile" ); // file_close_btn.setBorder( empty_border ); file_close_btn.setMargin( btn_insets ); file_close_btn.addActionListener( new FileCloseButtonListener() ); manual_viewer = new HTMLviewer( "Manual", help_manual_btn ); faq_viewer = new HTMLviewer( "FAQs", help_faq_btn ); return toolbar; } public void init() { file_ops.init(); if ( logfile_name != null ) logname_fld.fireActionPerformed(); } private URL getURL( String filename ) { return getClass().getResource( filename ); } private void setMapPullDownMenu( List list ) { pulldown_list.removeAllItems(); String map_title; Iterator linemaps = list.iterator(); /* Crucial to add LineIDMapList's element in the order it is created */ while ( linemaps.hasNext() ) { map_title = " " + ( (LineIDMap) linemaps.next() ).getTitle(); pulldown_list.addItem( map_title ); } } public JButton getLogFileSelectButton() { return file_select_btn; } public JButton getLogFileConvertButton() { return file_convert_btn; } public JButton getLogFileCloseButton() { return file_close_btn; } public JButton getShowLegendButton() { return show_legend_btn; } public JButton getShowTimelineButton() { return show_timeline_btn; } public JButton getEditPreferenceButton() { return edit_prefer_btn; } public JButton getHelpManualButton() { return help_manual_btn; } public JButton getHelpFAQsButton() { return help_faq_btn; } public JButton getHelpAboutButton() { return help_about_btn; } private class FileSelectButtonListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { final String filename = file_ops.selectLogFile(); if ( filename != null && filename.length() > 0 ) { logname_fld.setText( filename ); // invoke LogNameTextFieldListener.actionPerformed() logname_fld.fireActionPerformed(); } } } private class FileConvertButtonListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { String filename, new_filename; new_filename = null; filename = logname_fld.getText(); if ( filename != null && filename.length() > 0 ) new_filename = file_ops.convertLogFile( filename ); else new_filename = file_ops.convertLogFile( null ); if ( new_filename != null && new_filename.length() > 0 ) { logname_fld.setText( new_filename ); // invoke LogNameTextFieldListener.actionPerformed() logname_fld.fireActionPerformed(); } } } private class LogNameTextFieldListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { // pulldown_list.removeAllItems(); // done by setMapPullDownMenu() file_ops.disposeLogFileAndResources(); List lineIDmaps = file_ops.openLogFile( logname_fld ); if ( lineIDmaps != null ) { FirstPanel.this.setMapPullDownMenu( lineIDmaps ); // Timeline window is created by ViewMapComboBoxListener // if ( lineIDmaps.size() == 1 ) // file_ops.createTimelineWindow( view_ID=0 ); } } } // This is essentially ShowTimelineButtonListener private class ViewMapComboBoxListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { // System.out.println( "pulldown_list: " + evt ); view_ID = pulldown_list.getSelectedIndex(); /* JComboBox.removeAllItems() seems to trigger a selected index=-1 action event. So filter only the relevant selection event. */ if ( view_ID >= 0 && view_ID < pulldown_list.getItemCount() ) { file_ops.createTimelineWindow( view_ID ); } } } private class ShowLegendButtonListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { file_ops.showLegendWindow(); } } private class EditPreferButtonListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { file_ops.showPreferenceWindow(); } } private class HelpManualButtonListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { URL manual_URL = getURL( manual_path ); if ( manual_URL != null ) { manual_viewer.init( manual_URL ); manual_viewer.setVisible( true ); } else Dialogs.warn( TopWindow.First.getWindow(), "Cannot locate " + manual_path + "." ); } } private class HelpFAQsButtonListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { URL faq_URL = getURL( faq_path ); if ( faq_URL != null ) { faq_viewer.init( faq_URL ); faq_viewer.setVisible( true ); } else Dialogs.warn( TopWindow.First.getWindow(), "Cannot locate " + faq_path + "." ); } } private class HelpAboutButtonListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { URL icon_URL = getURL( js_icon_path ); if ( icon_URL != null ) { ImageIcon js_icon = new ImageIcon( icon_URL ); Dialogs.info( TopWindow.First.getWindow(), about_str, js_icon ); } else Dialogs.info( TopWindow.First.getWindow(), about_str, null ); } } private class FileCloseButtonListener implements ActionListener { public void actionPerformed( ActionEvent evt ) { file_ops.disposeLogFileAndResources(); pulldown_list.removeAllItems(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -