• <bdo id='f3VAr'></bdo><ul id='f3VAr'></ul>
        <tfoot id='f3VAr'></tfoot>

        <small id='f3VAr'></small><noframes id='f3VAr'>

      1. <i id='f3VAr'><tr id='f3VAr'><dt id='f3VAr'><q id='f3VAr'><span id='f3VAr'><b id='f3VAr'><form id='f3VAr'><ins id='f3VAr'></ins><ul id='f3VAr'></ul><sub id='f3VAr'></sub></form><legend id='f3VAr'></legend><bdo id='f3VAr'><pre id='f3VAr'><center id='f3VAr'></center></pre></bdo></b><th id='f3VAr'></th></span></q></dt></tr></i><div id='f3VAr'><tfoot id='f3VAr'></tfoot><dl id='f3VAr'><fieldset id='f3VAr'></fieldset></dl></div>

        <legend id='f3VAr'><style id='f3VAr'><dir id='f3VAr'><q id='f3VAr'></q></dir></style></legend>

        如何制作“打开方式"对话框?

        How to make the #39;open with#39; dialog box?(如何制作“打开方式对话框?)
          <bdo id='ic563'></bdo><ul id='ic563'></ul>
            1. <tfoot id='ic563'></tfoot>

              <small id='ic563'></small><noframes id='ic563'>

              <i id='ic563'><tr id='ic563'><dt id='ic563'><q id='ic563'><span id='ic563'><b id='ic563'><form id='ic563'><ins id='ic563'></ins><ul id='ic563'></ul><sub id='ic563'></sub></form><legend id='ic563'></legend><bdo id='ic563'><pre id='ic563'><center id='ic563'></center></pre></bdo></b><th id='ic563'></th></span></q></dt></tr></i><div id='ic563'><tfoot id='ic563'></tfoot><dl id='ic563'><fieldset id='ic563'></fieldset></dl></div>

                    <tbody id='ic563'></tbody>

                1. <legend id='ic563'><style id='ic563'><dir id='ic563'><q id='ic563'></q></dir></style></legend>
                2. 本文介绍了如何制作“打开方式"对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I made a program to search for .txt files.

                  If I click a file it means that the "open with" dialog box should appear, and that dialog box will contain a list of all installed programs.

                  I am using this code for searching through the files:

                    public File[] finder( String dirName)
                    {
                        // Create a file object on the directory.
                        File dir = new File(dirName);
                        // Return a list of all files in the directory.
                        return dir.listFiles(new FilenameFilter();
                    } 
                  
                    public boolean accept(File dir, String filename)
                    { 
                        return filename.endsWith(".txt");
                    } 
                  

                  What Java code can I use to make the "open with" dialog box appear?

                  解决方案

                  You should use FileChooser for this. Take a look here:

                  //Create a file chooser
                  final JFileChooser fc = new JFileChooser();
                  ...
                  //In response to a button click:
                  int returnVal = fc.showOpenDialog(aComponent);
                  
                  
                  public void actionPerformed(ActionEvent e) {
                      //Handle open button action.
                      if (e.getSource() == openButton) {
                          int returnVal = fc.showOpenDialog(FileChooserDemo.this);
                  
                          if (returnVal == JFileChooser.APPROVE_OPTION) {
                              File file = fc.getSelectedFile();
                              //This is where a real application would open the file.
                              log.append("Opening: " + file.getName() + "." + newline);
                          } else {
                              log.append("Open command cancelled by user." + newline);
                          }
                     } ...
                  }
                  

                  这篇关于如何制作“打开方式"对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                    <tbody id='kKLSa'></tbody>
                    <tfoot id='kKLSa'></tfoot>
                    <legend id='kKLSa'><style id='kKLSa'><dir id='kKLSa'><q id='kKLSa'></q></dir></style></legend>
                          <bdo id='kKLSa'></bdo><ul id='kKLSa'></ul>

                          <small id='kKLSa'></small><noframes id='kKLSa'>

                        • <i id='kKLSa'><tr id='kKLSa'><dt id='kKLSa'><q id='kKLSa'><span id='kKLSa'><b id='kKLSa'><form id='kKLSa'><ins id='kKLSa'></ins><ul id='kKLSa'></ul><sub id='kKLSa'></sub></form><legend id='kKLSa'></legend><bdo id='kKLSa'><pre id='kKLSa'><center id='kKLSa'></center></pre></bdo></b><th id='kKLSa'></th></span></q></dt></tr></i><div id='kKLSa'><tfoot id='kKLSa'></tfoot><dl id='kKLSa'><fieldset id='kKLSa'></fieldset></dl></div>