📄 statlinepanel.java
字号:
// Status of the BufForTimeAveBoxes status_panel = new StatBoxStatusPanel( buf4statboxes ); int panel_height = time_display_panel.getPreferredSize().height; status_panel.setMinimumSize( new Dimension( 85, panel_height ) ); status_panel.setMaximumSize( new Dimension( Short.MAX_VALUE, panel_height ) ); status_panel.setPreferredSize( new Dimension( 85, panel_height ) ); status_panel.setAlignmentX( Component.CENTER_ALIGNMENT ); /* "VIEW" title */ Insets canvas_panel_insets = stat_canvas_panel.getInsets(); summary_state_combobox = new SummaryStateComboBox(); summary_state_combobox.setMinimumSize( new Dimension( 0, canvas_panel_insets.top ) ); summary_state_combobox.setMaximumSize( new Dimension( Short.MAX_VALUE, canvas_panel_insets.top ) ); summary_state_combobox.setPreferredSize( new Dimension( 20, canvas_panel_insets.top ) ); summary_state_combobox.setAlignmentX( Component.CENTER_ALIGNMENT ); /* YaxisTree View */ y_scroller.setAlignmentX( Component.CENTER_ALIGNMENT ); /* when y_scrollbar is changed, update stat_canvas as well. */ y_scrollbar.addAdjustmentListener( stat_canvas_vport ); /* YaxisTree's Column Labels */ int left_bottom_height = ruler_panel_height + canvas_panel_insets.bottom; JTextArea y_colarea = new JTextArea(); // y_colarea.setFont( Const.FONT ); StringBuffer text_space = new StringBuffer( " " ); for ( int idx = 0; idx < y_colnames.length; idx++ ) { y_colarea.append( text_space.toString() + "@ " + y_colnames[ idx ] + "\n" ); text_space.append( " " ); } JScrollPane y_colpanel = new JScrollPane( y_colarea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS ); /* Since there is NOT a specific Top Level JPanel for y_colpanel, so we need to set its PreferredSize here. Since y_scroller(i.e. JScrollPane containing YaxisTree) is the space hungary component here. So it is CRUCIAL to set the height PreferredSize equal to that of MinimumSize and MaximumSize, hence y_colpanel will be fixed in height during resizing of the top level frame. */ y_colpanel.setMinimumSize( new Dimension( 0, left_bottom_height ) ); y_colpanel.setMaximumSize( new Dimension( Short.MAX_VALUE, left_bottom_height ) ); y_colpanel.setPreferredSize( new Dimension( 20, left_bottom_height ) ); left_panel.add( status_panel ); left_panel.add( summary_state_combobox ); left_panel.add( y_scroller ); left_panel.add( y_colpanel ); /* Setting up the RIGHT panel to store various time-related GUIs */ JPanel right_panel = new JPanel(); right_panel.setLayout( new BoxLayout( right_panel, BoxLayout.Y_AXIS ) ); row_adjs = new RowAdjustments( stat_canvas_vport, y_tree ); JPanel row_resize = row_adjs.getComboBoxPanel(); row_resize.setMinimumSize( new Dimension( 0, canvas_panel_insets.top ) ); row_resize.setMaximumSize( new Dimension( Short.MAX_VALUE, canvas_panel_insets.top ) ); row_resize.setPreferredSize( new Dimension( 20, canvas_panel_insets.top ) ); row_resize.setAlignmentX( Component.CENTER_ALIGNMENT ); JPanel row_txtfld = row_adjs.getTextFieldPanel(); row_txtfld.setAlignmentX( Component.CENTER_ALIGNMENT ); JPanel row_slider = row_adjs.getSliderPanel(); JScrollPane slider_scroller = new JScrollPane( row_slider, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS ); slider_scroller.setAlignmentX( Component.CENTER_ALIGNMENT ); JPanel row_misc = row_adjs.getMiscPanel(); row_misc.setAlignmentX( Component.CENTER_ALIGNMENT ); JPanel ruler_lmouse; ruler_lmouse = time_ruler_vport.createLeftMouseModePanel( BoxLayout.X_AXIS ); ruler_lmouse.setToolTipText( "Operation for left mouse button click on Time Ruler" ); ruler_lmouse.setAlignmentX( Component.LEFT_ALIGNMENT ); row_misc.add( ruler_lmouse ); JScrollPane row_colpanel = new JScrollPane( row_misc, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED ); /* Since there is NOT a specific Top Level JPanel for row_colpanel, so we need to set its PreferredSize here. Since slider_scroller(i.e. JScrollPane containing JSlider) is the space hungary component here. So it is CRUCIAL to set the height PreferredSize equal to that of MinimumSize and MaximumSize, hence slider_scroller will be fixed in height during resizing of the top level frame. */ row_colpanel.setMinimumSize( new Dimension( 0, left_bottom_height ) ); row_colpanel.setMaximumSize( new Dimension( Short.MAX_VALUE, left_bottom_height ) ); row_colpanel.setPreferredSize( new Dimension( 20, left_bottom_height ) ); right_panel.add( row_resize ); right_panel.add( row_txtfld ); right_panel.add( slider_scroller ); right_panel.add( row_colpanel ); /* Store the LEFT and CENTER panels in the JSplitPane */ JSplitPane left_splitter, right_splitter; left_splitter = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, false, left_panel, center_panel ); // left_splitter.setResizeWeight( 0.0d ); right_splitter = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT, false, left_splitter, right_panel ); right_splitter.setOneTouchExpandable( true ); err_msg = null; try { left_splitter.setOneTouchExpandable( true ); right_splitter.setResizeWeight( 1.0d ); } catch ( NoSuchMethodError err ) { err_msg = "Method JSplitPane.setResizeWeight() cannot be found.\n" + "This indicates you are running an older Java2 RunTime,\n" + "like the one in J2SDK 1.2.2 or older. If this is the case,\n" + "some features in Statline window may not work correctly,\n" + "For instance, automatic resize of the Statline canvas\n" + "during window resizing and auto-update of the canvas\n" + "after adjustment of the slider's knob may fail silently,\n" + "manuel refresh of the canvas will be needed."; } this.add( right_splitter, BorderLayout.CENTER ); /* The ToolBar for various user controls */ toolbar = new StatlineToolBar( root_window, stat_canvas_vport, y_scrollbar, y_tree, y_maps, time_scrollbar, time_model, row_adjs ); this.add( toolbar, BorderLayout.NORTH ); /* Initialize the YaxisTree properties as well its display size which indirectly determines the size of CanvasTime */ y_tree.init(); row_adjs.initYLabelTreeSize(); status_panel.addRedrawListener( toolbar.getPropertyRefreshButton() ); summary_state_combobox.addRedrawListener( toolbar.getPropertyRefreshButton() ); } public void init() { // Initialize toolbar after creation of YaxisTree view toolbar.init(); row_adjs.initSlidersAndTextFields(); /* status_panel & summary_state_combobox listen canvas redraw events, They cannot be initialized before RowAdjustment has been initialized, i.e. before rumber of timelines has been set in the JTextField. */ status_panel.init(); summary_state_combobox.init(); if ( err_msg != null ) Dialogs.error( root_window, err_msg ); if ( Debug.isActive() ) { Debug.println( "StatlinePanel.init(): time_model = " + time_model ); Debug.println( "StatlinePanel.init(): time_scrollbar = " + time_scrollbar ); Debug.println( "StatlinePanel.init(): time_ruler = " + time_ruler ); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -