📄 jsee.java
字号:
Auto_Size = false;
}
else
{
fullSize_item.setSelected(false);
Auto_Size = true;
}
}
}
);
exit_item.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event ) {
Quit();
}
}
);
option_item.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event ) {
optionsDialog.show();
}
}
);
about_item.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event ) {
//aboutbox.show();
imageScrollPane.displayAbout();
}
}
);
menu.add(option_item);
menu.add(thumbNail_item);
menu.add(jSeparator1);
menu.add(fullSize_item);
menu.add(autoSize_item);
menu.add(jSeparator2);
menu.add(exit_item);
menu.add(about_item);
getContentPane().add(menu);
progress.setValue((progressValue++) * progressScale);
// end the add listener section
// Construct the window menu bar
jMenuBar = new JMenuBar();
jFileMenu = new JMenu("File");
jViewMenu = new JMenu("View");
jHelpMenu = new JMenu("Help");
jExitItem = new JMenuItem("Exit");
jExitItem.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event ) {
Quit();
}
}
);
jOptionItem = new JMenuItem("Option", new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/Option.gif")) );
jOptionItem.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event ) {
optionsDialog.show();
}
}
);
jThumbNailItem = new JCheckBoxMenuItem("ThumbNail", ThumbNailIsShowing);
jThumbNailItem.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event ) {
if ( !jThumbNailItem.getState() )
{
DisplayFileList();
ThumbNailIsShowing = false;
thumbNail_item.setSelected(false);
viewButton.setIcon(thumbNailIcon);
}
else {
DisplayThumbNail();
ThumbNailIsShowing = true;
thumbNail_item.setSelected(true);
viewButton.setIcon(listIcon);
}
}
}
);
jAboutItem = new JMenuItem("About");
jAboutItem.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent event ) {
imageScrollPane.displayAbout();
if (PreviewAreaIsHiding)
HidePreview(false);
}
}
);
jFileMenu.add(jExitItem);
jViewMenu.add(jThumbNailItem);
jViewMenu.add(jOptionItem);
jHelpMenu.add(jAboutItem);
jMenuBar.add(jFileMenu);
jMenuBar.add(jViewMenu);
jMenuBar.add(jHelpMenu);
//Added to Menu section by Neoya
ActionListener showColumnListener=new ActionListener(){
public void actionPerformed( ActionEvent event ){
Object o=event.getSource();
if (o== jShowSizeItem || o==jShowModifiedItem ||o==jShowTypeItem ||o==jShowPropertyItem){
FileListScrollPane.setShowColumn(((JCheckBoxMenuItem)o).getText(),((JCheckBoxMenuItem)o).isSelected());
}
}
};
//Get the saved properties and set it
boolean b;
b=properties.getBooleanProperty(Properties.SHOW_COLUMN_SIZE);
FileListScrollPane.setShowColumn(Properties.SHOW_COLUMN_SIZE,b);
jShowSizeItem=new JCheckBoxMenuItem(Properties.SHOW_COLUMN_SIZE,b);
b=properties.getBooleanProperty(Properties.SHOW_COLUMN_DATE);
FileListScrollPane.setShowColumn(Properties.SHOW_COLUMN_DATE,b);
jShowModifiedItem=new JCheckBoxMenuItem(Properties.SHOW_COLUMN_DATE,b);
b=properties.getBooleanProperty(Properties.SHOW_COLUMN_TYPE);
FileListScrollPane.setShowColumn(Properties.SHOW_COLUMN_TYPE,b);
jShowTypeItem=new JCheckBoxMenuItem(Properties.SHOW_COLUMN_TYPE,b);
b=properties.getBooleanProperty(Properties.SHOW_COLUMN_PROPERTIES);
FileListScrollPane.setShowColumn(Properties.SHOW_COLUMN_PROPERTIES,b);
jShowPropertyItem=new JCheckBoxMenuItem(Properties.SHOW_COLUMN_PROPERTIES,b);
jShowSizeItem.addActionListener(showColumnListener);
jShowModifiedItem.addActionListener(showColumnListener);
jShowTypeItem.addActionListener(showColumnListener);
jShowPropertyItem.addActionListener(showColumnListener);
jShowColumnsMenu=new JMenu("Show Columns");
jShowColumnsMenu.add(jShowSizeItem);
jShowColumnsMenu.add(jShowModifiedItem);
jShowColumnsMenu.add(jShowTypeItem);
jShowColumnsMenu.add(jShowPropertyItem);
jViewMenu.add(jShowColumnsMenu,1);
// end menu section
progress.setValue((progressValue++) * progressScale);
// Tool bar section
thumbNailIcon = new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/Thumb Nail.gif"));
listIcon = new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/list.gif"));
Action DisplayThumbAction = new AbstractAction("Thumbnail/List",
(ThumbNailIsShowing)?listIcon:thumbNailIcon) {
public void actionPerformed(ActionEvent event)
{
if (!ThumbNailIsShowing) {
DisplayThumbNail();
// set check the Thumb item on popup menu
thumbNail_item.setSelected(true);
jThumbNailItem.setSelected(true);
ThumbNailIsShowing = true;
viewButton.setIcon(listIcon);
} else {
DisplayFileList();
viewButton.setIcon(thumbNailIcon);
ThumbNailIsShowing = false;
thumbNail_item.setSelected(false);
jThumbNailItem.setSelected(false);
}
}
};
Action OptionAction = new AbstractAction("Option",
new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/Option.gif"))) {
public void actionPerformed(ActionEvent event)
{
optionsDialog.show();
}
};
Action GoUpAction = new AbstractAction("Up One Level", new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/pfIcon.gif"))) {
public void actionPerformed(ActionEvent event)
{// Go to parent directory
try {
FileListScrollPane.RefreshFileList(parentDir);
if (ThumbNailIsShowing) {
ChangeThumbNailDirectory(FileListScrollPane.getFileList());
}
currentDir = parentDir.toString();
} catch (NullPointerException npe) {System.out.println("Something wrong: Null pointer exception ");}
}
};
Action RefreshAction = new AbstractAction("Refresh", new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/refresh.gif"))) {
public void actionPerformed(ActionEvent event)
{
FileListScrollPane.RefreshFileList();
if (ThumbNailIsShowing) {
ChangeThumbNailDirectory(FileListScrollPane.getFileList());
}
}
};
Action ViewAction = new AbstractAction("View image", new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/view.gif"))) {
public void actionPerformed(ActionEvent event)
{
FileListScrollPane.dislayImageFullScreen();
}
};
Action DeleteAction = new AbstractAction("Delete", new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/delete.gif"))) {
public void actionPerformed(ActionEvent event)
{
FileListScrollPane.deleteSelectedFile();
thumblabel.Hide_Selected_Thumb();
}
};
JToolBar toolBar = new JToolBar();
GoUpToolButton = new ToolBarButton(GoUpAction);
toolBar.add(GoUpToolButton);
if (parentDir == null) {
GoUpToolButton.setEnabled(false);
}
toolBar.addSeparator( new Dimension(3,3) );
RefreshButton = new ToolBarButton(RefreshAction);
toolBar.add(RefreshButton);
toolBar.addSeparator( new Dimension(3,3) );
toolBar.add(new ToolBarButton(OptionAction));
toolBar.addSeparator( new Dimension(3,3) );
viewButton = new ToolBarButton(DisplayThumbAction);
toolBar.add(viewButton);
toolBar.addSeparator( new Dimension(3,3) );
ViewFullScreenButton = new ToolBarButton(ViewAction);
ViewFullScreenButton.setEnabled(false);
toolBar.add(ViewFullScreenButton);
toolBar.addSeparator( new Dimension(3,3) );
DeleteButton = new ToolBarButton(DeleteAction);
toolBar.add(DeleteButton);
DeleteButton.setEnabled(false);
getContentPane().add(toolBar, BorderLayout.NORTH);
// end tool bar
// status bar
statusBar = new StatusBarPanel();
getContentPane().add(statusBar, BorderLayout.SOUTH);
// end status bar
getContentPane().add(Spane, BorderLayout.CENTER);
setJMenuBar (jMenuBar);
setIconImage( (new ImageIcon(getClass().getResource("/org/net9/oops/jsee/image/Jsee.gif"))).getImage() );
// put things in place
reshape(0,0,res_width,res_height);
progress.dispose();
SetTitle();
show();
if (ThumbNailIsShowing)
DisplayThumbNail();
} // end Jsee()
public void addTool(JToolBar toolBar, String name) {
JButton b = (JButton)toolBar.add(new JButton(new ImageIcon(name + ".gif",name)));
b.setToolTipText(name);
b.getAccessibleContext().setAccessibleName(name);
}
public final void Display_Image(String filename) {
imageScrollPane.DisplayImage(filename);
}
public String GetNextImage() {
return FileListScrollPane.getNextImage();
}
public String GetPreviousImage() {
return FileListScrollPane.getPreviousImage();
}
public void SelectCurrentFile() {
FileListScrollPane.SelectCurrentFile();
}
public final void Open(String filename) // to be called by OpenNext() or OpenPrevious()
{
Display_Image( filename );
currentSelectedFile = FileListScrollPane.getSelectedIndex();
}
/** Called when user click "View" button on toolbar
*
*/
public final void Display_Image_FullScreen( String filename ) {
// create image
ImageIcon splashIm = new ImageIcon(filename);
if (splashIm.getIconHeight() < 0) {
try {
if (filename.toLowerCase().endsWith(".xpm")) {
FileInputStream file = new FileInputStream (filename);
DataInputStream in = new DataInputStream (file);
byte[] buff = new byte[in.available ()];
int i = file.read(buff);
String s = new String(buff);
splashIm = new ImageIcon(Xpm.XpmToImage(s));
}
else if (filename.toLowerCase().endsWith(".bmp")) {
try {
URL url = (new File(filename)).toURL();
splashIm = new ImageIcon(createImage(BMPReader.getBMPImage(url.openStream())));
} catch ( MalformedURLException e ) {System.out.println("File or URL exception");}
catch (IOException e) {}
} else
splashIm = new ImageIcon(PcxReader102V01.loadImage(new FileInputStream(filename)));
} catch (FileNotFoundException fnfe) {System.out.println("FileNotFoundException or access denied");}
catch (NullPointerException npe) {}
catch(IOException e) {}
if (splashIm.getIconHeight() < 0) {
System.out.println("This is not an image file or not supported by JAI");
return;
}
}
// display in viewer window
if (ViewFullScreen) { // view full screen
if (fsw != null)
fsw.dispose();
fsw = new FullScreenWindow(this, splashIm);
fsw.requestFocus();
} else { // view in viewer window
vw = new ViewerWindow(new ViewerScrollPane(splashIm), this);
vw.show();
this.hide();
}
}
/** Called when user double click on file name
*
*/
public final void Display_Selected_Image_FullScreen() {
if (ViewFullScreen) {
if (fsw != null)
fsw.dispose();
fsw = new FullScreenWindow(this, imageScrollPane.originalImage);
fsw.requestFocus();
} else {
vw = new ViewerWindow(new ViewerScrollPane(imageScrollPane.originalImage), this);
vw.show();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -