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

📄 sampleboxpanel.java

📁 iReport-0.4.1-src是iReport的源代码,iReport是一个开源的报表项目,可以生成PDF等格式报表
💻 JAVA
字号:
/* * SampleBoxPanel.java * * Created on 29 novembre 2004, 18.16 */package it.businesslogic.ireport.gui.box;import it.businesslogic.ireport.*;import java.awt.*;/** * * @author  Administrator */public class SampleBoxPanel extends javax.swing.JPanel {        private Box box;        /** Creates new form SampleBoxPanel */    public SampleBoxPanel() {        initComponents();        this.setBackground(Color.WHITE);        setBox(new Box());    }    public Box getBox() {        return box;    }    public void setBox(Box box) {        this.box = box;        this.invalidate();        this.repaint();    }        public void refresh() {        this.invalidate();        this.repaint();    }        public void paint(Graphics g2)    {        Graphics2D g = (Graphics2D)g2;        g.clearRect(0,0,this.getWidth(),this.getHeight());        g.setColor( Color.LIGHT_GRAY);        Stroke oldStroke = g.getStroke();        Color oldColor  = g.getColor();        g.fillRect(10, 10, this.getWidth()-20, this.getHeight()-20);                if (!getBox().getLeftBorder().equals("None"))        {            Stroke stroke = ReportElement.getPenStroke( getBox().getLeftBorder(), 1.0);            g.setStroke(stroke);            g.setColor(getBox().getLeftBorderColor());            g.drawLine(10, 10, 10, this.getHeight()-10);        }                if (!getBox().getRightBorder().equals("None"))        {            Stroke stroke = ReportElement.getPenStroke( getBox().getRightBorder(), 1.0);            g.setStroke(stroke);            g.setColor(getBox().getRightBorderColor());            g.drawLine(this.getWidth()-10, 10, this.getWidth()-10, this.getHeight()-10);        }                if (!getBox().getTopBorder().equals("None"))        {            Stroke stroke = ReportElement.getPenStroke( getBox().getTopBorder(), 1.0);            g.setStroke(stroke);            g.setColor(getBox().getTopBorderColor());            g.drawLine(10, 10, this.getWidth()-10, 10);        }                if (!getBox().getBottomBorder().equals("None"))        {            Stroke stroke = ReportElement.getPenStroke( getBox().getBottomBorder(), 1.0);            g.setStroke(stroke);            g.setColor(getBox().getBottomBorderColor());            g.drawLine(10, this.getHeight()-10, this.getWidth()-10, this.getHeight()-10);        }                g.setColor(oldColor);        g.setStroke(oldStroke);    }            /** 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.     */    private void initComponents() {//GEN-BEGIN:initComponents        setLayout(new java.awt.BorderLayout());    }//GEN-END:initComponents            // Variables declaration - do not modify//GEN-BEGIN:variables    // End of variables declaration//GEN-END:variables    }

⌨️ 快捷键说明

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