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

📄 formatlayout.java

📁 JCommon is a Java class library that is used by JFreeChart, Pentaho Reporting and a few other projec
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                        c5 = parent.getComponent(componentIndex + 5);
                        updateLCBLCB(rowIndex,
                                     c0.getPreferredSize(),
                                     c1.getPreferredSize(),
                                     c2.getPreferredSize(),
                                     c3.getPreferredSize(),
                                     c4.getPreferredSize(),
                                     c5.getPreferredSize());
                        componentIndex = componentIndex + 6;
                        break;
                }
            }
            complete();

            componentIndex = 0;
            int rowY = insets.top;
            final int[] rowX = new int[6];
            rowX[0] = insets.left;
            rowX[1] = rowX[0] + this.columnWidths[0] + this.columnGaps[0];
            rowX[2] = rowX[1] + this.columnWidths[1] + this.columnGaps[1];
            rowX[3] = rowX[2] + this.columnWidths[2] + this.columnGaps[2];
            rowX[4] = rowX[3] + this.columnWidths[3] + this.columnGaps[3];
            rowX[5] = rowX[4] + this.columnWidths[4] + this.columnGaps[4];
            final int w1to2 = this.columnWidths[1] + this.columnGaps[1] 
                              + this.columnWidths[2];
            final int w4to5 = this.columnWidths[4] + this.columnGaps[4] 
                              + this.columnWidths[5];
            final int w1to4 = w1to2 + this.columnGaps[2] + this.columnWidths[3]
                        + this.columnGaps[3] + this.columnWidths[4];
            final int w1to5 = w1to4 + this.columnGaps[4] + this.columnWidths[5];
            final int w0to5 = w1to5 + this.columnWidths[0] + this.columnGaps[0];
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
                final int format 
                    = this.rowFormats[rowIndex % this.rowFormats.length];

                switch (format) {
                case FormatLayout.C:
                    c0 = parent.getComponent(componentIndex);
                    c0.setBounds(rowX[0], rowY, w0to5, 
                            c0.getPreferredSize().height);
                    componentIndex = componentIndex + 1;
                    break;
                case FormatLayout.LC:
                    c0 = parent.getComponent(componentIndex);
                    c0.setBounds(
                        rowX[0],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height
                    );
                    c1 = parent.getComponent(componentIndex + 1);
                    c1.setBounds(
                        rowX[1],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c1.getPreferredSize().height) / 2,
                        w1to5, c1.getPreferredSize().height
                    );
                    componentIndex = componentIndex + 2;
                    break;
                case FormatLayout.LCB:
                    c0 = parent.getComponent(componentIndex);
                    c0.setBounds(
                        rowX[0],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height
                    );
                    c1 = parent.getComponent(componentIndex + 1);
                    c1.setBounds(
                        rowX[1],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c1.getPreferredSize().height) / 2,
                        w1to4, c1.getPreferredSize().height
                    );
                    c2 = parent.getComponent(componentIndex + 2);
                    c2.setBounds(
                        rowX[5],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c2.getPreferredSize().height) / 2,
                        this.columnWidths[5], c2.getPreferredSize().height
                    );
                    componentIndex = componentIndex + 3;
                    break;
                case FormatLayout.LCLC:
                    c0 = parent.getComponent(componentIndex);
                    c0.setBounds(
                        rowX[0],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height
                    );
                    c1 = parent.getComponent(componentIndex + 1);
                    c1.setBounds(
                        rowX[1],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c1.getPreferredSize().height) / 2,
                        w1to2, c1.getPreferredSize().height
                    );
                    c2 = parent.getComponent(componentIndex + 2);
                    c2.setBounds(
                        rowX[3],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c2.getPreferredSize().height) / 2,
                        this.columnWidths[3], c2.getPreferredSize().height
                    );
                    c3 = parent.getComponent(componentIndex + 3);
                    c3.setBounds(
                        rowX[4],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c3.getPreferredSize().height) / 2,
                        w4to5, c3.getPreferredSize().height
                    );
                    componentIndex = componentIndex + 4;
                    break;
                case FormatLayout.LCBLC:
                    c0 = parent.getComponent(componentIndex);
                    c0.setBounds(
                        rowX[0],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height
                    );
                    c1 = parent.getComponent(componentIndex + 1);
                    c1.setBounds(
                        rowX[1],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c1.getPreferredSize().height) / 2,
                        this.columnWidths[1], c1.getPreferredSize().height
                    );
                    c2 = parent.getComponent(componentIndex + 2);
                    c2.setBounds(
                        rowX[2],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c2.getPreferredSize().height) / 2,
                        this.columnWidths[2], c2.getPreferredSize().height
                    );
                    c3 = parent.getComponent(componentIndex + 3);
                    c3.setBounds(
                        rowX[3],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c3.getPreferredSize().height) / 2,
                        this.columnWidths[3], c3.getPreferredSize().height
                    );
                    c4 = parent.getComponent(componentIndex + 4);
                    c4.setBounds(
                        rowX[4],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c4.getPreferredSize().height) / 2,
                        w4to5, c4.getPreferredSize().height
                    );
                    componentIndex = componentIndex + 5;
                    break;
                case FormatLayout.LCLCB:
                    c0 = parent.getComponent(componentIndex);
                    c0.setBounds(
                        rowX[0],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height
                    );
                    c1 = parent.getComponent(componentIndex + 1);
                    c1.setBounds(
                        rowX[1],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c1.getPreferredSize().height) / 2,
                        w1to2, c1.getPreferredSize().height
                    );
                    c2 = parent.getComponent(componentIndex + 2);
                    c2.setBounds(
                        rowX[3],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c2.getPreferredSize().height) / 2,
                        this.columnWidths[3], c2.getPreferredSize().height
                    );
                    c3 = parent.getComponent(componentIndex + 3);
                    c3.setBounds(
                        rowX[4],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c3.getPreferredSize().height) / 2,
                        this.columnWidths[4], c3.getPreferredSize().height
                    );
                    c4 = parent.getComponent(componentIndex + 4);
                    c4.setBounds(
                        rowX[5],
                        rowY + (this.rowHeights[rowIndex] 
                                    - c4.getPreferredSize().height) / 2,
                        this.columnWidths[5], c4.getPreferredSize().height
                    );
                    componentIndex = componentIndex + 5;
                    break;
                case FormatLayout.LCBLCB:
                    c0 = parent.getComponent(componentIndex);
                    c0.setBounds(
                        rowX[0],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c0.getPreferredSize().height) / 2,
                        this.columnWidths[0], c0.getPreferredSize().height
                    );
                    c1 = parent.getComponent(componentIndex + 1);
                    c1.setBounds(
                        rowX[1],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c1.getPreferredSize().height) / 2,
                        this.columnWidths[1], c1.getPreferredSize().height
                    );
                    c2 = parent.getComponent(componentIndex + 2);
                    c2.setBounds(
                        rowX[2],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c2.getPreferredSize().height) / 2,
                        this.columnWidths[2], c2.getPreferredSize().height
                    );
                    c3 = parent.getComponent(componentIndex + 3);
                    c3.setBounds(
                        rowX[3],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c3.getPreferredSize().height) / 2,
                        this.columnWidths[3], c3.getPreferredSize().height
                    );
                    c4 = parent.getComponent(componentIndex + 4);
                    c4.setBounds(
                        rowX[4],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c4.getPreferredSize().height) / 2,
                        this.columnWidths[4], c4.getPreferredSize().height
                    );
                    c5 = parent.getComponent(componentIndex + 5);
                    c5.setBounds(
                        rowX[5],
                        rowY + (this.rowHeights[rowIndex] 
                                     - c5.getPreferredSize().height) / 2,
                        this.columnWidths[5], c5.getPreferredSize().height
                    );
                    componentIndex = componentIndex + 6;
                    break;
                    }
                rowY = rowY + this.rowHeights[rowIndex] + this.rowGap;
            }
        }
    }

    /**
     * Processes a row in 'C' format.
     *
     * @param rowIndex  the row index.
     * @param d0  dimension 0.
     */
    protected void updateC(final int rowIndex, final Dimension d0) {
        this.rowHeights[rowIndex] = d0.height;
        this.totalHeight = this.totalHeight + this.rowHeights[rowIndex];
        this.columns0to5Width = Math.max(this.columns0to5Width, d0.width);
    }

    /**
     * Processes a row in 'LC' format.
     *
     * @param rowIndex  the row index.
     * @param d0  dimension 0.
     * @param d1  dimension 1.
     */
    protected void updateLC(final int rowIndex, final Dimension d0, 
                            final Dimension d1) {

⌨️ 快捷键说明

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