📄 framedisplay.java
字号:
private void setupDlgs() { // printDlg = new PrintDlg (this); optionsDlg = new CanOptions (this); def_btns = new RecDefButtons( this, init_win.dimPG, IsRunningStateOff ); def_btns.setFloatable( true ); def_btns.setOrientation( SwingConstants.HORIZONTAL ); getContentPane().add( def_btns, BorderLayout.SOUTH ); // def_btns.setOrientation( SwingConstants.VERTICAL ); // getContentPane().add( def_btns, BorderLayout.EAST ); } /** * printPrefs is the property set that stores the default settings for * printing. */ private void setupPrintPrefs() { printPrefs = new Properties (); printPrefs.put("awt.print.fileName", "jumpshot.ps"); printPrefs.put("awt.print.numCopies", "1"); printPrefs.put("awt.print.paperSize", "letter"); printPrefs.put("awt.print.destination", "file"); printPrefs.put("awt.print.orientation", "landscape"); } // End of Setup methods ----------------------------------------------------- // Event Handler methods ---------------------------------------------------- /** * Handles events when scrollbar is modified */ public void adjustmentValueChanged (AdjustmentEvent e) { setPosition (hbar.getValue ()); } void setPosition (int x) { canvas.adjustImgH (x); vport.setViewPosition (new Point (canvas.getPanePosX (), 0)); debug.println( "FrameDisplay.setPosition(" + x + " ) : " + "vport.setViewPosition(" + canvas.getPanePosX() + ", 0)" ); } //Handler the event when one of the buttons is pressed public void actionPerformed( ActionEvent evt ) { String command = evt.getActionCommand(); if ( setupComplete ) { if ( command.equals( "In" ) ) zoomInH(); else if ( command.equals( "Out" ) ) zoomOutH(); else if ( command.equals("Reset") ) resetView(); else if ( command.equals("Options") ) { optionsDlg.reset(); optionsDlg.show(); optionsDlg.toFront(); } else if ( command.equals ("Print") ) Print(); else if ( command.equals ("Close") ) kill(); } } //End of event Handler methods-------------------------------------------- /** * draw states on to canvas */ private void drawData( double starttime, double endtime ) { canvas.init( this, starttime, endtime ); vcanvas1.setupComplete(); vcanvas2.setupComplete(); procDlg = new StateGroupDialog( canvas, frameFont ); } //Zoom methods------------------------------------------------------------ /** * zoom in horizontally using the current zoom factor along zoomlock if any. */ private void zoomInH() { waitCursor (); canvas.zoomInH (); zoomH (); normalCursor (); } /** * zoom out horizontally using the current zoom factor along zoomlock if any. */ private void zoomOutH() { waitCursor (); canvas.zoomOutH (); zoomH (); normalCursor (); } /** * Reset view so that the entire data occupies one screen */ private void resetView() { waitCursor (); canvas.resetView (); zoomH (); normalCursor (); } /** * Method called whenever a horizontal zoom takes place */ void zoomH() { setHoriz (); hbar.setValue (canvas.sbPos); vport.setViewPosition (new Point (canvas.getPanePosX (), 0)); debug.println( "FrameDisplay.zoomH() : " ); debug.println( "\t" + "hbar.setValue(" + canvas.sbPos + ")" ); debug.println( "\t" + "vport.setViewPosition(" + canvas.getPanePosX() + ", 0)" ); } /** * Reset scrollbar values when horizontal extent of data changes (e.g during zoom) * BUG: Id 4138681 - ScrollBar doesn't update visible amount when not at top (or left) of bar * http://developer.java.sun.com/developer/bugParade/bugs/4138681.html * They say that it is fixed in JDK1.2beta4 but, since we are not yet using JDK1.2beta4 or later * we will use the simple workaround */ void setHoriz() { hbar.setMaximum (canvas.maxH); hbar.setMinimum (0); //Work around for the Bug Id: 4149649 /**/ /**/int x = hbar.getValue (); hbar.setValue (0); hbar.setVisibleAmount ((int)Math.rint (canvas._xPix / 3.0)); /**/hbar.setValue (x); hbar.setUnitIncrement (10); hbar.setBlockIncrement ((int)Math.rint (canvas._xPix / 3.0)); } //-------------------------------------------------------------------------- /** * modify cursor value in the time field */ void adjustTimeField (double d) { timeField.setText ((new Float (d)).toString ()); } /** * Modify elapsed time field value */ void adjustElTimeField(double d) { elTimeField.setText ((new Float (d)).toString ()); } /** * Prints out jumpshot data */ private void Print() { waitCursor (); if (checkPrintAllowed ()) { String jobTitle = "Jumpshot:" + init_win.logFileName; //Obtain a PrintJob Object. This posts a Print dialog //printprefs stores user printing prefrences PrintJob pjob = getToolkit ().getPrintJob (this, jobTitle, printPrefs); //If the user clicked Cancel in the print dialog, then do nothing if (pjob != null) { PrintDlg p = getPrintDlg (); p.reset (pjob, this); } } normalCursor (); } boolean checkPrintAllowed() { try { SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkPrintJobAccess(); } catch (SecurityException e) { new ErrorDialog( null, "Sorry. Printing is not allowed." ); return false; } return true; } PrintDlg getPrintDlg() {return new PrintDlg (this);} /** * sets the current cursor to WAIT_CURSOR type */ void waitCursor() {setCursor (new Cursor (Cursor.WAIT_CURSOR));} /** * sets the WAIT_CURSOR to cursor associated with this frame */ void normalCursor() {setCursor (new Cursor (Cursor.DEFAULT_CURSOR));} /** * destructor */ void kill() { init_win.waitCursor(); setVisible( false ); if ( def_btns != null ) { def_btns.kill(); def_btns = null; } if ( canvas != null ) { canvas.kill (); canvas = null; } vcanvas1 = null; vcanvas2 = null; if ( optionsDlg != null) { optionsDlg.dispose(); optionsDlg = null; } if ( procDlg != null) { procDlg.dispose(); procDlg = null; } // if (printDlg != null) {printDlg.dispose (); printDlg = null;} mtns = null; stateDefs = null; all_states = null; arrowDefs = null; all_arrows = null; removeAll(); dispose(); init_win.normalCursor (); try { frame_chooser.EnableFrameButtonsIdxFld(); } catch ( NullPointerException err ) {} } protected void finalize() throws Throwable {super.finalize();} void makeUIChanges () { SwingUtilities.updateComponentTreeUI(this); optionsDlg.makeUIChanges (); procDlg.makeUIChanges (); // SwingUtilities.updateComponentTreeUI(printDlg); SwingUtilities.updateComponentTreeUI (def_btns); rulerColor = getBackground (); canvas.Resize (); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -