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

📄 graphframe.java

📁 自己写的轮询提问的小程序 新手刚学 多多指教 合乎哈
💻 JAVA
字号:
/*GraphFrame is the class that displays those cool graphs on the projector screenCopyright (C) 2005-2006  Igor Partola, Michael J. Krikonis, Clark UniversityThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.*/package PollServer;import javax.swing.*;import java.awt.*;import SharedClasses.*;import SharedClasses.DataSet;public class GraphFrame extends javax.swing.JFrame {        public GraphFrame() {        initComponents();    }        private void initComponents() {//GEN-BEGIN:initComponents        VoteGraphPanel = new SharedClasses.GraphPanel();        IPAddrLabel = new javax.swing.JLabel();        getContentPane().setLayout(null);        setTitle("JustPoll Vote Display Panel");        setResizable(false);        setUndecorated(true);        addComponentListener(new java.awt.event.ComponentAdapter() {            public void componentResized(java.awt.event.ComponentEvent evt) {                onResizeEventHandler(evt);            }        });        addWindowListener(new java.awt.event.WindowAdapter() {            public void windowClosing(java.awt.event.WindowEvent evt) {                exitForm(evt);            }        });        VoteGraphPanel.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED));        getContentPane().add(VoteGraphPanel);        VoteGraphPanel.setBounds(0, 40, 400, 260);        IPAddrLabel.setFont(new java.awt.Font("MS Sans Serif", 1, 14));        IPAddrLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);        IPAddrLabel.setText("Network Address: Unknown");        getContentPane().add(IPAddrLabel);        IPAddrLabel.setBounds(0, 10, 400, 19);        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();        setBounds((screenSize.width-408)/2, (screenSize.height-329)/2, 408, 329);    }//GEN-END:initComponents    private void onResizeEventHandler(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_onResizeEventHandler        VoteGraphPanel.setBounds(10, 50, this.getWidth() - 30, this.getHeight() - 60);        IPAddrLabel.setBounds(0, 20, this.getWidth(), 20);        repaint();    }//GEN-LAST:event_onResizeEventHandler        private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm        System.exit(0);    }//GEN-LAST:event_exitForm        public void paint(Graphics g) {        super.paint(g);    }        public void updateVotes(int a, int b, int c, int d, int e, int f) {        myDataSet.setVoteCounts(a, b, c, d, e, f);        VoteGraphPanel.updateVotes(myDataSet);    }        public GraphPanel getGraphPanel() {        return VoteGraphPanel;    }        public void setIPAddress(String s) {        IPAddrLabel.setText("Network Address: " + s);    }        // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JLabel IPAddrLabel;    private SharedClasses.GraphPanel VoteGraphPanel;    // End of variables declaration//GEN-END:variables    private DataSet myDataSet = new DataSet();}

⌨️ 快捷键说明

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