javax.swing.plaf.metal.MetalFileChooserUI Java Examples

The following examples show how to use javax.swing.plaf.metal.MetalFileChooserUI. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: bug6342301.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #2
Source File: bug6342301.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #3
Source File: bug6342301.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #4
Source File: bug6342301.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #5
Source File: bug6342301.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #6
Source File: bug6342301.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #7
Source File: bug6342301.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #8
Source File: bug6342301.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #9
Source File: bug6342301.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #10
Source File: MaterialFileChooserUI.java    From material-ui-swing with MIT License 6 votes vote down vote up
@Override
protected FilterComboBoxRenderer createFilterComboBoxRenderer() {
	return new MetalFileChooserUI.FilterComboBoxRenderer(){
		@Override
		public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
			super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

			setBorder((UIManager.getBorder("ComboBox.borderItems")));
			if (isSelected) {
				setForeground(UIManager.getColor("ComboBox[item].selectionForeground"));
			} else {
				setForeground(UIManager.getColor("ComboBox.foreground"));
			}
			setBackground(isSelected || cellHasFocus ?
					UIManager.getColor("ComboBox.selectedInDropDownBackground") :
					UIManager.getColor("ComboBox.background"));

			return this;
		}
	};
}
 
Example #11
Source File: bug6342301.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #12
Source File: bug6342301.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #13
Source File: bug6342301.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #14
Source File: bug6342301.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    tempDir = System.getProperty("java.io.tmpdir");

    if (tempDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
        tempDir = System.getProperty("user.home");
    }

    System.out.println("Temp directory: " + tempDir);

    UIManager.setLookAndFeel(new MetalLookAndFeel());

    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            HackedFileChooser openChooser = new HackedFileChooser();

            openChooser.setUI(new MetalFileChooserUI(openChooser));
            openChooser.setCurrentDirectory(new File(tempDir));
        }
    });
}
 
Example #15
Source File: FileChooserForFiles.java    From jclic with GNU General Public License v2.0 6 votes vote down vote up
/** JDKBUG: get current selected filename. */
private String getCurrentFileName() {
  final FileChooserUI fchui = getUI();
  String fileName;
  if (fchui instanceof MetalFileChooserUI) {
    fileName = ((MetalFileChooserUI) fchui).getFileName();
  } else if (WindowsFileChooserUIClass != null && WindowsFileChooserUIClass.isInstance(fchui)
      && getFileNameMethod != null) {
    try {
      fileName = (String) getFileNameMethod.invoke(fchui, (Object[]) null);
    } catch (Exception ex) {
      fileName = null;
    }
  } else {
    fileName = null;
  }
  return fileName == null || fileName.trim().length() == 0 ? null : fileName;
}
 
Example #16
Source File: DarkFileChooserUIBridge.java    From darklaf with MIT License 2 votes vote down vote up
/**
 * Constructs a new instance of {@code MetalFileChooserUI}.
 *
 * @param  c a component
 * @return   a new instance of {@code MetalFileChooserUI}
 */
public static ComponentUI createUI(final JComponent c) {
    return new MetalFileChooserUI((JFileChooser) c);
}