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

📄 boxpanel.java

📁 iReport-0.4.1-src是iReport的源代码,iReport是一个开源的报表项目,可以生成PDF等格式报表
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 1;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        jPanel1.add(jButtonBoxColorTop, gridBagConstraints);        jButtonBoxColorLeft.setBackground(new java.awt.Color(0, 0, 0));        jButtonBoxColorLeft.setFont(new java.awt.Font("Dialog", 0, 11));        jButtonBoxColorLeft.setBorder(new javax.swing.border.EtchedBorder());        jButtonBoxColorLeft.setMaximumSize(new java.awt.Dimension(10, 100));        jButtonBoxColorLeft.setMinimumSize(new java.awt.Dimension(10, 100));        jButtonBoxColorLeft.setPreferredSize(new java.awt.Dimension(10, 100));        jButtonBoxColorLeft.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButtonBoxColorLeftActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 1;        gridBagConstraints.gridy = 2;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        jPanel1.add(jButtonBoxColorLeft, gridBagConstraints);        jComboBoxLeft.setFont(new java.awt.Font("Dialog", 0, 11));        jComboBoxLeft.setMinimumSize(new java.awt.Dimension(100, 24));        jComboBoxLeft.setPreferredSize(new java.awt.Dimension(100, 24));        jComboBoxLeft.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jComboBoxLeftActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 2;        gridBagConstraints.insets = new java.awt.Insets(0, 0, 8, 0);        jPanel1.add(jComboBoxLeft, gridBagConstraints);        jButtonBoxColorBottom.setBackground(new java.awt.Color(0, 0, 0));        jButtonBoxColorBottom.setFont(new java.awt.Font("Dialog", 0, 11));        jButtonBoxColorBottom.setBorder(new javax.swing.border.EtchedBorder());        jButtonBoxColorBottom.setMaximumSize(new java.awt.Dimension(100, 10));        jButtonBoxColorBottom.setMinimumSize(new java.awt.Dimension(100, 10));        jButtonBoxColorBottom.setPreferredSize(new java.awt.Dimension(100, 10));        jButtonBoxColorBottom.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButtonBoxColorBottomActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 3;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        jPanel1.add(jButtonBoxColorBottom, gridBagConstraints);        jButtonBoxColorRight.setBackground(new java.awt.Color(0, 0, 0));        jButtonBoxColorRight.setFont(new java.awt.Font("Dialog", 0, 11));        jButtonBoxColorRight.setBorder(new javax.swing.border.EtchedBorder());        jButtonBoxColorRight.setMaximumSize(new java.awt.Dimension(10, 100));        jButtonBoxColorRight.setMinimumSize(new java.awt.Dimension(10, 100));        jButtonBoxColorRight.setPreferredSize(new java.awt.Dimension(10, 100));        jButtonBoxColorRight.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButtonBoxColorRightActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 3;        gridBagConstraints.gridy = 2;        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);        jPanel1.add(jButtonBoxColorRight, gridBagConstraints);        jComboBoxRight.setFont(new java.awt.Font("Dialog", 0, 11));        jComboBoxRight.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Thin" }));        jComboBoxRight.setMinimumSize(new java.awt.Dimension(100, 24));        jComboBoxRight.setPreferredSize(new java.awt.Dimension(100, 24));        jComboBoxRight.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jComboBoxRightActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 4;        gridBagConstraints.gridy = 2;        gridBagConstraints.insets = new java.awt.Insets(0, 0, 8, 0);        jPanel1.add(jComboBoxRight, gridBagConstraints);        jComboBoxBottom.setFont(new java.awt.Font("Dialog", 0, 11));        jComboBoxBottom.setMinimumSize(new java.awt.Dimension(100, 24));        jComboBoxBottom.setPreferredSize(new java.awt.Dimension(100, 24));        jComboBoxBottom.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jComboBoxBottomActionPerformed(evt);            }        });        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 2;        gridBagConstraints.gridy = 4;        gridBagConstraints.insets = new java.awt.Insets(4, 0, 4, 0);        jPanel1.add(jComboBoxBottom, gridBagConstraints);        gridBagConstraints = new java.awt.GridBagConstraints();        gridBagConstraints.gridx = 0;        gridBagConstraints.gridy = 1;        gridBagConstraints.gridheight = 3;        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;        gridBagConstraints.weightx = 1.0;        gridBagConstraints.weighty = 1.0;        gridBagConstraints.insets = new java.awt.Insets(2, 6, 6, 6);        add(jPanel1, gridBagConstraints);    }//GEN-END:initComponents    private void jComboBoxLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxLeftActionPerformed        if (init) return;        box.setLeftBorder( jComboBoxLeft.getSelectedItem()+"");        fireActionListenerActionPerformed(new java.awt.event.ActionEvent(this,0,""));     }//GEN-LAST:event_jComboBoxLeftActionPerformed    private void jComboBoxBottomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxBottomActionPerformed        if (init) return;        box.setBottomBorder( jComboBoxBottom.getSelectedItem()+"");        fireActionListenerActionPerformed(new java.awt.event.ActionEvent(this,0,""));     }//GEN-LAST:event_jComboBoxBottomActionPerformed    private void jComboBoxRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxRightActionPerformed        if (init) return;        box.setRightBorder( jComboBoxRight.getSelectedItem()+"");        fireActionListenerActionPerformed(new java.awt.event.ActionEvent(this,0,""));     }//GEN-LAST:event_jComboBoxRightActionPerformed    private void jComboBoxTopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTopActionPerformed        if (init) return;        box.setTopBorder( jComboBoxTop.getSelectedItem()+"");        fireActionListenerActionPerformed(new java.awt.event.ActionEvent(this,0,""));     }//GEN-LAST:event_jComboBoxTopActionPerformed    private void jButtonBoxColorLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBoxColorLeftActionPerformed        java.awt.Color color = javax.swing.JColorChooser.showDialog( null, "Select color...",         this.jButtonBoxColorLeft.getBackground());                 if (color  != null) {             box.setLeftBorderColor(color);            this.jButtonBoxColorLeft.setBackground(color);            fireActionListenerActionPerformed(new java.awt.event.ActionEvent(this,0,""));          }    }//GEN-LAST:event_jButtonBoxColorLeftActionPerformed    private void jButtonBoxColorBottomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBoxColorBottomActionPerformed        java.awt.Color color = javax.swing.JColorChooser.showDialog( null, "Select color...",         this.jButtonBoxColorBottom.getBackground());                 if (color  != null) {             box.setBottomBorderColor(color);            this.jButtonBoxColorBottom.setBackground(color);            fireActionListenerActionPerformed(new java.awt.event.ActionEvent(this,0,""));          }    }//GEN-LAST:event_jButtonBoxColorBottomActionPerformed    private void jButtonBoxColorRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBoxColorRightActionPerformed        java.awt.Color color = javax.swing.JColorChooser.showDialog( null, "Select color...",         this.jButtonBoxColorRight.getBackground());                 if (color  != null) {             box.setRightBorderColor(color);            this.jButtonBoxColorRight.setBackground(color);            fireActionListenerActionPerformed(new java.awt.event.ActionEvent(this,0,""));          }    }//GEN-LAST:event_jButtonBoxColorRightActionPerformed    private void jButtonBoxColorTopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBoxColorTopActionPerformed         java.awt.Color color = javax.swing.JColorChooser.showDialog( null, "Select color...",         this.jButtonBoxColorTop.getBackground());                 if (color  != null) {             box.setTopBorderColor(color);            this.jButtonBoxColorTop.setBackground(color);            fireActionListenerActionPerformed(new java.awt.event.ActionEvent(this,0,""));          }    }//GEN-LAST:event_jButtonBoxColorTopActionPerformed    /**     * Registers ActionListener to receive events.     * @param listener The listener to register.     */    public synchronized void addActionListener(java.awt.event.ActionListener listener) {        if (listenerList == null ) {            listenerList = new javax.swing.event.EventListenerList();        }        listenerList.add (java.awt.event.ActionListener.class, listener);    }    /**     * Removes ActionListener from the list of listeners.     * @param listener The listener to remove.     */    public synchronized void removeActionListener(java.awt.event.ActionListener listener) {        listenerList.remove (java.awt.event.ActionListener.class, listener);    }    /**     * Notifies all registered listeners about the event.     *      * @param event The event to be fired     */    private void fireActionListenerActionPerformed(java.awt.event.ActionEvent event) {        if (listenerList == null) return;        Object[] listeners = listenerList.getListenerList ();        for (int i = listeners.length-2; i>=0; i-=2) {            if (listeners[i]==java.awt.event.ActionListener.class) {                ((java.awt.event.ActionListener)listeners[i+1]).actionPerformed (event);            }        }                if (samplePanel != null) samplePanel.setBox(box);    }    public Box getBox() {        return box;    }    public void setBox(Box box) {        this.box = box;        if (box == null) box = new Box();        init = true;                java.awt.Color c = box.getLeftBorderColor();        this.jButtonBoxColorLeft.setBackground( c );        this.jButtonBoxColorLeft.updateUI();                c = box.getTopBorderColor();        this.jButtonBoxColorTop.setBackground( c );        this.jButtonBoxColorTop.updateUI();                c = box.getRightBorderColor();        this.jButtonBoxColorRight.setBackground( c );        this.jButtonBoxColorRight.updateUI();                c = box.getBottomBorderColor();        this.jButtonBoxColorBottom.setBackground( c );        this.jButtonBoxColorBottom.updateUI();                jComboBoxLeft.setSelectedItem( box.getLeftBorder() );        jComboBoxRight.setSelectedItem( box.getRightBorder() );        jComboBoxTop.setSelectedItem( box.getTopBorder() );        jComboBoxBottom.setSelectedItem( box.getBottomBorder() );                jSpinnerBottom.setValue( new Integer(box.getBottomPadding() ));        jSpinnerTop.setValue( new Integer(box.getTopPadding() ));        jSpinnerLeft.setValue( new Integer(box.getLeftPadding() ));        jSpinnerRight.setValue( new Integer(box.getRightPadding() ));                if (samplePanel != null) samplePanel.setBox(box);        init = false;            }            // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JButton jButtonBoxColorBottom;    private javax.swing.JButton jButtonBoxColorLeft;    private javax.swing.JButton jButtonBoxColorRight;    private javax.swing.JButton jButtonBoxColorTop;    private javax.swing.JComboBox jComboBoxBottom;    private javax.swing.JComboBox jComboBoxLeft;    private javax.swing.JComboBox jComboBoxRight;    private javax.swing.JComboBox jComboBoxTop;    private javax.swing.JLabel jLabel3;    private javax.swing.JLabel jLabel4;    private javax.swing.JLabel jLabel5;    private javax.swing.JLabel jLabel6;    private javax.swing.JPanel jPanel1;    private javax.swing.JPanel jPanel2;    private javax.swing.JPanel jPanel3;    private javax.swing.JSpinner jSpinnerBottom;    private javax.swing.JSpinner jSpinnerLeft;    private javax.swing.JSpinner jSpinnerRight;    private javax.swing.JSpinner jSpinnerTop;    // End of variables declaration//GEN-END:variables    }

⌨️ 快捷键说明

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