예제 #1
0
파일: GUI.java 프로젝트: FruitOfLight/vida
 public static void refreshLayout() {
   int gw = frame.getContentPane().getWidth() - CONST.popupwidth;
   int gh = frame.getContentPane().getHeight() - CONST.menuHeight - CONST.controlsHeight;
   System.out.println("refreshLayout " + gw + " " + gh);
   layeredPane.setBounds(0, 0, frame.getContentPane().getWidth(), gh + CONST.menuHeight);
   menu.setBounds(0, 0, frame.getContentPane().getWidth(), CONST.menuHeight);
   player.graph.canvas.setLocation(0, CONST.menuHeight);
   player.graph.resizeCanvas(gw, gh);
   controls.panel.setBounds(
       0, gh + CONST.menuHeight, frame.getContentPane().getWidth(), CONST.controlsHeight);
   informationPanel.scrollPanel.setBounds(
       gw - CONST.informationWidth,
       CONST.menuHeight,
       CONST.informationWidth,
       gh - CONST.zoomWindowHeight);
   zoomWindow.canvas.setBounds(
       gw - CONST.zoomWindowWidth,
       CONST.menuHeight + gh - CONST.zoomWindowHeight,
       CONST.zoomWindowWidth,
       CONST.zoomWindowHeight);
   popupInformation.setBounds(gw, CONST.menuHeight, CONST.popupwidth, gh - CONST.zoomWindowHeight);
   popupZoomWindow.setBounds(
       gw,
       CONST.menuHeight + gh - CONST.zoomWindowHeight,
       CONST.popupwidth,
       CONST.zoomWindowHeight);
   controls.refresh();
   if (fitGraph) {
     player.graph.fitToScreen();
     fitGraph = false;
   }
   gRepaint();
 }
 public CFInternetSwingVersionListJPanel(
     ICFInternetSwingSchema argSchema,
     ICFLibAnyObj argContainer,
     ICFInternetVersionObj argFocus,
     Collection<ICFInternetVersionObj> argDataCollection,
     ICFJRefreshCallback refreshCallback,
     boolean sortByChain) {
   super();
   final String S_ProcName = "construct-schema-focus";
   if (argSchema == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 1, "argSchema");
   }
   // argFocus is optional; focus may be set later during execution as
   // conditions of the runtime change.
   swingSchema = argSchema;
   swingFocus = argFocus;
   swingContainer = argContainer;
   swingRefreshCallback = refreshCallback;
   swingSortByChain = sortByChain;
   setSwingDataCollection(argDataCollection);
   dataTable = new JTable(getDataModel(), getDataColumnModel(), getDataListSelectionModel());
   dataTable.addMouseListener(getDataListMouseAdapter());
   dataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   dataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
   dataTable.setUpdateSelectionOnSort(true);
   dataTable.setRowHeight(25);
   getDataListSelectionModel().addListSelectionListener(getDataListSelectionListener());
   dataScrollPane =
       new JScrollPane(
           dataTable,
           ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
           ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
   dataScrollPane.setColumnHeader(
       new JViewport() {
         @Override
         public Dimension getPreferredSize() {
           Dimension sz = super.getPreferredSize();
           sz.height = 25;
           return (sz);
         }
       });
   dataTable.setFillsViewportHeight(true);
   // Do initial layout
   setSize(1024, 480);
   JMenuBar menuBar = getPanelMenuBar();
   add(menuBar);
   menuBar.setBounds(0, 0, 1024, 25);
   add(dataScrollPane);
   dataScrollPane.setBounds(0, 25, 1024, 455);
   adjustListMenuBar();
   doLayout();
   swingIsInitializing = false;
 }
예제 #3
0
  /** Create the frame. */
  public TransitFrame() {
    setResizable(false);
    setBackground(new Color(153, 204, 255));
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 1280, 720);
    contentPane = new JPanel();
    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    this.setResizable(false); // 不可调整大小
    setIconImage(Toolkit.getDefaultToolkit().getImage("image/0010.jpg"));
    setTitle("快递物流系统");
    this.setSize(WIDTH, HEIGHT);
    ((JComponent) this.getContentPane()).setOpaque(true); // 不透明
    int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
    int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
    this.setLocation((screenWidth - WIDTH) >> 1, (screenHeight - HEIGHT) >> 1);

    bankpanel = new JPanel();
    bankpanel.setBounds(138, 125, 1152, 446);
    contentPane.add(bankpanel);
    bankpanel.setLayout(null);
    welcome = new welcomPanel();
    welcome.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
    welcome.setBounds(0, 0, 1152, 446);
    bankpanel.add(welcome);
    welcome.setLayout(null);

    JPanel panel =
        new JPanel() {
          public void paintComponent(Graphics g) {
            super.paintComponent(g);
            ImageIcon img = new ImageIcon("image/henfu.png");
            g.drawImage(img.getImage(), 0, 0, null);
          }
        };
    panel.setBounds(0, 0, 1280, 100);
    contentPane.add(panel);
    panel.setLayout(null);

    JLabel lblNewLabel_1 = new JLabel("");
    lblNewLabel_1.setBounds(168, 6, 865, 94);
    lblNewLabel_1.setIcon(
        new ImageIcon(
            "/Users/alice/Desktop/sec2-master-3/Project/ExpressSystem/client/image/image1.jpg"));
    panel.add(lblNewLabel_1);

    JLabel lblL = new JLabel();
    lblL.setBounds(1075, 280, 0, 0);
    panel.add(lblL);

    JPanel panel_1 = new JPanel();
    panel_1.setBorder(new EtchedBorder(EtchedBorder.RAISED, Color.LIGHT_GRAY, Color.LIGHT_GRAY));
    panel_1.setBounds(0, 100, 1280, 25);
    contentPane.add(panel_1);
    panel_1.setLayout(null);

    JMenuBar menuBar = new JMenuBar();
    menuBar.setBounds(6, 0, 132, 22);
    panel_1.add(menuBar);

    JMenu mnNewMenu = new JMenu("系统(S)");
    menuBar.add(mnNewMenu);

    JMenu mnf = new JMenu("功能(F)");
    menuBar.add(mnf);

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(new EtchedBorder(EtchedBorder.RAISED, Color.LIGHT_GRAY, Color.GRAY));
    panel_2.setBounds(0, 570, 350, 124);
    contentPane.add(panel_2);
    panel_2.setLayout(null);

    JLabel label = new JLabel("系统公告");
    label.setBounds(16, 6, 52, 16);
    panel_2.add(label);

    JLabel lblNewLabel = new JLabel("New label");
    lblNewLabel.setBounds(16, 106, 61, 16);
    panel_2.add(lblNewLabel);

    JPanel approve = new JPanel();
    approve.setBounds(347, 570, 933, 124);
    contentPane.add(approve);
    approve.setBorder(new EtchedBorder(EtchedBorder.RAISED, Color.LIGHT_GRAY, Color.GRAY));
    approve.setLayout(null);

    JButton button = new JButton("查看中转单");
    button.setBounds(560, 89, 117, 29);
    button.setVisible(false);
    approve.add(button);

    JButton button_1 = new JButton("查看到达单");
    button_1.setBounds(435, 89, 117, 29);
    button_1.setVisible(false);
    approve.add(button_1);

    JButton button_2 = new JButton("查看装车单");
    button_2.setBounds(689, 89, 117, 29);
    button_2.setVisible(false);
    approve.add(button_2);

    JButton btnNewButton = new JButton("录入到达单");
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            ArrivalNoteOnTransitPanel anot =
                new ArrivalNoteOnTransitPanel() {
                  public void paintComponent(Graphics g) {
                    super.paintComponent(g);
                    ImageIcon img = new ImageIcon("image/0111.jpg");
                    g.drawImage(img.getImage(), 0, 0, null);
                    float lineWidth = 3.0f;
                    ((Graphics2D) g).setStroke(new BasicStroke(lineWidth));
                    g.drawLine(768, 0, 768, 500);
                  }
                };
            anot.setBounds(0, 0, 1152, 446);
            bankpanel.removeAll();
            bankpanel.add(anot);
            bankpanel.repaint();
          }
        });
    btnNewButton.setBounds(0, 123, 140, 152);
    contentPane.add(btnNewButton);

    JButton btnNewButton_1 = new JButton("录入中转单");
    btnNewButton_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            TransitNoteInputPanel tni =
                new TransitNoteInputPanel() {
                  public void paintComponent(Graphics g) {
                    super.paintComponent(g);
                    ImageIcon img = new ImageIcon("image/0111.jpg");
                    g.drawImage(img.getImage(), 0, 0, null);
                    float lineWidth = 3.0f;
                    ((Graphics2D) g).setStroke(new BasicStroke(lineWidth));
                    g.drawLine(768, 0, 768, 500);
                  }
                };
            tni.setBounds(0, 0, 1152, 446);
            bankpanel.removeAll();
            bankpanel.add(tni);
            bankpanel.repaint();
          }
        });
    btnNewButton_1.setBounds(0, 272, 140, 152);
    contentPane.add(btnNewButton_1);

    JButton btnNewButton_2 = new JButton("录入装车单");
    btnNewButton_2.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            LoadNoteOnTransitPanel lnot =
                new LoadNoteOnTransitPanel() {
                  public void paintComponent(Graphics g) {
                    super.paintComponent(g);
                    ImageIcon img = new ImageIcon("image/0111.jpg");
                    g.drawImage(img.getImage(), 0, 0, null);
                    float lineWidth = 3.0f;
                    ((Graphics2D) g).setStroke(new BasicStroke(lineWidth));
                    g.drawLine(768, 0, 768, 500);
                  }
                };
            lnot.setBounds(0, 0, 1152, 446);
            bankpanel.removeAll();
            bankpanel.add(lnot);
            bankpanel.repaint();
          }
        });
    btnNewButton_2.setBounds(0, 420, 140, 152);
    contentPane.add(btnNewButton_2);
  }