本文整理了Java中javax.swing.JFileChooser.getComponent()
方法的一些代码示例,展示了JFileChooser.getComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFileChooser.getComponent()
方法的具体详情如下:
包路径:javax.swing.JFileChooser
类名称:JFileChooser
方法名:getComponent
暂无
代码示例来源:origin: locationtech/jts
/**
* Workaround for Swing bug: JFileChooser does not support multi-file selection
* See Sun bug database 4218431.
* http://manning.spindoczine.com/sbe/files/uts2/Chapter14html/Chapter14.htm)
*/
public static File[] getSelectedFiles(JFileChooser chooser) {
// Although JFileChooser won't give us this information,
// we need it...
Container c1 = (Container) chooser.getComponent(3);
JList list = null;
while (c1 != null) {
Container c = (Container) c1.getComponent(0);
if (c instanceof JList) {
list = (JList) c;
break;
}
c1 = c;
}
Object[] entries = list.getSelectedValues();
File[] files = new File[entries.length];
for (int k = 0; k < entries.length; k++) {
if (entries[k] instanceof File)
files[k] = (File) entries[k];
}
return files;
}
代码示例来源:origin: stackoverflow.com
JTextField tf = (JTextField) ((JPanel) ((JPanel) chooser.getComponent(3)).getComponent(0)).getComponent(1);
内容来源于网络,如有侵权,请联系作者删除!