예제 #1
0
 private void initButtonPanel() {
   final Parser p = InterfaceConfig.SELECTION_FRAME_PROPERTIES;
   back.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
           state.back();
         }
       });
   back.setText(p.getString("back-button"));
   next.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
           state.next();
         }
       });
   next.setText(p.getString("next-button-next"));
   config.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
           JDialog d =
               loaders.get(plugins.getSelectedIndex()).getConfigDialog(SelectionFrame.this);
           d.setLocationByPlatform(true);
           d.setModal(true);
           d.setVisible(true);
         }
       });
   JButton manual = new JButton(p.getString("manual-button"));
   manual.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent actionEvent) {
           MainFrame.showHelp(
               state.getManualTile(),
               p.getInt("manual-width"),
               p.getInt("manual-height"),
               p.getInt("manual-deltaX"),
               p.getInt("manual-deltaY"),
               state.getManualURL(),
               SelectionFrame.this);
         }
       });
   config.setText(p.getString("config-button"));
   buttonPanel.add(back);
   buttonPanel.add(manual);
   buttonPanel.add(config);
   buttonPanel.add(next);
   buttonPanel.revalidate();
 }
예제 #2
0
  public AboutDialog(JConsole jConsole) {
    super(jConsole, Resources.getText("Help.AboutDialog.title"), false);

    setAccessibleDescription(this, getText("Help.AboutDialog.accessibleDescription"));
    setDefaultCloseOperation(HIDE_ON_CLOSE);
    setResizable(false);
    JComponent cp = (JComponent) getContentPane();

    createActions();

    JLabel mastheadLabel = new JLabel(mastheadIcon);
    setAccessibleName(mastheadLabel, getText("Help.AboutDialog.masthead.accessibleName"));

    JPanel mainPanel = new TPanel(0, 0);
    mainPanel.add(mastheadLabel, NORTH);

    String jConsoleVersion = Version.getVersion();
    String vmName = System.getProperty("java.vm.name");
    String vmVersion = System.getProperty("java.vm.version");
    String urlStr = getText("Help.AboutDialog.userGuideLink.url");
    if (isBrowseSupported()) {
      urlStr = "<a style='color:#35556b' href=\"" + urlStr + "\">" + urlStr + "</a>";
    }

    JPanel infoAndLogoPanel = new JPanel(new BorderLayout(10, 10));
    infoAndLogoPanel.setBackground(bgColor);

    String colorStr = String.format("%06x", textColor.getRGB() & 0xFFFFFF);
    JEditorPane helpLink =
        new JEditorPane(
            "text/html",
            "<html><font color=#"
                + colorStr
                + ">"
                + getText("Help.AboutDialog.jConsoleVersion", jConsoleVersion)
                + "<p>"
                + getText("Help.AboutDialog.javaVersion", (vmName + ", " + vmVersion))
                + "<p>"
                + getText("Help.AboutDialog.userGuideLink", urlStr)
                + "</html>");
    helpLink.setOpaque(false);
    helpLink.setEditable(false);
    helpLink.setForeground(textColor);
    mainPanel.setBorder(BorderFactory.createLineBorder(borderColor));
    infoAndLogoPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    helpLink.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              browse(e.getDescription());
            }
          }
        });
    infoAndLogoPanel.add(helpLink, NORTH);

    ImageIcon brandLogoIcon = new ImageIcon(getClass().getResource("resources/brandlogo.png"));
    JLabel brandLogo = new JLabel(brandLogoIcon, JLabel.LEADING);

    JButton closeButton = new JButton(closeAction);

    JPanel bottomPanel = new TPanel(0, 0);
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING));
    buttonPanel.setOpaque(false);

    mainPanel.add(infoAndLogoPanel, CENTER);
    cp.add(bottomPanel, SOUTH);

    infoAndLogoPanel.add(brandLogo, SOUTH);

    buttonPanel.setBorder(new EmptyBorder(2, 12, 2, 12));
    buttonPanel.add(closeButton);
    bottomPanel.add(buttonPanel, NORTH);

    statusBar = new JLabel(" ");
    bottomPanel.add(statusBar, SOUTH);

    cp.add(mainPanel, NORTH);

    pack();
    setLocationRelativeTo(jConsole);
    Utilities.updateTransparency(this);
  }