📄 navigationframe.java
字号:
/* * $RCSfile: NavigationFrame.java,v $ * $Revision: 1.7 $ * $Date: 2005/04/27 23:13:04 $ * * NeuralNetworkToolkit * Copyright (C) 2004 Universidade de Brasília * * This file is part of NeuralNetworkToolkit. * * NeuralNetworkToolkit is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * NeuralNetworkToolkit is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NeuralNetworkToolkit; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 - USA. */package neuralnetworktoolkit.gui.navigation;import java.awt.*;import java.awt.event.*;import java.util.ResourceBundle;import javax.swing.*;/** * * * @version $Revision: 1.7 $ - $Date: 2005/04/27 23:13:04 $ * * @author <a href="mailto:rodbra@pop.com.br">Rodrigo C. M. Coimbra</a> * @author <a href="mailto:hugoiver@yahoo.com.br">Hugo Iver V. Gonçalves</a> */public class NavigationFrame extends JFrame { private JDesktopPane desktop; private NavigationController controller; private ResourceBundle resource; private ResourceBundle iconsResource; /** * * @param controller */ public NavigationFrame(NavigationController controller) { super("NeuralNetworkToolkit"); resource = ResourceBundle .getBundle("neuralnetworktoolkit.gui.navigation.resources.NavigationFrameResource"); iconsResource = ResourceBundle.getBundle("neuralnetworktoolkit.gui.resources.IconsResource"); //ImageIcon icone = new ImageIcon(NomeArquivo.ARQ_ICONE); int inset = 50; Dimension tamanho = Toolkit.getDefaultToolkit().getScreenSize(); setBounds( inset, inset, tamanho.width - inset * 2, tamanho.height - inset * 2); /* try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { JOptionPane.showMessageDialog(desktop, "Fail to generate desktop!", "Neural Network Toolkit - Test Environment", JOptionPane.ERROR_MESSAGE); } */ addWindowListener(new NavigationFrameObserver()); desktop = new JDesktopPane(); this.controller = controller; setContentPane(desktop); //setIconImage(icone.getImage()); setJMenuBar(createMenuBar()); } //NavigationFrame() /** * * * @return */ private JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu networkMenu = new JMenu(resource.getString("network")); JMenu optionsMenu = new JMenu(resource.getString("options")); JMenu helpMenu = new JMenu(resource.getString("help")); JMenuItem newMenu = new JMenu(resource.getString("newFrom")); newMenu.setIcon((ImageIcon)iconsResource.getObject("stock_new16")); JMenuItem fromTxtFileMenuItem = new JMenuItem(resource.getString("file")); fromTxtFileMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { controller.loadDataFromFile(); } }); newMenu.add(fromTxtFileMenuItem); JMenuItem fromDatabaseMenuItem = new JMenuItem(resource.getString("database")); fromDatabaseMenuItem.setEnabled(false); fromDatabaseMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { controller.loadDataFromDatabase(); } }); newMenu.add(fromDatabaseMenuItem); networkMenu.add(newMenu); JMenuItem openMenuItem = new JMenuItem(resource.getString("open")); openMenuItem.setIcon((ImageIcon)iconsResource.getObject("stock_open16")); openMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { controller.loadNetwork(); } }); networkMenu.add(openMenuItem); networkMenu.addSeparator(); JMenuItem exitMenuItem = new JMenuItem(resource.getString("exit")); exitMenuItem.setIcon((ImageIcon)iconsResource.getObject("stock_exit16")); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); networkMenu.add(exitMenuItem); JMenuItem environmentMenuItem = new JMenuItem(resource.getString("environment")); environmentMenuItem.setIcon((ImageIcon)iconsResource.getObject("gnome-settings16")); environmentMenuItem.setEnabled(false); environmentMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { controller.environmentOptions(); } }); optionsMenu.add(environmentMenuItem); JMenuItem contentsMenuItem = new JMenuItem(resource.getString("contents")); contentsMenuItem.setIcon((ImageIcon)iconsResource.getObject("stock_help16")); contentsMenuItem.setEnabled(false); contentsMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); helpMenu.add(contentsMenuItem); helpMenu.addSeparator(); JMenuItem aboutMenuItem = new JMenuItem(resource.getString("about")); aboutMenuItem.setIcon((ImageIcon)iconsResource.getObject("stock_about16")); aboutMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { controller.about(); } }); helpMenu.add(aboutMenuItem); //Add menu items to menu bar. menuBar.add(networkMenu); menuBar.add(optionsMenu); menuBar.add(helpMenu); return (menuBar); } //createMenuBar() /** * * @return */ public JDesktopPane getDesktop() { return desktop; } //getDesktop() /** * */ private class NavigationFrameObserver extends WindowAdapter { public void windowClosing(WindowEvent evt) { System.exit(0); } //windowClosing() } //NavigationFrameObserver} //NavigationFrame
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -