src/share/demo/jfc/FileChooserDemo/FileChooserDemo.java

Print this page




 783                     y = 0;
 784                 }
 785 
 786                 if (x < 5) {
 787                     x = 5;
 788                 }
 789                 thumbnail.paintIcon(this, g, x, y);
 790             }
 791         }
 792     }
 793 
 794     public static void main(String s[]) {
 795         try {
 796             SwingUtilities.invokeAndWait(new Runnable() {
 797 
 798                 public void run() {
 799                     /*
 800                      * NOTE: By default, the look and feel will be set to the
 801                      * Cross Platform Look and Feel (which is currently Metal).
 802                      * The following code tries to set the Look and Feel to Nimbus.
 803                      * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html
 804                      */
 805                     try {
 806                         for (LookAndFeelInfo info : UIManager.
 807                                 getInstalledLookAndFeels()) {
 808                             if (NIMBUS_LAF_NAME.equals(info.getName())) {
 809                                 UIManager.setLookAndFeel(info.getClassName());
 810                                 break;
 811                             }
 812                         }
 813                     } catch (Exception ignored) {
 814                     }
 815 
 816                     FileChooserDemo panel = new FileChooserDemo();
 817 
 818                     frame = new JFrame("FileChooserDemo");
 819                     frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 820                     frame.getContentPane().add("Center", panel);
 821                     frame.pack();
 822                     frame.setVisible(true);
 823                 }




 783                     y = 0;
 784                 }
 785 
 786                 if (x < 5) {
 787                     x = 5;
 788                 }
 789                 thumbnail.paintIcon(this, g, x, y);
 790             }
 791         }
 792     }
 793 
 794     public static void main(String s[]) {
 795         try {
 796             SwingUtilities.invokeAndWait(new Runnable() {
 797 
 798                 public void run() {
 799                     /*
 800                      * NOTE: By default, the look and feel will be set to the
 801                      * Cross Platform Look and Feel (which is currently Metal).
 802                      * The following code tries to set the Look and Feel to Nimbus.
 803                      * http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html
 804                      */
 805                     try {
 806                         for (LookAndFeelInfo info : UIManager.
 807                                 getInstalledLookAndFeels()) {
 808                             if (NIMBUS_LAF_NAME.equals(info.getName())) {
 809                                 UIManager.setLookAndFeel(info.getClassName());
 810                                 break;
 811                             }
 812                         }
 813                     } catch (Exception ignored) {
 814                     }
 815 
 816                     FileChooserDemo panel = new FileChooserDemo();
 817 
 818                     frame = new JFrame("FileChooserDemo");
 819                     frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
 820                     frame.getContentPane().add("Center", panel);
 821                     frame.pack();
 822                     frame.setVisible(true);
 823                 }