本文整理了Java中javax.swing.JFileChooser.getUI()
方法的一些代码示例,展示了JFileChooser.getUI()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFileChooser.getUI()
方法的具体详情如下:
包路径:javax.swing.JFileChooser
类名称:JFileChooser
方法名:getUI
暂无
代码示例来源:origin: org.netbeans.api/org-openide-util
title = chooser.getUI().getDialogTitle(chooser);
代码示例来源:origin: org.netbeans.api/org-openide-util-ui
title = chooser.getUI().getDialogTitle(chooser);
代码示例来源:origin: stackoverflow.com
final JFileChooser fc = new JFileChooser();
//return fc.getFileView().getIcon(f); // will throw a null pointer
Icon result = fc.getUI().getFileView(fc).getIcon(f);
代码示例来源:origin: stackoverflow.com
final JFileChooser fileChooser = new JFileChooser();
fileChooser.addPropertyChangeListener(JFileChooser.FILE_FILTER_CHANGED_PROPERTY, new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent e) {
String currentName = ((BasicFileChooserUI)fileChooser.getUI()).getFileName();
MyFileFilter filter = (MyFileFilter) e.getNewValue();
// ... Transform currentName as you see fit using the newly selected filter.
// Suppose the result is in newName ...
fileChooser.setSelectedFile(new File(newName));
}
});
代码示例来源:origin: org.cytoscape/network-analyzer-impl
/**
* Removes the selection from a file chooser in single selection mode.
*
* @param aDialog
* File selection dialog to be modified.
*/
public static void removeSelectedFile(JFileChooser aDialog) {
File file = aDialog.getSelectedFile();
if (file != null) {
aDialog.setSelectedFile(null);
try {
((javax.swing.plaf.basic.BasicFileChooserUI) aDialog.getUI()).setFileName(null);
} catch (Exception ex) {
// Could not remove file name from the text field, ignore
}
}
}
代码示例来源:origin: stackoverflow.com
File file = opener.getSelectedFile();
if (file != null){
BasicFileChooserUI ui = (BasicFileChooserUI) opener.getUI();
ui.setFileName(file.getName());
opener.setSelectedFile(file);
BasicFileChooserUI ui = (BasicFileChooserUI) opener.getUI();
ui.setFileName(file.getName());
代码示例来源:origin: stackoverflow.com
javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
Icon icon = fc.getUI().getFileView(fc).getIcon(file);
代码示例来源:origin: stackoverflow.com
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
public class FileChooserAction
{
public static void createAndShowUI()
{
JFileChooser chooser = new JFileChooser();
BasicFileChooserUI ui = (BasicFileChooserUI)chooser.getUI();
Action folder = ui.getNewFolderAction();
folder.setEnabled(false);
chooser.showSaveDialog(null);
}
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
createAndShowUI();
}
});
}
}
代码示例来源:origin: atarw/material-ui-swing
@Override
public void installUI (JComponent c) {
super.installUI (c);
JFileChooser fileChooser = (JFileChooser) c;
MaterialFileChooserUI ui = (MaterialFileChooserUI) fileChooser.getUI ();
ui.uninstallIcons (fileChooser);
ui.uninstallComponents (fileChooser);
ui.clearIconCache ();
ui.computerIcon = new ImageIcon (MaterialImages.COMPUTER);
ui.directoryIcon = new ImageIcon (MaterialImages.FOLDER);
ui.fileIcon = new ImageIcon (MaterialImages.FILE);
ui.floppyDriveIcon = new ImageIcon (MaterialImages.FLOPPY_DRIVE);
ui.hardDriveIcon = new ImageIcon (MaterialImages.HARD_DRIVE);
ui.homeFolderIcon = new ImageIcon (MaterialImages.HOME);
ui.listViewIcon = new ImageIcon (MaterialImages.LIST);
ui.detailsViewIcon = new ImageIcon (MaterialImages.DETAILS);
ui.newFolderIcon = new ImageIcon (MaterialImages.NEW_FOLDER);
ui.upFolderIcon = new ImageIcon (MaterialImages.BACK_ARROW);
ui.openButtonText = "OPEN";
ui.cancelButtonText = "CANCEL";
ui.helpButtonText = "HELP";
ui.saveButtonText = "SAVE";
ui.directoryOpenButtonText = "OPEN";
ui.updateButtonText = "UPDATE";
ui.installComponents (fileChooser);
}
代码示例来源: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: orbisgis/orbisgis
@Override
public File getSelectedFile() {
File ret;
JFileChooser fc = getFileChooser();
FileChooserUI ui = fc.getUI();
if (ui instanceof BasicFileChooserUI) {
BasicFileChooserUI basicUI = (BasicFileChooserUI) ui;
String fileName = basicUI.getFileName();
if ((fileName == null) || (fileName.length() == 0)) {
ret = null;
} else {
ret = autoComplete(new File(fileName));
}
} else {
ret = autoComplete(super.getSelectedFile());
}
if ((ret != null) && !ret.isAbsolute()) {
ret = new File(fc.getCurrentDirectory(), ret.getName());
}
return ret;
}
代码示例来源:origin: orbisgis/orbisgis
FileChooserUI ui = fileChooser.getUI();
if (ui instanceof BasicFileChooserUI) {
BasicFileChooserUI basicUI = (BasicFileChooserUI) ui;
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
if (filePanel.getUI() instanceof WindowsFileChooserUI) {
tweakWindowsFileChooserUI(filePanel, (WindowsFileChooserUI)filePanel.getUI());
} catch (Throwable t) {
代码示例来源:origin: com.bitplan.dragtop/com.bitplan.dragtop
/**
* get the Swing Icon from the file system
* @param file
* @return the icon
*/
private static javax.swing.Icon getJSwingIconFromFileSystem(File file) {
javax.swing.Icon icon = null;
switch (OsCheck.getOperatingSystemType()) {
case MacOS:
final javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
icon = fc.getUI().getFileView(fc).getIcon(file);
break;
default:
// case Windows:
FileSystemView view = FileSystemView.getFileSystemView();
icon = view.getSystemIcon(file);
break;
}
return icon;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-propertyeditors
if (filePanel.getUI() instanceof WindowsFileChooserUI) {
tweakWindowsFileChooserUI(filePanel, (WindowsFileChooserUI)filePanel.getUI());
} catch (Throwable t) {
代码示例来源:origin: uk.gov.nationalarchives.thirdparty.netbeans/org-openide-util
title = chooser.getUI().getDialogTitle(chooser);
代码示例来源:origin: in.jlibs/org-openide-util
title = chooser.getUI().getDialogTitle(chooser);
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
title = chooser.getUI().getDialogTitle(chooser);
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
title = chooser.getUI().getDialogTitle(chooser);
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!