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

📄 tablelayout.java

📁 人力资源管理系统主要包括:人员管理、招聘管理、培训管理、奖惩管理和薪金管理五大管理模块。
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        for (counter = 0; counter < columnSpec.length; counter++)            if ((columnSpec[counter] > 0.0) && (columnSpec[counter] < 1.0))                fillWidthRatio -= columnSpec[counter];            else if (columnSpec[counter] == FILL)                numFillWidth++;        for (counter = 0; counter < rowSpec.length; counter++)            if ((rowSpec[counter] > 0.0) && (rowSpec[counter] < 1.0))                fillHeightRatio -= rowSpec[counter];            else if (rowSpec[counter] == FILL)                numFillHeight++;        // Adjust fill ratios to reflect number of fill rows/columns        if (numFillWidth > 1)            fillWidthRatio /= numFillWidth;        if (numFillHeight > 1)            fillHeightRatio /= numFillHeight;        // Cap fill ratio bottoms to 0.0        if (fillWidthRatio < 0.0)            fillWidthRatio = 0.0;        if (fillHeightRatio < 0.0)            fillHeightRatio = 0.0;        // Calculate preferred/minimum column widths        int columnPrefMin[] = new int[columnSpec.length];        for (counter = 0; counter < columnSpec.length; counter++)            // Is the current column a preferred/minimum size            if ((columnSpec[counter] == PREFERRED) ||                (columnSpec[counter] == MINIMUM))                {                    // Assume a maximum width of zero                    int maxWidth = 0;                    // Find maximum preferred/minimum width of all components completely                    // contained within this column                    ListIterator iterator = list.listIterator(0);                    while (iterator.hasNext())                        {                            Entry entry = (Entry) iterator.next();                                            if ((entry.col1 == counter) && (entry.col2 == counter))                                {                                    Dimension p = (columnSpec[counter] == PREFERRED) ?                                        entry.component.getPreferredSize() :                                        entry.component.getMinimumSize();                                    int width = (p == null) ? 0 : p.width;                                    if (maxWidth < width)                                        maxWidth = width;                                }                        }                    // Set column's preferred/minimum width                    columnPrefMin[counter] = maxWidth;                }        // Calculate preferred/minimum row heights        int rowPrefMin[] = new int[rowSpec.length];        for (counter = 0; counter < rowSpec.length; counter++)            // Is the current row a preferred/minimum size            if ((rowSpec[counter] == PREFERRED) ||                (rowSpec[counter] == MINIMUM))                {                    // Assume a maximum height of zero                    int maxHeight = 0;                    // Find maximum preferred height of all components completely                    // contained within this row                    ListIterator iterator = list.listIterator(0);                    while (iterator.hasNext())                        {                            Entry entry = (Entry) iterator.next();                                            if ((entry.row1 == counter) && (entry.row1 == counter))                                {                                    Dimension p = (rowSpec[counter] == PREFERRED) ?                                        entry.component.getPreferredSize() :                                        entry.component.getMinimumSize();                                    int height = (p == null) ? 0 : p.height;                                    if (maxHeight < height)                                        maxHeight = height;                                }                        }                    // Add preferred height                    rowPrefMin[counter] += maxHeight;                }        // Find maximum preferred size of all scaled components        ListIterator iterator = list.listIterator(0);            while (iterator.hasNext())            {                // Get next entry                Entry entry = (Entry) iterator.next();                // Make sure entry is in valid rows and columns                if ((entry.col1 < 0) || (entry.col1 >= columnSpec.length) ||                    (entry.col2 >= columnSpec.length) ||                    (entry.row1 < 0) || (entry.row1 >= rowSpec.length)    ||                    (entry.row2 >= rowSpec.length))                    {                        // Skip the bad component                        continue;                    }                // Get preferred size of current component                size = entry.component.getPreferredSize();                // Calculate portion of component that is not absolutely sized                int scalableWidth = size.width;                int scalableHeight = size.height;                for (counter = entry.col1; counter <= entry.col2; counter++)                    if (columnSpec[counter] >= 1.0)                        scalableWidth -= columnSpec[counter];                    else if ((columnSpec[counter] == PREFERRED) ||                             (columnSpec[counter] == MINIMUM))                        {                            scalableWidth -= columnPrefMin[counter];                        }                for (counter = entry.row1; counter <= entry.row2; counter++)                    if (rowSpec[counter] >= 1.0)                        scalableHeight -= rowSpec[counter];                    else if ((rowSpec[counter] == PREFERRED) ||                             (rowSpec[counter] == MINIMUM))                        {                            scalableHeight -= rowPrefMin[counter];                        }                //----------------------------------------------------------------------                // Determine total percentage of scalable space that the component                // occupies by adding the relative columns and the fill columns                double relativeWidth = 0.0;                for (counter = entry.col1; counter <= entry.col2; counter++)                    {                        // Column is scaled                        if ((columnSpec[counter] > 0.0) && (columnSpec[counter] < 1.0))                            // Add scaled size to relativeWidth                            relativeWidth += columnSpec[counter];                        // Column is fill                        else if ((columnSpec[counter] == FILL) && (fillWidthRatio != 0.0))                            // Add fill size to relativeWidth                            relativeWidth += fillWidthRatio;                    }                // Determine the total scaled width as estimated by this component                if (relativeWidth == 0)                    temp = 0;                else                    temp = (int) (scalableWidth / relativeWidth + 0.5);                // If the container needs to be bigger, make it so                if (scaledWidth < temp)                    scaledWidth = temp;                //----------------------------------------------------------------------                // Determine total percentage of scalable space that the component                // occupies by adding the relative columns and the fill columns                double relativeHeight = 0.0;                for (counter = entry.row1; counter <= entry.row2; counter++)                    {                        // Row is scaled                        if ((rowSpec[counter] > 0.0) && (rowSpec[counter] < 1.0))                            // Add scaled size to relativeHeight                            relativeHeight += rowSpec[counter];                        // Row is fill                        else if ((rowSpec[counter] == FILL) && (fillHeightRatio != 0.0))                            // Add fill size to relativeHeight                            relativeHeight += fillHeightRatio;                    }                // Determine the total scaled width as estimated by this component                if (relativeHeight == 0)                    temp = 0;                else                    temp = (int) (scalableHeight / relativeHeight + 0.5);                // If the container needs to be bigger, make it so                if (scaledHeight < temp)                    scaledHeight = temp;            }        // totalWidth is the scaledWidth plus the sum of all absolute widths and all        // preferred widths        int totalWidth = scaledWidth;        for (counter = 0; counter < columnSpec.length; counter++)            // Is the current column an absolute size            if (columnSpec[counter] >= 1.0)                totalWidth += (int) (columnSpec[counter] + 0.5);        // Is the current column a preferred/minimum size            else if ((columnSpec[counter] == PREFERRED) ||                     (columnSpec[counter] == MINIMUM))                {                    // Add preferred/minimum width                    totalWidth += columnPrefMin[counter];                }        // totalHeight is the scaledHeight plus the sum of all absolute heights and        // all preferred widths        int totalHeight = scaledHeight;        for (counter = 0; counter < rowSpec.length; counter++)            // Is the current row an absolute size            if (rowSpec[counter] >= 1.0)                totalHeight += (int) (rowSpec[counter] + 0.5);        // Is the current row a preferred size            else if ((rowSpec[counter] == PREFERRED) ||                     (rowSpec[counter] == MINIMUM))                {                    // Add preferred/minimum width                    totalHeight += rowPrefMin[counter];                }        // Compensate for container's insets        Insets inset = container.getInsets();        totalWidth += inset.left + inset.right;        totalHeight += inset.top + inset.bottom;        return new Dimension(totalWidth, totalHeight);    }    /**     * Determines the minimum size of the container argument using this layout.     * The minimum size is the smallest size that, if used for the container's     * size, will ensure that all components are at least as large as their     * minimum size.  This method cannot guarantee that all components will be     * their minimum size.  For example, if component A and component B are each     * allocate half of the container's width and component A wants to be 10 pixels     * wide while component B wants to be 100 pixels wide, they cannot both be     * accommodated.  Since in general components rather be larger than their     * minimum size instead of smaller, component B's request will be fulfilled.     * The minimum size of the container would be 200 pixels.     *     * @param container    container being served by this layout manager     *     * @return a dimension indicating the container's minimum size     */    public Dimension minimumLayoutSize (Container container)    {        Dimension size;       // Minimum size of current component        int scaledWidth = 0;  // Minimum width of scalled components        int scaledHeight = 0; // Minimum height of scalled components        int fillWidth = 0;    // Minimum width of fill components        int fillHeight = 0;   // Minimum height of fill components        int temp;             // Temporary variable used to compare sizes        int counter;          // Counting variable        // Determine percentage of space allocated to fill components.  This is        // one minus the sum of all scalable components.        double fillWidthRatio = 1.0;        double fillHeightRatio = 1.0;        int    numFillWidth = 0;        int    numFillHeight = 0;        for (counter = 0; counter < columnSpec.length; counter++)            if ((columnSpec[counter] > 0.0) && (columnSpec[counter] < 1.0))                fillWidthRatio -= columnSpec[counter];            else if (columnSpec[counter] == FILL)                numFillWidth++;        for (counter = 0; counter < rowSpec.length; counter++)            if ((rowSpec[counter] > 0.0) && (rowSpec[counter] < 1.0))                fillHeightRatio -= rowSpec[counter];            else if (rowSpec[counter] == FILL)                numFillHeight++;        // Adjust fill ratios to reflect number of fill rows/columns        if (numFillWidth > 1)            fillWidthRatio /= numFillWidth;        if (numFillHeight > 1)            fillHeightRatio /= numFillHeight;        // Cap fill ratio bottoms to 0.0        if (fillWidthRatio < 0.0)            fillWidthRatio = 0.0;        if (fillHeightRatio < 0.0)            fillHeightRatio = 0.0;        // Find maximum minimum size of all scaled components        ListIterator iterator = list.listIterator(0);            while (iterator.hasNext())            {                // Get next entry                Entry entry = (Entry) iterator.next();                // Make sure entry is in valid rows and columns                if ((entry.col1 < 0) || (entry.col1 >= columnSpec.length) ||                    (entry.col2 >= columnSpec.length) ||                    (entry.row1 < 0) || (entry.row1 >= rowSpec.length)    ||                    (entry.row2 >= rowSpec.length))                    {                        // Skip the bad component                        continue;                    }                // Get minimum size of current component                size = entry.component.getMinimumSize();                // Calculate portion of component that is not absolutely sized                int scalableWidth = size.width;                int scalableHeight = size.height;                for (counter = entry.col1; counter <= entry.col2; counter++)                    if (columnSpec[counter] >= 1.0)                        scalableWidth -= columnSpec[counter];                for (counter = entry.row1; counter <= entry.row2; counter++)                    if (rowSpec[counter] >= 1.0)                        scalableHeight -= rowSpec[counter];                //----------------------------------------------------------------------                // Determine total percentage of scalable space that the component                // occupies by adding the relative columns and the fill columns                double relativeWidth = 0.0;                for (counter = entry.col1; counter <= entry.col2; counter++)                    {                        // Column is scaled                        if ((columnSpec[counter] > 0.0) && (columnSpec[counter] < 1.0))                            // Add scaled size to relativeWidth                            relativeWidth += columnSpec[counter];                        // Column is fill                        else if ((columnSpec[counter] == FILL) && (fillWidthRatio != 0.0))                            // Add fill size to relativeWidth                            relativeWidth += fillWidthRatio;                    }                // Determine the total scaled width as estimated by this component                if (relativeWidth == 0)                    temp = 0;                else                    temp = (int) (scalableWidth / relativeWidth + 0.5);                // If

⌨️ 快捷键说明

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