本文整理汇总了Java中javax.swing.plaf.basic.BasicFileChooserUI类的典型用法代码示例。如果您正苦于以下问题:Java BasicFileChooserUI类的具体用法?Java BasicFileChooserUI怎么用?Java BasicFileChooserUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BasicFileChooserUI类属于javax.swing.plaf.basic包,在下文中一共展示了BasicFileChooserUI类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.swing.plaf.basic.BasicFileChooserUI; //导入依赖的package包/类
public void actionPerformed(ActionEvent evt) {
Object src = evt.getSource();
String cmd = evt.getActionCommand();
if (src == backButton) {
back();
} else if (src == nextButton) {
FileChooserUI ui = chooser.getUI();
if (ui instanceof BasicFileChooserUI) {
// Workaround for bug 4528663. This is necessary to
// pick up the contents of the file chooser text field.
// This will trigger an APPROVE_SELECTION action.
((BasicFileChooserUI) ui).getApproveSelectionAction().
actionPerformed(null);
} else {
next();
}
} else if (src == closeButton) {
close();
} else if (APPROVE_SELECTION.equals(cmd)) {
next();
} else if (CANCEL_SELECTION.equals(cmd)) {
close();
}
}
示例2: cleanField
import javax.swing.plaf.basic.BasicFileChooserUI; //导入依赖的package包/类
private void cleanField()
{
FileChooserUI myUi = getUI();
if (myUi instanceof BasicFileChooserUI) {
BasicFileChooserUI mui = (BasicFileChooserUI) myUi;
mui.setFileName("");
}
}
示例3: setSelectedFile
import javax.swing.plaf.basic.BasicFileChooserUI; //导入依赖的package包/类
@Override
public void setSelectedFile(File file) {
super.setSelectedFile(file);
FileChooserUI ui = getUI();
if (file != null && ui instanceof BasicFileChooserUI) {
((BasicFileChooserUI) ui).setFileName(file.getName());
}
}
示例4: testGetUpdateUI
import javax.swing.plaf.basic.BasicFileChooserUI; //导入依赖的package包/类
public void testGetUpdateUI() throws Exception {
FileChooserUI ui = chooser.getUI();
assertNotNull(ui);
FileChooserUI customUI = new BasicFileChooserUI(chooser);
chooser.setUI(customUI);
assertEquals(customUI, chooser.getUI());
assertNotSame(ui, chooser.getUI());
chooser.updateUI();
assertNotSame(customUI, chooser.getUI());
}
示例5: setCurrentDirectory
import javax.swing.plaf.basic.BasicFileChooserUI; //导入依赖的package包/类
@Override
public void setCurrentDirectory(File dir) {
super.setCurrentDirectory(dir);
// WindowsFileChooserUI unfortunately doesn't clear file name field!
FileChooserUI ui = getUI();
if (ui instanceof BasicFileChooserUI) {
((BasicFileChooserUI)ui).setFileName(null);
}
}
示例6: jbInit
import javax.swing.plaf.basic.BasicFileChooserUI; //导入依赖的package包/类
private void jbInit() {
this.setResizable(false);
Border border1 = BorderFactory.createEmptyBorder(10, 10, 0, 10);
Border border2 = BorderFactory.createEmptyBorder(5, 10, 5, 5);
fileChooser.setBorder(null);
fileChooser.setControlButtonsAreShown(false);
jPanel2.setLayout(borderLayout3);
okB.setMaximumSize(new Dimension(100, 26));
okB.setPreferredSize(new Dimension(100, 26));
okB.setText(Local.getString("Save"));
okB.addActionListener(e -> {
okB_actionPerformed();
if (fileChooser.getUI() instanceof BasicFileChooserUI) //Added to fix problem with export note
//jcscoobyrs 17-Nov-2003 at 08:36:14 AM
{//Added to fix problem with export note jcscoobyrs 17-Nov-2003 at 08:36:14 AM
BasicFileChooserUI ui = (BasicFileChooserUI) fileChooser.getUI();//Added to fix problem with export note
//jcscoobyrs 17-Nov-2003 at 08:36:14 AM
ui.getApproveSelectionAction().actionPerformed(e);//Added to fix problem with export note
//jcscoobyrs 17-Nov-2003 at 08:36:14 AM
}//Added to fix problem with export note jcscoobyrs 17-Nov-2003 at 08:36:14 AM
});
this.getRootPane().setDefaultButton(okB);
cancelB.setMaximumSize(new Dimension(100, 26));
cancelB.setPreferredSize(new Dimension(100, 26));
cancelB.setText(Local.getString("Cancel"));
cancelB.addActionListener(e -> cancelB_actionPerformed());
jPanel3.setLayout(flowLayout1);
flowLayout1.setAlignment(FlowLayout.RIGHT);
borderLayout3.setHgap(5);
borderLayout3.setVgap(5);
jPanel2.setBorder(border1);
jPanel3.setBorder(border2);
jPanel1.setLayout(borderLayout2);
jLabel1.setMaximumSize(new Dimension(155, 16));
jLabel1.setPreferredSize(new Dimension(80, 16));
jLabel1.setText(Local.getString("Encoding") + ":");
jPanel4.setLayout(gridLayout1);
splitChB.setText(Local.getString("Split notes into separate files"));
gridLayout1.setColumns(1);
gridLayout1.setRows(3);
titlesAsHeadersChB.setText(Local.getString("Notes titles as headers"));
this.getContentPane().add(jPanel2, BorderLayout.CENTER);
jPanel2.add(jPanel4, BorderLayout.SOUTH);
jPanel4.add(jPanel1, null);
jPanel1.add(encCB, BorderLayout.CENTER);
jPanel1.add(jLabel1, BorderLayout.WEST);
jPanel4.add(splitChB, null);
jPanel2.add(fileChooser, BorderLayout.NORTH);
this.getContentPane().add(jPanel3, BorderLayout.SOUTH);
jPanel3.add(okB, null);
jPanel3.add(cancelB, null);
jPanel4.add(titlesAsHeadersChB, null);
}