⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdiui.java

📁 一个马路监控器,可安装在网络中,显示路面上的情况
💻 JAVA
字号:
/*
 * SDIUI.java
 *
 * Created on 2007年9月19日, 下午8:42
 */

package my.sdi;

/**
 *
 * @author  Administrator
 */
public class SDIUI extends javax.swing.JFrame {
    
    /** Creates new form SDIUI */
    public SDIUI() {
        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.
     */
    // <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
    private void initComponents() {
        javax.swing.JButton Cam2Exit;
        javax.swing.JMenu MenuQuit;

        Cam1Win = new javax.swing.JDialog();
        jLabel1 = new javax.swing.JLabel();
        Cam1Exit = new javax.swing.JButton();
        Cam2Win = new javax.swing.JDialog();
        jLabel2 = new javax.swing.JLabel();
        Cam2Exit = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        MenuQuit = new javax.swing.JMenu();
        MenuCam1 = new javax.swing.JMenu();
        MenuCam2 = new javax.swing.JMenu();

        Cam1Win.setTitle("Camera1");
        jLabel1.setText("magin1");

        Cam1Exit.setText("EXIT");
        Cam1Exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Cam1ExitActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout Cam1WinLayout = new javax.swing.GroupLayout(Cam1Win.getContentPane());
        Cam1Win.getContentPane().setLayout(Cam1WinLayout);
        Cam1WinLayout.setHorizontalGroup(
            Cam1WinLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Cam1WinLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addContainerGap(352, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Cam1WinLayout.createSequentialGroup()
                .addContainerGap(331, Short.MAX_VALUE)
                .addComponent(Cam1Exit)
                .addContainerGap())
        );
        Cam1WinLayout.setVerticalGroup(
            Cam1WinLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Cam1WinLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 234, Short.MAX_VALUE)
                .addComponent(Cam1Exit)
                .addContainerGap())
        );
        Cam2Win.setTitle("Camera2");
        jLabel2.setText("image2");

        Cam2Exit.setText("EXIT");
        Cam2Exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Cam2ExitActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout Cam2WinLayout = new javax.swing.GroupLayout(Cam2Win.getContentPane());
        Cam2Win.getContentPane().setLayout(Cam2WinLayout);
        Cam2WinLayout.setHorizontalGroup(
            Cam2WinLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Cam2WinLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addContainerGap(352, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Cam2WinLayout.createSequentialGroup()
                .addContainerGap(331, Short.MAX_VALUE)
                .addComponent(Cam2Exit)
                .addContainerGap())
        );
        Cam2WinLayout.setVerticalGroup(
            Cam2WinLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Cam2WinLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 234, Short.MAX_VALUE)
                .addComponent(Cam2Exit)
                .addContainerGap())
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("traffic camera");
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 376, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 251, Short.MAX_VALUE)
        );

        MenuQuit.setText("Quit");
        MenuQuit.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                MenuQuitMouseClicked(evt);
            }
        });
        MenuQuit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuQuitActionPerformed(evt);
            }
        });
        MenuQuit.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                MenuQuitAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        jMenuBar1.add(MenuQuit);

        MenuCam1.setText("CAM 1");
        MenuCam1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                MenuCam1MouseClicked(evt);
            }
        });

        jMenuBar1.add(MenuCam1);

        MenuCam2.setText("CAM 2");
        MenuCam2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                MenuCam2MouseClicked(evt);
            }
        });

        jMenuBar1.add(MenuCam2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-400)/2, (screenSize.height-300)/2, 400, 300);
    }// </editor-fold>//GEN-END:initComponents

    private void MenuQuitAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_MenuQuitAncestorAdded
// TODO 将在此处添加您的处理代码:
    }//GEN-LAST:event_MenuQuitAncestorAdded

    private void Cam2ExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Cam2ExitActionPerformed
    Cam2Win.dispose();// TODO 将在此处添加您的处理代码:
    }//GEN-LAST:event_Cam2ExitActionPerformed

    private void Cam1ExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Cam1ExitActionPerformed
     Cam1Win.dispose();
     // TODO 将在此处添加您的处理代码:
    }//GEN-LAST:event_Cam1ExitActionPerformed

    private void MenuCam2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MenuCam2MouseClicked
    Cam2Win.setBounds(400,0,400,400);
    Cam2Win.setVisible(true);// TODO 将在此处添加您的处理代码:
    }//GEN-LAST:event_MenuCam2MouseClicked

    private void MenuCam1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MenuCam1MouseClicked
      Cam1Win.setBounds(0,0,400,400);
      Cam1Win.setVisible(true);// TODO 将在此处添加您的处理代码:
    }//GEN-LAST:event_MenuCam1MouseClicked

    private void MenuQuitMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MenuQuitMouseClicked
    System.exit(0);  // TODO 将在此处添加您的处理代码:
    }//GEN-LAST:event_MenuQuitMouseClicked

    private void MenuQuitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuQuitActionPerformed
     System.exit(0);// TODO 将在此处添加您的处理代码:
    }//GEN-LAST:event_MenuQuitActionPerformed
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new SDIUI().setVisible(true);
            }
        });
    }
    
    // 变量声明 - 不进行修改//GEN-BEGIN:variables
    private javax.swing.JButton Cam1Exit;
    private javax.swing.JDialog Cam1Win;
    private javax.swing.JDialog Cam2Win;
    private javax.swing.JMenu MenuCam1;
    private javax.swing.JMenu MenuCam2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    // 变量声明结束//GEN-END:variables
    
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -