private JPanel getAlgorithmPnl() {
    if (algorithmPnl == null) {
      algorithmPnl = new JPanel();
      algorithmPnl.setLayout(new BoxLayout(algorithmPnl, BoxLayout.PAGE_AXIS));
      algorithmPnl.setAutoscrolls(true);
      algorithmPnl.setBorder(LookAndFeelUtil.createPanelBorder());
      algorithmPnl.setOpaque(!LookAndFeelUtil.isAquaLAF()); // Transparent if Aqua
    }

    return algorithmPnl;
  }
  private JPanel getPrefLayoutPnl() {
    if (prefLayoutPnl == null) {
      prefLayoutPnl = new JPanel();
      prefLayoutPnl.setOpaque(!LookAndFeelUtil.isAquaLAF()); // Transparent if Aqua

      final GroupLayout layout = new GroupLayout(prefLayoutPnl);
      prefLayoutPnl.setLayout(layout);
      layout.setAutoCreateGaps(true);
      layout.setAutoCreateContainerGaps(true);

      final JLabel label = new JLabel("Preferred Layout Algorithm:");

      layout.setHorizontalGroup(
          layout
              .createParallelGroup(Alignment.LEADING, true)
              .addComponent(label)
              .addComponent(getPrefAlgorithmCmb()));
      layout.setVerticalGroup(
          layout
              .createSequentialGroup()
              .addComponent(label, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
              .addComponent(getPrefAlgorithmCmb(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    }

    return prefLayoutPnl;
  }
  private JPanel getSettingsPnl() {
    if (settingsPnl == null) {
      settingsPnl = new JPanel();
      settingsPnl.setAutoscrolls(true);
      settingsPnl.setOpaque(!LookAndFeelUtil.isAquaLAF()); // Transparent if Aqua

      final JLabel algoLbl = new JLabel("Layout Algorithm:");

      final GroupLayout layout = new GroupLayout(settingsPnl);
      settingsPnl.setLayout(layout);
      layout.setAutoCreateGaps(true);
      layout.setAutoCreateContainerGaps(true);

      layout.setHorizontalGroup(
          layout
              .createParallelGroup(Alignment.LEADING, true)
              .addComponent(algoLbl)
              .addComponent(getAlgorithmCmb())
              .addComponent(getAlgorithmPnl(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
              .addComponent(getSettingsButtonPnl()));
      layout.setVerticalGroup(
          layout
              .createSequentialGroup()
              .addComponent(algoLbl)
              .addComponent(getAlgorithmCmb(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
              .addComponent(getAlgorithmPnl(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
              .addComponent(getSettingsButtonPnl(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    }

    return settingsPnl;
  }
  private void initComponents() {
    final JPanel contentPane = new JPanel();
    final GroupLayout layout = new GroupLayout(contentPane);
    contentPane.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);

    layout.setHorizontalGroup(
        layout
            .createParallelGroup(Alignment.CENTER, true)
            .addComponent(getTabbedPane(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(getButtonPnl(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(
        layout
            .createSequentialGroup()
            .addComponent(getTabbedPane(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(getButtonPnl(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));

    setContentPane(contentPane);

    LookAndFeelUtil.setDefaultOkCancelKeyStrokes(
        getRootPane(), getApplyBtn().getAction(), getDoneBtn().getAction());
    getRootPane().setDefaultButton(getApplyBtn());

    pack();
  }
  private JPanel getSettingsButtonPnl() {
    if (settingsButtonPnl == null) {
      settingsButtonPnl = new JPanel();
      settingsButtonPnl.setLayout(new BoxLayout(settingsButtonPnl, BoxLayout.LINE_AXIS));
      settingsButtonPnl.setAlignmentX(Component.CENTER_ALIGNMENT);
      settingsButtonPnl.setOpaque(!LookAndFeelUtil.isAquaLAF()); // Transparent if Aqua

      settingsButtonPnl.add(Box.createHorizontalGlue());
      settingsButtonPnl.add(getApplyBtn());
      settingsButtonPnl.add(Box.createHorizontalGlue());
    }

    return settingsButtonPnl;
  }
Esempio n. 6
0
  @SuppressWarnings("serial")
  public void showCredits() {
    dialog = new JDialog(parent, true);
    dialog.setUndecorated(true);

    final ScrollingLinesPanel panel = new ScrollingLinesPanel(image, lines);
    panel.setBorder(BorderFactory.createLineBorder(UIManager.getColor("Separator.foreground")));

    dialog.add(panel);
    dialog.pack();
    dialog.validate();
    dialog.setPreferredSize(panel.getPreferredSize());
    centerDialogLocation(dialog);

    Action scrollText =
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            panel.incrementYPos();
            dialog.repaint();
          }
        };

    timer = new Timer(100, scrollText);

    dialog.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            hideCredits();
          }
        });

    Action cancelAction =
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            hideCredits();
          }
        };

    LookAndFeelUtil.setDefaultOkCancelKeyStrokes(dialog.getRootPane(), null, cancelAction);

    timer.start();
    dialog.setVisible(true);
  }
 protected AbstractWelcomeScreenChildPanel(final String title) {
   setBorder(LookAndFeelUtil.createTitledBorder(title));
 }
Esempio n. 8
0
 /** Initializes the label. */
 private void initLabel() {
   floatLabel = new JLabel(getTitle());
   floatLabel.setFont(floatLabel.getFont().deriveFont(LookAndFeelUtil.getSmallFontSize()));
   floatLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
 }