package com.gavin.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.ComponentOrientation;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.HeadlessException;
import java.awt.Insets;
import java.awt.LayoutManager;
import java.awt.Polygon;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseListener;
import java.awt.geom.AffineTransform;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Locale;
import java.util.Vector;
import javax.accessibility.AccessibleContext;
import javax.swing.AbstractAction;
import javax.swing.AbstractListModel;
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.JTextField;
import javax.swing.JToggleButton;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileSystemView;
import javax.swing.filechooser.FileView;
import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.FileChooserUI;
import javax.swing.plaf.basic.BasicDirectoryModel;
import javax.swing.plaf.basic.BasicFileChooserUI;
import sun.awt.shell.ShellFolder;
import sun.swing.FilePane;
import sun.swing.SwingUtilities2;
@SuppressWarnings({ "serial" })
public class CustomFileChooser extends JFileChooser {
public static void main(String[] args) {
UIManager.put("ScrollBarUI", "com.sun.java.swing.plaf.windows.WindowsScrollBarUI");// 设置滚动条样式为window风格的滚动条样式
// 设置文件夹在swing中所显示的图标
UIManager.put("FileView.directoryIcon", FileSystemView.getFileSystemView().getSystemIcon(new File(System.getProperty("user.dir"))));
// 如果觉得默认的图标太丑可以自己设置文件选择对话框的一系列图标
// UIManager.put("FileChooser.newFolderIcon", newFolderIcon);
// UIManager.put("FileChooser.upFolderIcon", upFolderIcon);
// UIManager.put("FileChooser.homeFolderIcon", homeFolderIcon);
// UIManager.put("FileChooser.detailsViewIcon", detailsViewIcon);
// UIManager.put("FileChooser.listViewIcon", listViewIcon);
// 设置工具提示的默认样式
Color toolTipColor = new Color(80, 80, 80);
UIManager.put("ToolTip.border",
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(toolTipColor), BorderFactory.createEmptyBorder(2, 3, 2, 3)));
UIManager.put("ToolTip.background", Color.WHITE);
UIManager.put("ToolTip.foreground", toolTipColor);
CustomFileChooser chooser = new CustomFileChooser();
chooser.showOpenDialog(null);
}
public CustomFileChooser() {
super();
}
public CustomFileChooser(File currentDirectory, FileSystemView fsv) {
super(currentDirectory, fsv);
}
public CustomFileChooser(File currentDirectory) {
super(currentDirectory);
}
public CustomFileChooser(FileSystemView fsv) {
super(fsv);
}
public CustomFileChooser(String currentDirectoryPath, FileSystemView fsv) {
super(currentDirectoryPath, fsv);
}
public CustomFileChooser(String currentDirectoryPath) {
super(currentDirectoryPath);
}
{
setUI(new CustomFileChooserUI(this));
}
@Override
protected JDialog createDialog(Component parent) throws HeadlessException {
FileChooserUI ui = getUI();
String title = ui.getDialogTitle(this);
putClientProperty(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY, title);
Window window = getWindowForComponent(parent);
JDialog dialog = new JDialog(window, title);
dialog.setModal(true);
dialog.setComponentOrientation(this.getComponentOrientation());
if (JDialog.isDefaultLookAndFeelDecorated()) {
boolean supportsWindowDecorations = UIManager.getLookAndFeel().getSupportsWindowDecorations();
if (supportsWindowDecorations) {
dialog.getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG);
}
}
dialog.getRootPane().setDefaultButton(ui.getDefaultButton(this));
dialog.getContentPane().add(this);
dialog.pack();
setLocationRelativeTo(parent, dialog);
return dialog;
}
/**
* 自定义文件选择器UI,代码主要来源于MetalFileChooserUI
*
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static class CustomFileChooserUI extends BasicFileChooserUI {
private static Font labelFont14 = new Font(Font.DIALOG, Font.PLAIN, 14);
private static Font labelFont12 = new Font(Font.DIALOG, Font.PLAIN, 12);
private static Color boxBorderColor = Color.GRAY;
private static Color boxForegroundColor = new Color(51, 51, 51);
// private static int boxHeight = 25;
// private static int buttonWidth=30;
// private static int buttonHeight=30;
// Much of the Metal UI for JFilechooser is just a copy of
// the windows implementation, but using Metal themed buttons, lists,
// icons, etc. We are planning a complete rewrite, and hence we've
// made most things in this class private.
private BasicFileView fileView = new CustomFileView();
private JLabel lookInLabel;
private CustomComboBox directoryComboBox;
private DirectoryComboBoxModel directoryComboBoxModel;
private Action directoryComboBoxAction = new DirectoryComboBoxAction();
private FilterComboBoxModel filterComboBoxModel;
private JTextField fileNameTextField;
private FilePane filePane;
private JToggleButton listViewButton;
private JToggleButton detailsViewButton;
private JButton approveButton;
private JButton cancelButton;
private JPanel buttonPanel;
private JPanel bottomPanel;
private CustomComboBox filterComboBox;
private static final Dimension hstrut5 = new Dimension(5, 1);
// private static final Dimension hstrut11 = new Dimension(11, 1);
private static final Dimension vstrut5 = new Dimension(1, 5);
private static final Insets shrinkwrap = new Insets(0, 0, 0, 0);
// Preferred and Minimum sizes for the dialog box
private static int PREF_WIDTH = 500;
private static int PREF_HEIGHT = 326;
private static Dimension PREF_SIZE = new Dimension(PREF_WIDTH, PREF_HEIGHT);
private static int MIN_WIDTH = 500;
private static int MIN_HEIGHT = 326;
private static Dimension MIN_SIZE = new Dimension(MIN_WIDTH, MIN_HEIGHT);
private static int LIST_PREF_WIDTH = 405;
private static int LIST_PREF_HEIGHT = 135;
private static Dimension LIST_PREF_SIZE = new Dimension(LIST_PREF_WIDTH, LIST_PREF_HEIGHT);
// Labels, mnemonics, and tooltips (oh my!)
private int lookInLabelMnemonic = 0;
private String lookInLabelText = null;
private String saveInLabelText = null;
private int fileNameLabelMnemonic = 0;
private String fileNameLabelText = null;
private i
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
JAVACamera.zip (80个子文件)
JAVACamera
lib
javacpp.jar 157KB
commons-net-3.3.jar 274KB
javacv.jar 1.1MB
javacv-windows-x86_64.jar 1.73MB
opencv-2.4.8-windows-x86_64.jar 11.47MB
.classpath 585B
hs_err_pid20400.log 21KB
.settings
org.eclipse.jdt.core.prefs 598B
org.eclipse.core.resources.prefs 137B
src
setting.properties 73B
img
timg.png 2KB
com
gavin
gui
LactPECamera.java 9KB
Thread2Demo.java 4KB
ThreadDemo.java 3KB
RolloverBackgroundButton.java 7KB
CustomComboBox.java 10KB
HeadPECamera.java 10KB
CustomFileChooser.java 51KB
MainThread.java 872B
util
PropertiesUtil.java 2KB
CameraUtil.java 1KB
FTPUtil.java 6KB
bin
setting.properties 73B
javacpp.jar 157KB
img
timg.png 2KB
commons-net-3.3.jar 274KB
javacv.jar 1.1MB
javacv-windows-x86_64.jar 1.73MB
opencv-2.4.8-windows-x86_64.jar 11.47MB
com
gavin
gui
CustomFileChooser$CustomFileChooserUI.class 27KB
CustomFileChooser$CustomFileChooserUI$5.class 3KB
CustomFileChooser.class 5KB
RolloverBackgroundButton.class 6KB
LactPECamera$7.class 880B
CustomFileChooser$ArrowIcon.class 3KB
CustomFileChooser$CustomFileChooserUI$2.class 2KB
CustomFileChooser$CustomFileChooserUI$FileRenderer.class 706B
CustomFileChooser$CustomFileChooserUI$FilterComboBoxRenderer.class 1KB
LactPECamera$5.class 2KB
CustomFileChooser$CustomFileChooserUI$3.class 982B
CustomFileChooser$CustomFileChooserUI$AlignedLabel.class 2KB
HeadPECamera$4.class 2KB
CustomFileChooser$CustomFileChooserUI$SingleClickListener.class 781B
CustomFileChooser$CustomFileChooserUI$DirectoryComboBoxAction.class 1KB
LactPECamera$2.class 945B
CustomComboBox$CustomList.class 2KB
CustomFileChooser$CustomFileChooserUI$DirectoryComboBoxModel.class 5KB
HeadPECamera$5.class 2KB
CustomFileChooser$CustomFileChooserUI$FilterComboBoxModel.class 3KB
MainThread.class 2KB
LactPECamera$1.class 1000B
CustomFileChooser$CustomFileChooserUI$DirectoryComboBoxRenderer.class 2KB
CustomFileChooser$CustomFileChooserUI$4.class 1KB
CustomComboBox.class 6KB
HeadPECamera$3.class 2KB
HeadPECamera$6.class 1KB
CustomFileChooser$CustomFileChooserUI$CustomFileView.class 1KB
CustomFileChooser$CustomFileChooserUI$CustomFileChooserUIAccessor.class 3KB
HeadPECamera$7.class 880B
CustomFileChooser$MoveIcon.class 1KB
HeadPECamera$2.class 945B
CustomComboBox$CustomComboBoxRenderer.class 2KB
CustomFileChooser$CustomFileChooserUI$IndentIcon.class 1KB
CustomFileChooser$CustomFileChooserUI$ButtonAreaLayout.class 3KB
CustomFileChooser$CustomFileChooserUI$1.class 966B
CustomComboBox$CustomComboBoxUI.class 4KB
LactPECamera$4.class 2KB
HeadPECamera$1.class 1000B
Thread2Demo.class 4KB
LactPECamera$6.class 1KB
CustomFileChooser$CustomFileChooserUI$DirectoryComboBoxModel$1.class 1KB
LactPECamera.class 6KB
ThreadDemo.class 4KB
HeadPECamera.class 6KB
LactPECamera$3.class 2KB
util
CameraUtil.class 2KB
PropertiesUtil.class 2KB
FTPUtil.class 7KB
hs_err_pid21188.log 21KB
.project 384B
共 80 条
- 1
资源评论
Java璐到底
- 粉丝: 2398
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 嵌入式基础学习资料0000
- content_1714465331721.xls
- HM3401-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- Chainbase+Web3+APi+Data warehouse
- HM3401D-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- GEE案例-1990-2023年计算某个区域的NDVI时序变化轨迹(以徐州市为例)含全部代码.pdf
- HM3401C-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- 沈丘盛世龙门图纸符合规范化
- 基于51单片机带LCD1602显示+温度补偿的超声波测距仪设计软硬设计+仿真+文档资料.zip
- 一、K210是什么? K210全称为堪智K210,是嘉楠科技自主研发的一款采用RISC-V处理器架构,具备视听一体、自主IP内核
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功