本文整理了Java中javax.swing.JFileChooser.getIcon()
方法的一些代码示例,展示了JFileChooser.getIcon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFileChooser.getIcon()
方法的具体详情如下:
包路径:javax.swing.JFileChooser
类名称:JFileChooser
方法名:getIcon
暂无
代码示例来源:origin: omegat-org/omegat
/** Redefines the icon for OmegaT projects. */
public Icon getIcon(File f) {
if (StaticUtils.isProjectDir(f)) {
return OMEGAT_ICON;
} else {
return super.getIcon(f);
}
}
代码示例来源:origin: stackoverflow.com
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import java.io.*;
class BigIcon {
public static void main(String[] args) {
JFileChooser chooser = new JFileChooser();
File f = new File("BigIcon.java");
Icon icon = chooser.getIcon(f);
int scale = 4;
BufferedImage bi = new BufferedImage(
scale*icon.getIconWidth(),
scale*icon.getIconHeight(),
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = bi.createGraphics();
g.scale(scale,scale);
icon.paintIcon(null,g,0,0);
g.dispose();
JOptionPane.showMessageDialog(
null,
new JLabel(new ImageIcon(bi)));
}
}
代码示例来源:origin: bcdev/beam
@Override
public Icon getIcon(File f) {
final Icon icon = super.getIcon(f);
if (f.isDirectory() && isCompoundDocument(f)) {
return new CompoundDocumentIcon(icon);
}
return icon;
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public Icon getIcon(File f) {
Icon icon = null;
if (f != null) {
icon = super.getIcon(f);
if (f.isDirectory() && isCompoundDocument(f)) {
return new CompoundDocumentIcon(icon);
}
}
return icon;
}
代码示例来源:origin: igniterealtime/Spark
/**
* Returns the native icon, if one exists for the filetype, otherwise
* returns a default document icon.
*
* @param file
* the file to check icon type.
* @return the native icon, otherwise default document icon.
*/
public static Icon getIcon(File file) {
try {
return new JFileChooser().getIcon(file);
} catch (Exception e) {
Log.debug("unable to get icon");
}
return SparkRes.getImageIcon(SparkRes.DOCUMENT_INFO_32x32);
}
代码示例来源:origin: org.gephi/directory-chooser
@Override
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) {
Component c = super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
DirectoryNode node = (DirectoryNode)value;
editorPanel.setOpaque(false);
editorPanel.add(new JLabel(fileChooser.getIcon(node.getFile())), BorderLayout.CENTER);
editorPanel.add(c, BorderLayout.EAST);
textField = (JTextField)getComponent();
String text = fileChooser.getName(node.getFile());
textField.setText(text);
textField.setColumns(text.length());
return editorPanel;
}
代码示例来源:origin: stackoverflow.com
file.deleteOnExit();
i = chooser.getIcon(file);
extIcons.put(extension, i);
代码示例来源:origin: org.gephi/directory-chooser
private Icon getNodeIcon(DirectoryNode node) {
File file = node.getFile();
if(file.exists()) {
//TODO icon changer code started
if (customDirectoryProvider != null && customDirectoryProvider.isValidCustomDirectory(file)) {
return customDirectoryProvider.getCustomDirectoryIcon();
}
//TODO icon changer code ended
return fileChooser.getIcon(file);
} else {
return null;
}
}
代码示例来源:origin: mucommander/mucommander
return fileChooser.getIcon(javaIoFile);
代码示例来源:origin: org.gephi/directory-chooser
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected,
boolean cellHasFocus) {
// #89393: GTK needs name to render cell renderer "natively"
setName("ComboBox.listRenderer"); // NOI18N
if (value == null) {
setText("");
return this;
}
File directory = (File)value;
setText(getFileChooser().getName(directory));
Icon icon = getFileChooser().getIcon(directory);
indenter.icon = icon;
indenter.depth = directoryComboBoxModel.getDepth(index);
setIcon(indenter);
if ( isSelected ) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
return this;
}
内容来源于网络,如有侵权,请联系作者删除!