javax.swing.JFileChooser.setPreferredSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中javax.swing.JFileChooser.setPreferredSize()方法的一些代码示例,展示了JFileChooser.setPreferredSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFileChooser.setPreferredSize()方法的具体详情如下:
包路径:javax.swing.JFileChooser
类名称:JFileChooser
方法名:setPreferredSize

JFileChooser.setPreferredSize介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public class MyFrame extends JFrame(){
 JFileChooser chooser = new JFileChooser();
 chooser.setPreferredSize(new Dimension(800,600));
 //Here show your dialog and do the rest
}

代码示例来源:origin: stackoverflow.com

JButton button = new JButton("Choose a file!");
button.addActionListener(new ActionListener()
{ 
 public void actionPerformed(ActionEvent e)
 { 
   JFileChooser fileChooser = new JFileChooser();
   fileChooser.setDialogTitle( "Choose a file" );
   fileChooser.setVisible( true );
   fileChooser.setPreferredSize( new Dimension(100, 100) );
 } 
});

代码示例来源:origin: com.mgmtp.jfunk/jfunk-core

@Override
  public void run() {
    JFileChooser fileChooser = new JFileChooser(System.getProperty(JFunkConstants.USER_DIR));
    fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    fileChooser.setMultiSelectionEnabled(true);
    fileChooser.setPreferredSize(new Dimension(800, 450));
    int i = fileChooser.showOpenDialog(null);
    if (i == JFileChooser.APPROVE_OPTION) {
      File[] files = fileChooser.getSelectedFiles();
      scripts.addAll(Arrays.asList(files));
    }
  }
});

代码示例来源:origin: com.mgmtp.jfunk/jfunk-core

/**
 * Opens a file chooser dialog which can then be used to choose a file or directory and assign
 * the path of the chosen object to a variable. The name of the variable must be passed as a
 * parameter.
 * 
 * @param fileKey
 *            the key the selected file path is stored under in the configuration
 * @return the chosen file
 */
@Cmd
public File chooseFile(final String fileKey) {
  log.debug("Opening file chooser dialog");
  JFileChooser fileChooser = new JFileChooser(System.getProperty(JFunkConstants.USER_DIR));
  fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
  fileChooser.setPreferredSize(new Dimension(600, 326));
  int fileChooserResult = fileChooser.showOpenDialog(null);
  if (fileChooserResult == JFileChooser.APPROVE_OPTION) {
    File file = fileChooser.getSelectedFile();
    String filename = file.toString();
    log.info("Assigning file path '{}' to property '{}'", filename, fileKey);
    config.put(fileKey, filename);
    return file;
  }
  log.error("No file or directory was chosen, execution will abort");
  throw new IllegalArgumentException("No file or directory was chosen");
}

代码示例来源:origin: stackoverflow.com

fc.setPreferredSize(new Dimension(800,600));
fc.setDialogTitle(title);
setFileChooserFont(fc.getComponents());

代码示例来源:origin: AliView/AliView

fc.setPreferredSize(new Dimension(preferedWidth, preferedHeight));

代码示例来源:origin: AliView/AliView

fc.setPreferredSize(new Dimension(preferedWidth, preferedHeight));

代码示例来源:origin: org.jclarion/clarion-runtime

chooser.setPreferredSize(new Dimension((r.width - r.x) * 2 / 3,
    (r.height - r.y) * 2 / 3));

代码示例来源:origin: stackoverflow.com

chooser.setPreferredSize(new Dimension(450, 400));
chooserStatus = chooser.showSaveDialog(this);
if (chooserStatus == JFileChooser.APPROVE_OPTION)

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

projectChooser.setPreferredSize(new Dimension(400, 300));
projectChooser.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
jarFileChooser = new JFileChooser(lastJARDirectoryUsed);
jarFileChooser.setFileView(new JARFileView());
jarFileChooser.setPreferredSize(new Dimension(400, 300));
jarFileChooser.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

代码示例来源:origin: dcaoyuan/nbscala

AntArtifactChooser accessory = new AntArtifactChooser( artifactTypes, chooser );
chooser.setAccessory( accessory );
chooser.setPreferredSize( new Dimension( 650, 380 ) );        
File defaultFolder = null;
FileObject defFo = master.getProjectDirectory();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

MakeArtifactChooser accessory = new MakeArtifactChooser( artifactType, chooser, baseDir );
chooser.setAccessory( accessory );
chooser.setPreferredSize( new Dimension( 650, 380 ) );

相关文章

JFileChooser类方法