コード例 #1
0
ファイル: FirstStartName.java プロジェクト: aidGer/aidGer
 /** Creates new form FirstStartName */
 public FirstStartName() {
     initComponents();
     try {
         setNextAction((AbstractAction) ActionRegistry.getInstance().get(FirstStartNameFinishAction.class.getName()));
     } catch (ActionNotFoundException ex) {
         UI.displayError(ex.getMessage());
     }
     
     jLabel1.setUI(MultiLineLabelUI.labelUI);
 }
コード例 #2
0
ファイル: HelpAction.java プロジェクト: aidGer/aidGer
    /*
     * (non-Javadoc)
     * 
     * @see
     * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    @Override
    public void actionPerformed(ActionEvent e) {
        InputStream input = getClass().getResourceAsStream(
            "/de/aidger/res/pdf/Handbuch.pdf");
        try {
            File tempFile = File.createTempFile("manual", ".pdf");
            tempFile.deleteOnExit();

            FileOutputStream out = new FileOutputStream(tempFile);
            byte buffer[] = new byte[1024];
            int len;
            while ((len = input.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            }

            out.close();
            input.close();

            /*
             * Open the manual in the specified pdf viewer or try the default
             * one.
             */
            try {
                java.lang.Runtime.getRuntime().exec(
                    new String[] {
                            Runtime.getInstance().getOption("pdf-viewer"),
                            tempFile.getAbsolutePath() });
            } catch (IOException ex) {
                try {
                    Desktop.getDesktop().open(tempFile);
                } catch (IOException e1) {
                    UI.displayError(_("No pdf viewer could be found!"));
                }
            }
        } catch (IOException ex) {
            Logger.getLogger(HelpAction.class.getName()).log(Level.SEVERE,
                null, ex);
        }

    }