|
|
@@ -1089,7 +1089,8 @@ public class MesClient extends JFrame {
|
|
|
finish_ng_bt.setEnabled(false);
|
|
|
// indexPanelA.add(finish_ng_bt);
|
|
|
|
|
|
- tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexScrollPaneA, null);
|
|
|
+ centerPanelChildren(indexPanelA, 1024, 550);
|
|
|
+ tabbedPane.addTab("工作面板", new ImageIcon(MesClient.class.getResource("/bg/a_side.png")), indexPanelA, null);
|
|
|
tabbedPane.setEnabledAt(0, true);
|
|
|
|
|
|
indexPanelC = new JPanel();
|
|
|
@@ -1259,14 +1260,23 @@ public class MesClient extends JFrame {
|
|
|
JScrollPane scrollPane = new JScrollPane(table);
|
|
|
panel.add(scrollPane);
|
|
|
|
|
|
- tabbedPane.addTab("记录查询", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPaneDj, null);
|
|
|
+ indexPanelC.addComponentListener(new ComponentAdapter() {
|
|
|
+ @Override
|
|
|
+ public void componentResized(ComponentEvent e) {
|
|
|
+ panel.setBounds(0, 49, indexPanelC.getWidth(), Math.max(0, indexPanelC.getHeight() - 49));
|
|
|
+ panel.revalidate();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ tabbedPane.addTab("记录查询", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexPanelC, null);
|
|
|
|
|
|
// 开班点检Tab页面
|
|
|
indexPanelC = new JPanel();
|
|
|
searchScrollPane = new JScrollPane(indexPanelC);
|
|
|
- indexPanelC.setLayout(null);
|
|
|
+ // 作为 Tab 直接显示,使用 BorderLayout 让登录后加入的 WebView 自动铺满。
|
|
|
+ indexPanelC.setLayout(new BorderLayout());
|
|
|
|
|
|
- tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), searchScrollPane, null);
|
|
|
+ tabbedPane.addTab("开班点检", new ImageIcon(MesClient.class.getResource("/bg/menu_data_preprocess.png")), indexPanelC, null);
|
|
|
|
|
|
|
|
|
indexPanelD = new JPanel();
|
|
|
@@ -1639,7 +1649,8 @@ public class MesClient extends JFrame {
|
|
|
lineSn.setBounds(762, 195, 200, 30);
|
|
|
indexPanelD.add(lineSn);
|
|
|
|
|
|
- tabbedPane.addTab("软件设置", new ImageIcon(MesClient.class.getResource("/bg/menu_setting.png")), searchScrollPaneD, null);
|
|
|
+ centerPanelChildren(indexPanelD, 972, 520);
|
|
|
+ tabbedPane.addTab("软件设置", new ImageIcon(MesClient.class.getResource("/bg/menu_setting.png")), indexPanelD, null);
|
|
|
tabbedPane.addChangeListener(new ChangeListener() {
|
|
|
@Override
|
|
|
public void stateChanged(ChangeEvent e) {
|
|
|
@@ -1653,6 +1664,30 @@ public class MesClient extends JFrame {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private static void centerPanelChildren(JPanel panel, int designWidth, int designHeight) {
|
|
|
+ for (Component child : panel.getComponents()) {
|
|
|
+ if (child instanceof JComponent) {
|
|
|
+ ((JComponent) child).putClientProperty("mes.baseBounds", child.getBounds());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ panel.addComponentListener(new ComponentAdapter() {
|
|
|
+ @Override
|
|
|
+ public void componentResized(ComponentEvent e) {
|
|
|
+ int offsetX = Math.max(0, (panel.getWidth() - designWidth) / 2);
|
|
|
+ int offsetY = Math.max(0, (panel.getHeight() - designHeight) / 2);
|
|
|
+ for (Component child : panel.getComponents()) {
|
|
|
+ Rectangle base = child instanceof JComponent
|
|
|
+ ? (Rectangle) ((JComponent) child).getClientProperty("mes.baseBounds") : null;
|
|
|
+ if (base != null) {
|
|
|
+ child.setBounds(base.x + offsetX, base.y + offsetY, base.width, base.height);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ panel.revalidate();
|
|
|
+ panel.repaint();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
public static void setMenuStatus(String msg,int error){
|
|
|
if(error == 0){
|
|
|
MesClient.status_menu.setForeground(Color.GREEN);
|