Java Code Examples for javax.swing.plaf.metal.MetalFileChooserUI

The following examples show how to use javax.swing.plaf.metal.MetalFileChooserUI. These examples are extracted from open source projects. 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 Project: dragonwell8_jdk   Source File: bug6342301.java    License: 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 Project: TencentKona-8   Source File: bug6342301.java    License: 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 Project: jdk8u60   Source File: bug6342301.java    License: 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 Project: openjdk-jdk8u   Source File: bug6342301.java    License: 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
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 Project: openjdk-jdk9   Source File: bug6342301.java    License: 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 Project: jdk8u-jdk   Source File: bug6342301.java    License: 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 Project: hottub   Source File: bug6342301.java    License: 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 Project: openjdk-8-source   Source File: bug6342301.java    License: 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 Project: material-ui-swing   Source File: MaterialFileChooserUI.java    License: 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 Project: openjdk-8   Source File: bug6342301.java    License: 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 Project: jdk8u_jdk   Source File: bug6342301.java    License: 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 Project: jdk8u-jdk   Source File: bug6342301.java    License: 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 Project: jdk8u-dev-jdk   Source File: bug6342301.java    License: 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 Project: jclic   Source File: FileChooserForFiles.java    License: 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 Project: darklaf   Source File: DarkFileChooserUIBridge.java    License: 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);
}