|
|
@@ -89,6 +89,12 @@ public class MesClient extends JFrame {
|
|
|
private static final int WELD_PAGE2_END = 126; // 70-1..90,共29个
|
|
|
// page3: 126..180 = 91-1..109,共54个
|
|
|
|
|
|
+ // 焊缝编号按钮:放大字号后减少列数、固定行高,避免文字被挤或整页被纵向拉乱
|
|
|
+ private static final int WELD_GRID_COLS = 8;
|
|
|
+ private static final int WELD_GRID_HGAP = 8;
|
|
|
+ private static final int WELD_GRID_VGAP = 8;
|
|
|
+ private static final Dimension WELD_BTN_SIZE = new Dimension(112, 48);
|
|
|
+
|
|
|
public static String user20 = "";
|
|
|
|
|
|
public static JFrame welcomeWin;
|
|
|
@@ -562,11 +568,7 @@ public class MesClient extends JFrame {
|
|
|
centerPanel1.setLayout(new BorderLayout(10, 10));
|
|
|
centerPanel1.setBorder(new EmptyBorder(10, 20, 10, 20));
|
|
|
|
|
|
- JPanel weldPanel1 = new JPanel();
|
|
|
- weldPanel1.setLayout(new GridLayout(0, 10, 6, 6));
|
|
|
- weldPanel1.setOpaque(false);
|
|
|
- addWeldButtonsToPanel(weldPanel1, 0, WELD_PAGE1_END);
|
|
|
- centerPanel1.add(weldPanel1, BorderLayout.CENTER);
|
|
|
+ centerPanel1.add(createWeldGridPanel(0, WELD_PAGE1_END, new Insets(0, 0, 0, 0)), BorderLayout.CENTER);
|
|
|
|
|
|
fxlabel = new JLabel("该工件为返修件,请仔细检查");
|
|
|
fxlabel.setFont(new Font("微软雅黑", Font.PLAIN, 38));
|
|
|
@@ -601,12 +603,7 @@ public class MesClient extends JFrame {
|
|
|
JScrollPane indexScrollPaneA2 = new JScrollPane(indexPanelA2);
|
|
|
indexPanelA2.setLayout(new BorderLayout(10, 10));
|
|
|
|
|
|
- JPanel weldPanel2 = new JPanel();
|
|
|
- weldPanel2.setLayout(new GridLayout(0, 10, 6, 6));
|
|
|
- weldPanel2.setOpaque(false);
|
|
|
- weldPanel2.setBorder(new EmptyBorder(20, 20, 20, 20));
|
|
|
- addWeldButtonsToPanel(weldPanel2, WELD_PAGE1_END, WELD_PAGE2_END);
|
|
|
- indexPanelA2.add(weldPanel2, BorderLayout.CENTER);
|
|
|
+ indexPanelA2.add(createWeldGridPanel(WELD_PAGE1_END, WELD_PAGE2_END, new Insets(20, 20, 20, 20)), BorderLayout.CENTER);
|
|
|
|
|
|
JPanel bottomPanel2 = new JPanel();
|
|
|
bottomPanel2.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
|
|
|
@@ -642,12 +639,7 @@ public class MesClient extends JFrame {
|
|
|
JScrollPane indexScrollPaneA3 = new JScrollPane(indexPanelA3);
|
|
|
indexPanelA3.setLayout(new BorderLayout(10, 10));
|
|
|
|
|
|
- JPanel weldPanel3 = new JPanel();
|
|
|
- weldPanel3.setLayout(new GridLayout(0, 10, 6, 6));
|
|
|
- weldPanel3.setOpaque(false);
|
|
|
- weldPanel3.setBorder(new EmptyBorder(20, 20, 20, 20));
|
|
|
- addWeldButtonsToPanel(weldPanel3, WELD_PAGE2_END, WELD_LABELS.length);
|
|
|
- indexPanelA3.add(weldPanel3, BorderLayout.CENTER);
|
|
|
+ indexPanelA3.add(createWeldGridPanel(WELD_PAGE2_END, WELD_LABELS.length, new Insets(20, 20, 20, 20)), BorderLayout.CENTER);
|
|
|
|
|
|
JPanel bottomPanel3 = new JPanel();
|
|
|
bottomPanel3.setLayout(new FlowLayout(FlowLayout.CENTER, 20, 10));
|
|
|
@@ -738,11 +730,11 @@ public class MesClient extends JFrame {
|
|
|
tabbedPane.setEnabledAt(1, true);
|
|
|
tabbedPane.setEnabledAt(2, true);
|
|
|
|
|
|
- indexPanelC = new JPanel();
|
|
|
+ indexPanelC = new JPanel(new BorderLayout());
|
|
|
searchScrollPaneDj = new JScrollPane(indexPanelC);
|
|
|
- indexPanelC.setLayout(null);
|
|
|
+ searchScrollPaneDj.setBorder(null);
|
|
|
|
|
|
- tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
|
|
|
+ tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexPanelC, null);
|
|
|
|
|
|
// ========== 工作记录 Tab(当前工位 + 所有工位) ==========
|
|
|
JTabbedPane workRecordTabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
|
@@ -1018,6 +1010,21 @@ public class MesClient extends JFrame {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 焊缝编号网格:贴顶排列,高度随行数走,避免按钮被纵向拉得过大。
|
|
|
+ */
|
|
|
+ private JPanel createWeldGridPanel(int start, int end, Insets border) {
|
|
|
+ JPanel weldPanel = new JPanel(new GridLayout(0, WELD_GRID_COLS, WELD_GRID_HGAP, WELD_GRID_VGAP));
|
|
|
+ weldPanel.setOpaque(false);
|
|
|
+ weldPanel.setBorder(new EmptyBorder(border));
|
|
|
+ addWeldButtonsToPanel(weldPanel, start, end);
|
|
|
+
|
|
|
+ JPanel wrap = new JPanel(new BorderLayout());
|
|
|
+ wrap.setOpaque(false);
|
|
|
+ wrap.add(weldPanel, BorderLayout.NORTH);
|
|
|
+ return wrap;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 批量添加焊缝按钮到指定面板,文案使用 WELD_LABELS
|
|
|
*/
|
|
|
private void addWeldButtonsToPanel(JPanel panel, int start, int end) {
|
|
|
@@ -1027,7 +1034,17 @@ public class MesClient extends JFrame {
|
|
|
String label = WELD_LABELS[i];
|
|
|
|
|
|
weldButtons[i] = new JButton(label);
|
|
|
- weldButtons[i].setFont(new Font("微软雅黑", Font.PLAIN, 12));
|
|
|
+ int fontSize = 20;
|
|
|
+ if (label.length() >= 5) {
|
|
|
+ fontSize = 16;
|
|
|
+ } else if (label.length() >= 3) {
|
|
|
+ fontSize = 18;
|
|
|
+ }
|
|
|
+ weldButtons[i].setFont(new Font("微软雅黑", Font.BOLD, fontSize));
|
|
|
+ weldButtons[i].setMargin(new Insets(2, 2, 2, 2));
|
|
|
+ weldButtons[i].setPreferredSize(WELD_BTN_SIZE);
|
|
|
+ weldButtons[i].setMinimumSize(WELD_BTN_SIZE);
|
|
|
+ weldButtons[i].setFocusPainted(false);
|
|
|
weldButtons[i].setEnabled(false);
|
|
|
weldButtons[i].setToolTipText("焊缝" + label);
|
|
|
|