jinlin
2025-03-21 77d58298d00c11ade8862ca8acb0fdef5a45322e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.example.client.utils;
 
import javax.swing.*;
import java.awt.*;
 
public class Compute {
    /*public static Integer ComputeHeight(Integer topHeight){
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        Rectangle rect = ge.getMaximumWindowBounds();
        Integer screenWidth = rect.width;
        Integer screenHeight = rect.height;
 
        Integer panelHeight = screenHeight - 50 - topHeight;
 
        return panelHeight;
    }
    public static Integer ComputeHeightWithScroll(Integer topHeight){
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        Rectangle rect = ge.getMaximumWindowBounds();
        Integer screenWidth = rect.width;
        Integer screenHeight = rect.height;
 
        Integer panelHeight = screenHeight - 50 - 30 - topHeight;
 
        return panelHeight;
    }*/
    public static Integer ComputeHeight(Integer topHeight, JFrame frame){
        int height = frame.getSize().height;
        Integer panelHeight = height - 65 - topHeight;
 
        return panelHeight;
    }
    public static Integer ComputeHeightWithScroll(Integer topHeight, JFrame frame){
        int height = frame.getSize().height;
        Integer panelHeight = height - 95 - topHeight;
 
        return panelHeight;
    }
}