Java 类javax.swing.plaf.basic.BasicFileChooserUI 实例源码

项目:OpenJSharp    文件:FileChooserDemo.java   
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();
    }
}
项目:jdk8u-jdk    文件:FileChooserDemo.java   
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();
    }
}
项目:openjdk-jdk10    文件:FileChooserDemo.java   
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();
    }
}
项目:openjdk9    文件:FileChooserDemo.java   
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();
    }
}
项目:jdk8u_jdk    文件:FileChooserDemo.java   
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();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:FileChooserDemo.java   
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();
    }
}
项目:infobip-open-jdk-8    文件:FileChooserDemo.java   
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();
    }
}
项目:jdk8u-dev-jdk    文件:FileChooserDemo.java   
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();
    }
}
项目:jdk7-jdk    文件:FileChooserDemo.java   
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();
    }
}
项目:openjdk-source-code-learn    文件:FileChooserDemo.java   
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();
    }
}
项目:OLD-OpenJDK8    文件:FileChooserDemo.java   
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();
    }
}
项目:openjdk-jdk7u-jdk    文件:FileChooserDemo.java   
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();
    }
}
项目:openjdk-icedtea7    文件:FileChooserDemo.java   
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();
    }
}
项目:Moenagade    文件:OpenProject.java   
private void cleanField()
{
    FileChooserUI myUi = getUI();
    if (myUi instanceof BasicFileChooserUI) {
        BasicFileChooserUI mui = (BasicFileChooserUI) myUi;
        mui.setFileName("");
    }
}
项目:JavaGraph    文件:GrooveFileChooser.java   
@Override
public void setSelectedFile(File file) {
    super.setSelectedFile(file);
    FileChooserUI ui = getUI();
    if (file != null && ui instanceof BasicFileChooserUI) {
        ((BasicFileChooserUI) ui).setFileName(file.getName());
    }
}
项目:cn1    文件:JFileChooserTest.java   
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());
}
项目:ZScriptLanguageSupport    文件:FileChooser.java   
@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);
    }
}
项目:freeVM    文件:JFileChooserTest.java   
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());
}
项目:freeVM    文件:JFileChooserTest.java   
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());
}
项目:spring16project-Team-Laredo    文件:ProjectExportDialog.java   
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);
}