⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convertorpanel.java

📁 fortran并行计算包
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                                                  BoxLayout.Y_AXIS ) );            lower_panel.add( Box.createVerticalStrut( 4 ) );                JPanel  cmd_path2jvm_panel = new JPanel();                cmd_path2jvm_panel.setAlignmentX(                                   Component.CENTER_ALIGNMENT );                cmd_path2jvm_panel.setLayout(                                   new BoxLayout( cmd_path2jvm_panel,                                                  BoxLayout.X_AXIS ) );                    label = new JLabel( " JVM Path : " );                    label.setToolTipText(                          "Full Pathname of the Java Virtual Machine." );                    Routines.setShortJComponentSizes( label, lbl_pref_sz );                cmd_path2jvm_panel.add( label );                    cmd_path2jvm = new JTextField();                    // Routines.setShortJComponentSizes( cmd_path2jvm,                    //                                   fld_pref_sz );                cmd_path2jvm_panel.add( cmd_path2jvm );                Routines.setShortJComponentSizes( cmd_path2jvm_panel,                                                  row_pref_sz );            lower_panel.add( cmd_path2jvm_panel );            lower_panel.add( Box.createVerticalGlue() );            lower_panel.add( Box.createVerticalStrut( 4 ) );                JPanel  cmd_option4jvm_panel = new JPanel();                cmd_option4jvm_panel.setAlignmentX(                                     Component.CENTER_ALIGNMENT );                cmd_option4jvm_panel.setLayout(                                     new BoxLayout( cmd_option4jvm_panel,                                                    BoxLayout.X_AXIS ) );                        label = new JLabel( " JVM Option : " );                    label.setToolTipText(                          "Option to the Java Virtual Machine." );                    Routines.setShortJComponentSizes( label, lbl_pref_sz );                cmd_option4jvm_panel.add( label );                    cmd_option4jvm = new JTextField();                    // Routines.setShortJComponentSizes( cmd_option4jvm,                    //                                   fld_pref_sz );                cmd_option4jvm_panel.add( cmd_option4jvm );                Routines.setShortJComponentSizes( cmd_option4jvm_panel,                                                  row_pref_sz );                lower_panel.add( cmd_option4jvm_panel );            lower_panel.add( Box.createVerticalGlue() );            lower_panel.add( Box.createVerticalStrut( 4 ) );                    JPanel  cmd_path2jardir_panel = new JPanel();                cmd_path2jardir_panel.setAlignmentX(                                      Component.CENTER_ALIGNMENT );                cmd_path2jardir_panel.setLayout(                                      new BoxLayout( cmd_path2jardir_panel,                                                     BoxLayout.X_AXIS ) );                        label = new JLabel( " JAR Directory : " );                    label.setToolTipText( "Directory of the .jar files." );                    Routines.setShortJComponentSizes( label, lbl_pref_sz );                cmd_path2jardir_panel.add( label );                    cmd_path2jardir = new ActableTextField();                    // Routines.setShortJComponentSizes( cmd_path2jardir,                    //                                   fld_pref_sz );                cmd_path2jardir_panel.add( cmd_path2jardir );                Routines.setShortJComponentSizes( cmd_path2jardir_panel,                                                  row_pref_sz );                lower_panel.add( cmd_path2jardir_panel );            lower_panel.add( Box.createVerticalGlue() );            lower_panel.add( Box.createVerticalStrut( 4 ) );                JPanel  cmd_option4jar_panel = new JPanel();                cmd_option4jar_panel.setAlignmentX(                                     Component.CENTER_ALIGNMENT );                cmd_option4jar_panel.setLayout(                                     new BoxLayout( cmd_option4jar_panel,                                                    BoxLayout.X_AXIS ) );                    label = new JLabel( " JAR Option : " );                    label.setToolTipText( "Option to the selected Convertor." );                    Routines.setShortJComponentSizes( label, lbl_pref_sz );                cmd_option4jar_panel.add( label );                    cmd_option4jar = new JTextField();                    // Routines.setShortJComponentSizes( cmd_option4jar,                    //                                   fld_pref_sz );                cmd_option4jar_panel.add( cmd_option4jar );                Routines.setShortJComponentSizes( cmd_option4jar_panel,                                                  row_pref_sz );            lower_panel.add( cmd_option4jar_panel );            lower_panel.add( Box.createVerticalGlue() );            lower_panel.add( Box.createVerticalStrut( 4 ) );                    JPanel  cmd_path2tracelib_panel = new JPanel();                cmd_path2tracelib_panel.setAlignmentX(                                        Component.CENTER_ALIGNMENT );                cmd_path2tracelib_panel.setLayout(                                        new BoxLayout( cmd_path2tracelib_panel,                                                       BoxLayout.X_AXIS ) );                        label = new JLabel( " TraceLibrary Path : " );                    label.setToolTipText(                        "Trace Input Library path of the selected Convertor" );                    Routines.setShortJComponentSizes( label, lbl_pref_sz );                cmd_path2tracelib_panel.add( label );                    cmd_path2tracelib = new JTextField();                    // Routines.setShortJComponentSizes( cmd_path2tracelib,                    //                                   fld_pref_sz );                cmd_path2tracelib_panel.add( cmd_path2tracelib );                Routines.setShortJComponentSizes( cmd_path2tracelib_panel,                                                  row_pref_sz );            lower_panel.add( cmd_path2tracelib_panel );            lower_panel.add( Box.createVerticalStrut( 4 ) );            cmd_splitter = new JSplitPane( JSplitPane.VERTICAL_SPLIT, true,                                           upper_panel, lower_panel );            cmd_splitter.setAlignmentX( Component.CENTER_ALIGNMENT );            cmd_splitter.setOneTouchExpandable( true );            err_msg = null;            try {                cmd_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 Convertor window may not work correctly,\n"                + "For instance, resize of the window may not resize upper \n"                + "TextArea.  Manuel movement of splitter is needed.\n";            }       super.add( cmd_splitter );       super.add( Box.createVerticalStrut( 4 ) );            JPanel  cmd_button_panel = new JPanel();            cmd_button_panel.setLayout( new BoxLayout( cmd_button_panel,                                                       BoxLayout.X_AXIS ) );            cmd_button_panel.setAlignmentX( Component.CENTER_ALIGNMENT );            cmd_button_panel.add( Box.createHorizontalGlue() );                btn_insets          = new Insets( 2, 4, 2, 4 );                cmd_start_btn = new JButton( "Convert" );                icon_URL = getURL( Const.IMG_PATH + "Convert24.gif" );                if ( icon_URL != null ) {                    cmd_start_btn.setIcon( new ImageIcon( icon_URL ) );                    cmd_start_btn.setVerticalTextPosition(                                  AbstractButton.CENTER );                    cmd_start_btn.setHorizontalTextPosition(                                  AbstractButton.RIGHT );                    cmd_start_btn.setMargin( btn_insets );                }                cmd_start_btn.setToolTipText(                    "Proceed with the selected logfile conversion." );            cmd_button_panel.add( cmd_start_btn );            cmd_button_panel.add( Box.createHorizontalGlue() );                cmd_stop_btn = new JButton( " Stop " );                icon_URL = getURL( Const.IMG_PATH + "Stop24.gif" );                if ( icon_URL != null ) {                    cmd_stop_btn.setIcon( new ImageIcon( icon_URL ) );                    cmd_stop_btn.setVerticalTextPosition(                                 AbstractButton.CENTER );                    cmd_stop_btn.setHorizontalTextPosition(                                 AbstractButton.RIGHT );                    // cmd_stop_btn.setMargin( btn_insets );                }                cmd_stop_btn.setToolTipText(                    "Stop the ongoing logfile conversion." );            cmd_button_panel.add( cmd_stop_btn );            cmd_button_panel.add( Box.createHorizontalGlue() );                cmd_help_btn = new JButton( " Usage " );                icon_URL = getURL( Const.IMG_PATH + "About24.gif" );                if ( icon_URL != null ) {                    cmd_help_btn.setIcon( new ImageIcon( icon_URL ) );                    cmd_help_btn.setVerticalTextPosition(                                 AbstractButton.CENTER );                    cmd_help_btn.setHorizontalTextPosition(                                 AbstractButton.RIGHT );                    // cmd_help_btn.setMargin( btn_insets );                }                cmd_help_btn.setToolTipText(                    "Usage information of the selected logfile convertor." );            cmd_button_panel.add( cmd_help_btn );            cmd_button_panel.add( Box.createHorizontalGlue() );                cmd_close4cancel_btn = new JButton( "Cancel" );                icon_URL = getURL( Const.IMG_PATH + "ConvertCancel24.gif" );                if ( icon_URL != null ) {                    cmd_close4cancel_btn.setIcon( new ImageIcon( icon_URL ) );                    cmd_close4cancel_btn.setVerticalTextPosition(                                         AbstractButton.CENTER );                    cmd_close4cancel_btn.setHorizontalTextPosition(                                         AbstractButton.RIGHT );                    // cmd_close4cancel_btn.setMargin( btn_insets );                }                cmd_close4cancel_btn.setToolTipText( "Close this panel." );            cmd_button_panel.add( cmd_close4cancel_btn );            cmd_button_panel.add( Box.createHorizontalGlue() );            cmd_close4ok_btn = null;            if ( has_close4ok_btn ) {                cmd_close4ok_btn = new JButton( "OK" );                icon_URL = getURL( Const.IMG_PATH + "ConvertOk24.gif" );                if ( icon_URL != null ) {                    cmd_close4ok_btn.setIcon( new ImageIcon( icon_URL ) );                    cmd_close4ok_btn.setVerticalTextPosition(                                     AbstractButton.CENTER );                    cmd_close4ok_btn.setHorizontalTextPosition(                                     AbstractButton.RIGHT );                    // cmd_close4ok_btn.setMargin( btn_insets );                }                cmd_close4ok_btn.setToolTipText(                     "Display the last converted SLOG2 logfile "                  + "and Exit this dialog box." );                cmd_button_panel.add( cmd_close4ok_btn );                cmd_button_panel.add( Box.createHorizontalGlue() );            }        super.add( cmd_button_panel );    }    private void initAllTextFields()    {        String           path2jardir;        String           option4jvm;        ConvertorConst.initializeSystemProperties();        // set the path to JVM         cmd_path2jvm.setText( ConvertorConst.getDefaultPathToJVM() );        // set the path to all the jar files        path2jardir  = ConvertorConst.getDefaultPathToJarDir();        cmd_path2jardir.setText( path2jardir );        // set the JVM option        option4jvm  = null;        try {            option4jvm  = cmd_option4jvm.getText();        } catch ( NullPointerException err ) {}        if ( option4jvm == null || option4jvm.length() <= 0 );            cmd_option4jvm.setText( "-Xms32m -Xmx64m" );    }    public String selectLogFile()    {        int   istat;        istat = file_chooser.showOpenDialog( top_window );        if ( istat == LogFileChooser.APPROVE_OPTION ) {            File   selected_file, selected_dir;            selected_file = file_chooser.getSelectedFile();            if ( selected_file != null ) {                selected_dir  = selected_file.getParentFile();                if ( selected_dir != null )                    file_chooser.setCurrentDirectory( selected_dir );                return selected_file.getPath();            }        }        else            Dialogs.info( top_window, "No file chosen", null );        return null;    }    private void printSelectedConvertorHelp()    {        String              convertor;        String              path2jardir;        String              path2tracelib;        String              jar_path;        RuntimeExecCommand  exec_cmd;        File                jar_file;        Runtime             runtime;        Process             proc;        InputStreamThread   proc_err_task, proc_out_task;        convertor = (String) cmd_pulldown.getSelectedItem();        //  Set the path to the jar file        path2jardir = cmd_path2jardir.getText();        jar_path  = ConvertorConst.getDefaultJarPath( path2jardir, convertor );        jar_file  = new File( jar_path );        if ( ! jar_file.exists() ) {            Dialogs.error( top_window, jar_path + " does not exist!" );            return;        }        if ( ! jar_file.canRead() ) {            Dialogs.error( top_window, jar_path + " is NOT readable!\n" );            return;        }        exec_cmd = new RuntimeExecCommand();        exec_cmd.addWholeString( cmd_path2jvm.getText() );        exec_cmd.addTokenizedString( cmd_option4jvm.getText() );        path2tracelib = cmd_path2tracelib.getText();        if ( path2tracelib != null && path2tracelib.length() > 0 )            exec_cmd.addWholeString( "-Djava.library.path=" + path2tracelib );        exec_cmd.addWholeString( "-jar" );        exec_cmd.addWholeString( jar_path );        exec_cmd.addWholeString( "-h" );        cmd_textarea.append( "Executing " + exec_cmd.toString() + "...." );                runtime  = Runtime.getRuntime();        try {            proc = runtime.exec( exec_cmd.toStringArray() );            proc_err_task = new InputStreamThread( proc.getErrorStream(),                                                   "Error", cmd_textarea );            proc_out_task = new InputStreamThread( proc.getInputStream(),                                                   "Output", cmd_textarea );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -