Java界面UI设计.docx_第1页
Java界面UI设计.docx_第2页
Java界面UI设计.docx_第3页
Java界面UI设计.docx_第4页
Java界面UI设计.docx_第5页
已阅读5页,还剩22页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

package UI;import LITE.ProgramLITE;import java.awt.BorderLayout;import java.awt.Dimension;import java.awt.Image;import java.awt.Toolkit;import java.awt.event.InputEvent;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.io.File;import java.io.IOException;import java.util.ArrayList;import java.util.logging.Level;import java.util.logging.Logger;import javax.imageio.ImageIO;import javax.swing.ImageIcon;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JTree;import javax.swing.event.TreeSelectionEvent;import javax.swing.filechooser.FileSystemView;import javax.swing.tree.DefaultMutableTreeNode;import javax.swing.tree.DefaultTreeModel;import javax.swing.tree.TreePath;public class Main extends javax.swing.JFrame private final ImageFileFilter filter_i = new ImageFileFilter(); /图片选择要求 private double ImagesSize = 0; /图片大小 private File currentDir; /当前目录 private TreeSelectionEvent Evt; private final ArrayList historyPaths = new ArrayList(); /浏览记录 private final ArrayList imgList = new ArrayList();/图片文件 private final ArrayList aFileName = new ArrayList(); /图片名 private final ArrayList thread = new ArrayList(); private ArrayList imgIDs = null;/选中的图片的编号 private int lastID = -1; /上一个选中的图片 private int previousID = -1;/上上一个选中的图片 private int CopyOrCut = 0; / 1表示复制,2表示剪切,3表示删除,4表示重命名 private ArrayList cocImages = null;/要复制、剪切、删除或重命名的图片 private int shiftID = -1; private boolean shiftFlag = false;/是否按下shift键 /* * Creates new form Main */ public Main() initComponents(); /* * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ SuppressWarnings(unchecked) / /GEN-BEGIN:initComponents private void initComponents() PopupMenu = new javax.swing.JPopupMenu(); cutMenuItem = new javax.swing.JMenuItem(); copyMenuItem = new javax.swing.JMenuItem(); deleteMenuItem = new javax.swing.JMenuItem(); renameMenuItem = new javax.swing.JMenuItem(); OutPopupMenu = new javax.swing.JPopupMenu(); OutPasteKey = new javax.swing.JMenuItem(); ToolPanel = new javax.swing.JPanel(); ToolBar = new javax.swing.JToolBar(); jButton1 = new javax.swing.JButton(); jSeparator1 = new javax.swing.JToolBar.Separator(); jButton2 = new javax.swing.JButton(); jToolBar1 = new javax.swing.JToolBar(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); MainPanel = new javax.swing.JPanel(); TISplitPane = new javax.swing.JSplitPane(); TPSplitPane = new javax.swing.JSplitPane(); ScrollPane = new javax.swing.JScrollPane(); Tree = new javax.swing.JTree(); previewPanel = new javax.swing.JPanel(); Panel = new javax.swing.JPanel(); historyBox = new javax.swing.JComboBox(); ImagesScroll = new javax.swing.JScrollPane(); ImagesPanel = new javax.swing.JPanel(); historyToolBar = new javax.swing.JToolBar(); historyButton = new javax.swing.JButton(); TextPanel = new javax.swing.JPanel(); currentPath = new javax.swing.JTextField(); Selected = new javax.swing.JTextField(); Pictures = new javax.swing.JTextField(); Folders = new javax.swing.JTextField(); ImageName = new javax.swing.JTextField(); MenuBar = new javax.swing.JMenuBar(); Files = new javax.swing.JMenu(); Open = new javax.swing.JMenuItem(); SaveAs = new javax.swing.JMenuItem(); Esc = new javax.swing.JMenuItem(); Edit = new javax.swing.JMenu(); Copy = new javax.swing.JMenuItem(); Paste = new javax.swing.JMenuItem(); View = new javax.swing.JMenu(); Show = new javax.swing.JMenuItem(); Tools = new javax.swing.JMenu(); Renames = new javax.swing.JMenuItem(); RenameAllTool = new javax.swing.JMenuItem(); Setting = new javax.swing.JMenu(); Skin = new javax.swing.JMenuItem(); Help = new javax.swing.JMenu(); Tutorial = new javax.swing.JMenuItem(); About = new javax.swing.JMenuItem(); PopupMenu.setBackground(new java.awt.Color(153, 153, 153); cutMenuItem.setText(剪切); cutMenuItem.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); cutMenuItem.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cutMenuItem.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) cutMenuItemActionPerformed(evt); ); PopupMenu.add(cutMenuItem); copyMenuItem.setText(复制); copyMenuItem.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); copyMenuItem.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); copyMenuItem.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) copyMenuItemActionPerformed(evt); ); PopupMenu.add(copyMenuItem); deleteMenuItem.setText(删除); deleteMenuItem.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); deleteMenuItem.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); deleteMenuItem.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) deleteMenuItemActionPerformed(evt); ); PopupMenu.add(deleteMenuItem); renameMenuItem.setText(重命名); renameMenuItem.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); renameMenuItem.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); renameMenuItem.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) renameMenuItemActionPerformed(evt); ); PopupMenu.add(renameMenuItem); OutPopupMenu.setBackground(new java.awt.Color(153, 153, 153); OutPasteKey.setText(粘帖); OutPasteKey.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); OutPasteKey.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); OutPasteKey.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) OutPasteKeyActionPerformed(evt); ); OutPopupMenu.add(OutPasteKey); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(145, 145, 145); setExtendedState(6); setIconImage(Toolkit.getDefaultToolkit().getImage( this.getClass().getResource(/Pictures/apple.png); setLocationByPlatform(true); ToolPanel.setBackground(new java.awt.Color(153, 153, 153); ToolBar.setBackground(new java.awt.Color(145, 145, 145); ToolBar.setFloatable(false); ToolBar.setRollover(true); jButton1.setText( ); jButton1.setFocusable(false); jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); ToolBar.add(jButton1); ToolBar.add(jSeparator1); jButton2.setText( ); jButton2.setFocusable(false); jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton2.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); ToolBar.add(jButton2); jToolBar1.setBackground(new java.awt.Color(145, 145, 145); jToolBar1.setFloatable(false); jToolBar1.setRollover(true); jButton3.setText( ); jButton3.setFocusable(false); jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToolBar1.add(jButton3); jButton4.setText( ); jButton4.setFocusable(false); jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToolBar1.add(jButton4); jButton5.setText( ); jButton5.setFocusable(false); jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jToolBar1.add(jButton5); javax.swing.GroupLayout ToolPanelLayout = new javax.swing.GroupLayout(ToolPanel); ToolPanel.setLayout(ToolPanelLayout); ToolPanelLayout.setHorizontalGroup( ToolPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(ToolPanelLayout.createSequentialGroup() .addComponent(ToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(0, 0, 0) .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); ToolPanelLayout.setVerticalGroup( ToolPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(ToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) ); MainPanel.setBackground(new java.awt.Color(60, 60, 60); TISplitPane.setBackground(new java.awt.Color(60, 60, 60); TISplitPane.setBorder(null); TISplitPane.setDividerLocation(300); TISplitPane.setDividerSize(2); TPSplitPane.setBackground(new java.awt.Color(60, 60, 60); TPSplitPane.setBorder(null); TPSplitPane.setDividerLocation(250); TPSplitPane.setDividerSize(2); TPSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); TPSplitPane.setResizeWeight(1.0); ScrollPane.setBackground(new java.awt.Color(60, 60, 60); Tree.setBackground(new java.awt.Color(60, 60, 60); File root = FileSystemView.getFileSystemView().getRoots()0; FileNode rootNode = new FileNode(root); rootNode.explore(); Tree.setModel(new DefaultTreeModel(rootNode); Tree.setCellRenderer(new FolderRenderer(); Tree.addTreeExpansionListener(new javax.swing.event.TreeExpansionListener() public void treeCollapsed(javax.swing.event.TreeExpansionEvent evt) public void treeExpanded(javax.swing.event.TreeExpansionEvent evt) TreeTreeExpanded(evt); ); Tree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() public void valueChanged(javax.swing.event.TreeSelectionEvent evt) TreeValueChanged(evt); ); ScrollPane.setViewportView(Tree); TPSplitPane.setLeftComponent(ScrollPane); previewPanel.setBackground(new java.awt.Color(0, 0, 0); previewPanel.setPreferredSize(new java.awt.Dimension(300, 300); javax.swing.GroupLayout previewPanelLayout = new javax.swing.GroupLayout(previewPanel); previewPanel.setLayout(previewPanelLayout); previewPanelLayout.setHorizontalGroup( previewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); previewPanelLayout.setVerticalGroup( previewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE) ); TPSplitPane.setBottomComponent(previewPanel); TISplitPane.setTopComponent(TPSplitPane); Panel.setBackground(new java.awt.Color(145, 145, 145); historyBox.setBackground(new java.awt.Color(145, 145, 145); historyBox.addPopupMenuListener(new javax.swing.event.PopupMenuListener() public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) historyBoxPopupMenuWillBecomeInvisible(evt); public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) ); ImagesScroll.setBackground(new java.awt.Color(60, 60, 60); ImagesPanel.setBackground(new java.awt.Color(60, 60, 60); ImagesPanel.addMouseListener(new java.awt.event.MouseAdapter() public void mouseClicked(java.awt.event.MouseEvent evt) ImagesPanelMouseClicked(evt); ); javax.swing.GroupLayout ImagesPanelLayout = new javax.swing.GroupLayout(ImagesPanel); ImagesPanel.setLayout(ImagesPanelLayout); ImagesPanelLayout.setHorizontalGroup( ImagesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 730, Short.MAX_VALUE) ); ImagesPanelLayout.setVerticalGroup( ImagesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 510, Short.MAX_VALUE) ); ImagesScroll.setViewportView(ImagesPanel); historyToolBar.setBackground(new java.awt.Color(145, 145, 145); historyToolBar.setFloatable(false); historyToolBar.setRollover(true); historyButton.setBackground(new java.awt.Color(145, 145, 145); historyButton.setIcon(new javax.swing.ImageIcon(getClass().getResource(/Pictures/TrashCan.png); / NOI18N historyButton.setFocusable(false); historyButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); historyButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); historyButton.addMouseListener(new java.awt.event.MouseAdapter() public void mouseReleased(java.awt.event.MouseEvent evt) historyButtonMouseReleased(evt); ); historyToolBar.add(historyButton); javax.swing.GroupLayout PanelLayout = new javax.swing.GroupLayout(Panel); Panel.setLayout(PanelLayout); PanelLayout.setHorizontalGroup( PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ImagesScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 708, Short.MAX_VALUE) .addGroup(PanelLayout.createSequentialGroup() .addComponent(historyBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(0, 0, 0) .addComponent(historyToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); PanelLayout.setVerticalGroup( PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(PanelLayout.createSequentialGroup() .addGap(0, 0, 0) .addGroup(PanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(historyBox) .addComponent(historyToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(0, 0, 0) .addComponent(ImagesScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 506, Short.MAX_VALUE) ); TISplitPane.setRightComponent(Panel); javax.swing.GroupLayout MainPanelLayout = new javax.swing.GroupLayout(MainPanel); MainPanel.setLayout(MainPanelLayout); MainPanelLayout.setHorizontalGroup( MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(TISplitPane) ); MainPanelLayout.setVerticalGroup( MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(TISplitPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 533, Short.MAX_VALUE) ); TextPanel.setBackground(new java.awt.Color(153, 153, 153); currentPath.setEditable(false); currentPath.setBackground(new java.awt.Color(145, 145, 145); currentPath.setHorizontalAlignment(javax.swing.JTextField.CENTER); currentPath.setFocusable(false); Selected.setEditable(false); Selected.setBackground(new java.awt.Color(145, 145, 145); Selected.setHorizontalAlignment(javax.swing.JTextField.CENTER); Selected.setFocusable(false); Pictures.setEditable(false); Pictures.setBackground(new java.awt.Color(145, 145, 145); Pictures.setHorizontalAlignment(javax.swing.JTextField.CENTER); Pictures.setFocusable(false); Folders.setEdi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论