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

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

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

JFileChooser.getApproveButtonText介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

private void doLoadFiles() {
 if (chooser == null) {
  chooser = createFileChooser();
 }
 String approveText = chooser.getApproveButtonText();
 chooser.setApproveButtonText("Load with file filters");
 int status = chooser.showOpenDialog(this);
 chooser.setApproveButtonText(approveText);
 if (status == JFileChooser.APPROVE_OPTION) {
  //now set up the file filters if there are directories
  File[] selectedFiles = chooser.getSelectedFiles();
  boolean haveDirectory = false;
  for (File f : selectedFiles) {
   if (f.isDirectory()) {
    haveDirectory = true;
    break;
   }
  }
  if (haveDirectory) {
   doFileFilters(selectedFiles);
  } else {
   startFileLoadingThread(new EnumMap<>(FilterType.class), selectedFiles);
  }
 }
}

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

public void process(JFileChooser fileChooser) {
  AssertAdapter.assertEquals("Unexpected apply button text -",
                text, fileChooser.getApproveButtonText());
 }
});

代码示例来源:origin: com.l2fprod.common/l2fprod-common-directorychooser

private void updateView(JFileChooser chooser) {
 if (chooser.getApproveButtonText() != null) {
  approveButton.setText(chooser.getApproveButtonText());
  approveButton.setMnemonic(chooser.getApproveButtonMnemonic());
 } else {
  if (JFileChooser.OPEN_DIALOG == chooser.getDialogType()) {
   approveButton.setText(openButtonText);
   approveButton.setToolTipText(openButtonToolTipText);
   approveButton.setMnemonic(openButtonMnemonic);
  } else {
   approveButton.setText(saveButtonText);
   approveButton.setToolTipText(saveButtonToolTipText);
   approveButton.setMnemonic(saveButtonMnemonic);
  }
 }
 cancelButton.setText(cancelButtonText);
 cancelButton.setMnemonic(cancelButtonMnemonic);
 newFolderButton.setText(newFolderText);
 newFolderButton.setToolTipText(newFolderToolTipText);
 newFolderButton.setVisible(((JDirectoryChooser)chooser).isShowingCreateDirectory());
 buttonPanel.setVisible(chooser.getControlButtonsAreShown());
 // ensure approve/cancel buttons have the same width
 approveButton.setPreferredSize(null);
 cancelButton.setPreferredSize(null);
 Dimension preferredSize = approveButton.getMinimumSize();
 preferredSize = new Dimension(Math.max(preferredSize.width, cancelButton
  .getPreferredSize().width), preferredSize.height);
 approveButton.setPreferredSize(preferredSize);
 cancelButton.setPreferredSize(preferredSize);    
}

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInEDT
static @Nullable String approveButtonTextFrom(final @Nonnull JFileChooser fileChooser) {
 return execute(() -> {
  String text = fileChooser.getApproveButtonText();
  if (!Strings.isNullOrEmpty(text)) {
   return text;
  }
  return fileChooser.getUI().getApproveButtonText(fileChooser);
 });
}

代码示例来源:origin: com.jidesoft/jide-oss

private void updateView(JFileChooser chooser) {
  if (chooser.getApproveButtonText() != null) {
    _approveButton.setText(chooser.getApproveButtonText());
    _approveButton.setMnemonic(chooser.getApproveButtonMnemonic());

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

private void doLoadFiles() {
 if (chooser == null) {
  chooser = createFileChooser();
 }
 String approveText = chooser.getApproveButtonText();
 chooser.setApproveButtonText("Load with file filters");
 int status = chooser.showOpenDialog(this);
 chooser.setApproveButtonText(approveText);
 if (status == JFileChooser.APPROVE_OPTION) {
  //now set up the file filters if there are directories
  File[] selectedFiles = chooser.getSelectedFiles();
  boolean haveDirectory = false;
  for (File f : selectedFiles) {
   if (f.isDirectory()) {
    haveDirectory = true;
    break;
   }
  }
  if (haveDirectory) {
   doFileFilters(selectedFiles);
  } else {
   startFileLoadingThread(new EnumMap<>(FilterType.class), selectedFiles);
  }
 }
}

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

if (btn.getText() != null && (btn.getText().equals(fileChooser.getApproveButtonText()) || btn.getText().equals("Cancel"))) {
  container.remove(child);

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

/** Press the approve button.  Fails if the button is disabled.
 */
public void actionApprove(Component c) {
  // Could invoke chooser.approveSelection, but that doesn't actually
  // fire the approve button.
  JFileChooser chooser = (JFileChooser)c;
  String text = chooser.getApproveButtonText();
  if (text == null) {
    text = chooser.getUI().getApproveButtonText(chooser);
  }
  JButton approve = findButton(chooser, text);
  if (approve == null) {
    String msg = Strings.get("tester.JFileChooser.approve_not_found");
    throw new ActionFailedException(msg);
  }
  if (!approve.isEnabled()) {
    String msg = Strings.get("tester.JFileChooser.approve_not_enabled");
    throw new ActionFailedException(msg);
  }
  actionClick(approve);
}

相关文章

JFileChooser类方法