📄 mdi.java
字号:
/* * MDI.java * * Created on 2008年3月16日, 上午7:58 */package personalpetvet.ui;import java.awt.Dimension;import java.awt.Image;import java.awt.event.ActionEvent;import java.awt.event.ComponentEvent;import java.awt.event.ItemEvent;import java.awt.event.ItemListener;import java.awt.geom.Ellipse2D;import java.awt.geom.Rectangle2D;import java.beans.PropertyChangeEvent;import java.beans.PropertyChangeListener;import personalpetvet.*;import java.beans.PropertyVetoException;import java.util.logging.Level;import java.util.logging.Logger;import javax.swing.ImageIcon;import javax.swing.JDesktopPane;import javax.swing.JDialog;import javax.swing.JFrame;import javax.swing.JInternalFrame;import javax.swing.JPanel;import org.jdesktop.application.Action;import org.jdesktop.application.Application;import org.jdesktop.application.SingleFrameApplication;import personalpetvet.model.Petsowner;import personalpetvet.model.Picture;import personalpetvet.model.PictureType;import personalpetvet.model.Serviceprovider;import personalpetvet.ui.MultiBehaviorPanel.BEHAVIOR;/** * * @author james */public class MDI extends javax.swing.JFrame implements PropertyChangeListener { static MDI instance; Session session = Session.getInstance(); /** Creates new form MDI */ public MDI() { initComponents(); //initBackground(); //centerBackground(); } public static MDI getInstance() { if (instance == null) { instance = new MDI(); } return instance; } public JDesktopPane getDesktopPane() { return desktopPane; } private void closeInternalFrames() { expenseJIF = null; generalHealthNotesJIF = null; medicationJIF = null; vaccinationJIF = null; vetVisitJIF = null; for (JInternalFrame jif : desktopPane.getAllFrames()) { jif.setVisible(false); } } /** 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. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { desktopPane = new javax.swing.JDesktopPane(); backgroundLabel = new javax.swing.JLabel(); spLogoLabel = new javax.swing.JLabel(); petvetLogoLabel = new javax.swing.JLabel(); statusBarPanel = new javax.swing.JPanel(); statusLabel = new javax.swing.JLabel(); menuBar = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); loginCheckBoxMenuItem = new javax.swing.JCheckBoxMenuItem(); logoutCheckBoxMenuItem = new javax.swing.JCheckBoxMenuItem(); jSeparator4 = new javax.swing.JSeparator(); selectPetMenuItem = new javax.swing.JMenuItem(); jSeparator5 = new javax.swing.JSeparator(); myAccountMenuItem = new javax.swing.JMenuItem(); preferencesMenuItem = new javax.swing.JMenuItem(); jSeparator3 = new javax.swing.JSeparator(); exitMenuItem = new javax.swing.JMenuItem(); serviceMenu = new javax.swing.JMenu(); jSeparator2 = new javax.swing.JSeparator(); vetVisitsMenuItem = new javax.swing.JMenuItem(); medicationsMenuItem = new javax.swing.JMenuItem(); vaccinationsMenuItem = new javax.swing.JMenuItem(); medicalPixMenuItem = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); generalPixMenuItem = new javax.swing.JMenuItem(); generalHealthNotesMenuItem = new javax.swing.JMenuItem(); jSeparator6 = new javax.swing.JSeparator(); appointmentMenuItem = new javax.swing.JMenuItem(); ownerMenu = new javax.swing.JMenu(); petsMenuItem = new javax.swing.JMenuItem(); expensesMenuItem = new javax.swing.JMenuItem(); serviceProvidersMenuItem = new javax.swing.JMenuItem(); emergencyInfoMenu = new javax.swing.JMenu(); helpMenu = new javax.swing.JMenu(); aboutMenuItem = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("personalpetvet/resources/PersonalPetVetApp"); // NOI18N setTitle(bundle.getString("Application.title")); // NOI18N setName("Form"); // NOI18N addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { formWindowClosing(evt); } }); addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(java.awt.event.ComponentEvent evt) { centerBackground(evt); } }); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(personalpetvet.PersonalPetVetApp.class).getContext().getResourceMap(MDI.class); desktopPane.setBackground(resourceMap.getColor("desktopPane.background")); // NOI18N desktopPane.setAutoscrolls(true); desktopPane.setName("desktopPane"); // NOI18N backgroundLabel.setBackground(resourceMap.getColor("backgroundLabel.background")); // NOI18N backgroundLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); backgroundLabel.setText(resourceMap.getString("backgroundLabel.text")); // NOI18N backgroundLabel.setToolTipText(resourceMap.getString("backgroundLabel.toolTipText")); // NOI18N backgroundLabel.setFocusable(false); backgroundLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); backgroundLabel.setIconTextGap(0); backgroundLabel.setMaximumSize(new java.awt.Dimension(1920, 1600)); backgroundLabel.setMinimumSize(new java.awt.Dimension(1920, 1600)); backgroundLabel.setName("backgroundLabel"); // NOI18N backgroundLabel.setPreferredSize(new java.awt.Dimension(1920, 1600)); backgroundLabel.setBounds(80, 100, 460, 210); desktopPane.add(backgroundLabel, javax.swing.JLayeredPane.DEFAULT_LAYER); spLogoLabel.setText(resourceMap.getString("spLogoLabel.text")); // NOI18N spLogoLabel.setName("spLogoLabel"); // NOI18N spLogoLabel.setBounds(600, 10, 60, 30); desktopPane.add(spLogoLabel, javax.swing.JLayeredPane.DEFAULT_LAYER); petvetLogoLabel.setText(resourceMap.getString("petvetLogoLabel.text")); // NOI18N petvetLogoLabel.setName("petvetLogoLabel"); // NOI18N petvetLogoLabel.setBounds(10, 420, 40, 20); desktopPane.add(petvetLogoLabel, javax.swing.JLayeredPane.DEFAULT_LAYER); statusBarPanel.setFocusable(false); statusBarPanel.setName("statusBarPanel"); // NOI18N statusLabel.setText(resourceMap.getString("statusLabel.text")); // NOI18N statusLabel.setName("statusLabel"); // NOI18N javax.swing.GroupLayout statusBarPanelLayout = new javax.swing.GroupLayout(statusBarPanel); statusBarPanel.setLayout(statusBarPanelLayout); statusBarPanelLayout.setHorizontalGroup( statusBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(statusBarPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(348, Short.MAX_VALUE)) ); statusBarPanelLayout.setVerticalGroup( statusBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 24, Short.MAX_VALUE) ); menuBar.setName("menuBar"); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(personalpetvet.PersonalPetVetApp.class).getContext().getActionMap(MDI.class, this); loginCheckBoxMenuItem.setAction(actionMap.get("login")); // NOI18N loginCheckBoxMenuItem.setSelected(true); loginCheckBoxMenuItem.setText(resourceMap.getString("loginCheckBoxMenuItem.text")); // NOI18N loginCheckBoxMenuItem.setName("loginCheckBoxMenuItem"); // NOI18N fileMenu.add(loginCheckBoxMenuItem); logoutCheckBoxMenuItem.setAction(actionMap.get("logout")); // NOI18N logoutCheckBoxMenuItem.setText(resourceMap.getString("logoutCheckBoxMenuItem.text")); // NOI18N logoutCheckBoxMenuItem.setName("logoutCheckBoxMenuItem"); // NOI18N fileMenu.add(logoutCheckBoxMenuItem); jSeparator4.setName("jSeparator4"); // NOI18N fileMenu.add(jSeparator4); selectPetMenuItem.setAction(actionMap.get("selectPet")); // NOI18N selectPetMenuItem.setText(resourceMap.getString("selectPetMenuItem.text")); // NOI18N selectPetMenuItem.setName("selectPetMenuItem"); // NOI18N fileMenu.add(selectPetMenuItem); jSeparator5.setName("jSeparator5"); // NOI18N fileMenu.add(jSeparator5); myAccountMenuItem.setAction(actionMap.get("viewMyAccount")); // NOI18N myAccountMenuItem.setText(resourceMap.getString("myAccountMenuItem.text")); // NOI18N myAccountMenuItem.setName("myAccountMenuItem"); // NOI18N fileMenu.add(myAccountMenuItem); preferencesMenuItem.setAction(actionMap.get("viewPreferences")); // NOI18N preferencesMenuItem.setText(resourceMap.getString("preferencesMenuItem.text")); // NOI18N preferencesMenuItem.setName("preferencesMenuItem"); // NOI18N fileMenu.add(preferencesMenuItem); jSeparator3.setName("jSeparator3"); // NOI18N fileMenu.add(jSeparator3); exitMenuItem.setText(resourceMap.getString("exitMenuItem.text")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N exitMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); serviceMenu.setText(resourceMap.getString("serviceMenu.text")); // NOI18N serviceMenu.setName("serviceMenu"); // NOI18N jSeparator2.setName("jSeparator2"); // NOI18N serviceMenu.add(jSeparator2); vetVisitsMenuItem.setAction(actionMap.get("viewVetVisit")); // NOI18N vetVisitsMenuItem.setText(resourceMap.getString("vetVisitsMenuItem.text")); // NOI18N vetVisitsMenuItem.setName("vetVisitsMenuItem"); // NOI18N serviceMenu.add(vetVisitsMenuItem); medicationsMenuItem.setAction(actionMap.get("viewMedications")); // NOI18N medicationsMenuItem.setText(resourceMap.getString("medicationsMenuItem.text")); // NOI18N medicationsMenuItem.setName("medicationsMenuItem"); // NOI18N serviceMenu.add(medicationsMenuItem); vaccinationsMenuItem.setAction(actionMap.get("viewVaccinations")); // NOI18N vaccinationsMenuItem.setText(resourceMap.getString("vaccinationsMenuItem.text")); // NOI18N vaccinationsMenuItem.setName("vaccinationsMenuItem"); // NOI18N serviceMenu.add(vaccinationsMenuItem); medicalPixMenuItem.setAction(actionMap.get("viewMedicalPix")); // NOI18N medicalPixMenuItem.setText(resourceMap.getString("medicalPixMenuItem.text")); // NOI18N medicalPixMenuItem.setName("medicalPixMenuItem"); // NOI18N serviceMenu.add(medicalPixMenuItem); jSeparator1.setName("jSeparator1"); // NOI18N serviceMenu.add(jSeparator1); generalPixMenuItem.setAction(actionMap.get("viewGeneralPix")); // NOI18N generalPixMenuItem.setText(resourceMap.getString("generalPixMenuItem.text")); // NOI18N generalPixMenuItem.setName("generalPixMenuItem"); // NOI18N serviceMenu.add(generalPixMenuItem); generalHealthNotesMenuItem.setAction(actionMap.get("viewGeneralHeathNotes")); // NOI18N generalHealthNotesMenuItem.setText(resourceMap.getString("generalHealthNotesMenuItem.text")); // NOI18N generalHealthNotesMenuItem.setName("generalHealthNotesMenuItem"); // NOI18N
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -