コード例 #1
0
  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;
  }
コード例 #2
0
  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;
  }
コード例 #3
0
  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;
  }
コード例 #4
0
  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;
  }