示例#1
0
文件: Apps.java 项目: dpharris/JMRI
  /**
   * Fill in the logo and status panel
   *
   * @return Properly-filled out JPanel
   */
  protected JPanel statusPanel() {
    JPanel pane1 = new JPanel();
    pane1.setLayout(new BoxLayout(pane1, BoxLayout.X_AXIS));
    log.debug("Fetch main logo: {}", logo());
    pane1.add(
        new JLabel(
            new ImageIcon(
                getToolkit().getImage(FileUtil.findURL(logo(), FileUtil.Location.INSTALLED)),
                "JMRI logo"),
            JLabel.LEFT));
    pane1.add(
        Box.createRigidArea(new Dimension(15, 0))); // Some spacing between logo and status panel

    log.debug("start labels");
    JPanel pane2 = new JPanel();

    pane2.setLayout(new BoxLayout(pane2, BoxLayout.Y_AXIS));
    pane2.add(new JLabel(line1()));
    pane2.add(new JLabel(line2()));
    pane2.add(new JLabel(line3()));
    pane2.add(
        new JLabel(
            Bundle.getMessage(
                "ActiveProfile", ProfileManager.getDefault().getActiveProfile().getName())));

    // add listerner for Com port updates
    ConnectionStatus.instance().addPropertyChangeListener(this);
    int i = 0;
    for (ConnectionConfig conn : InstanceManager.getDefault(ConnectionConfigManager.class)) {
      if (!conn.getDisabled()) {
        connection[i] = conn;
        i++;
      }
      if (i > 3) {
        break;
      }
    }
    buildLine4(pane2);
    buildLine5(pane2);
    buildLine6(pane2);
    buildLine7(pane2);

    pane2.add(new JLabel(line8()));
    pane2.add(new JLabel(line9()));
    pane1.add(pane2);
    return pane1;
  }