private void buildExternalsPanel() {

    FormBuilder builder = FormBuilder.create().layout(new FormLayout("fill:pref:grow", "p"));
    int row = 1;
    for (ExternalFileEntry efe : externals) {
      builder.add(efe.getPanel()).xy(1, row);
      builder.appendRows("2dlu, p");
      row += 2;
    }
    builder.add(Box.createVerticalGlue()).xy(1, row);
    builder.appendRows("2dlu, p, 2dlu, p");
    builder.add(addExtPan).xy(1, row + 2);
    builder.add(Box.createVerticalGlue()).xy(1, row + 2);

    // builder.getPanel().setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.green));
    // externalFilesPanel.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red));
    JScrollPane pane = new JScrollPane(builder.getPanel());
    pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    externalFilesPanel.setMinimumSize(new Dimension(400, 400));
    externalFilesPanel.setPreferredSize(new Dimension(400, 400));
    externalFilesPanel.removeAll();
    externalFilesPanel.add(pane, BorderLayout.CENTER);
    externalFilesPanel.revalidate();
    externalFilesPanel.repaint();
  }
Example #2
0
 /**
  * Introduce the Scout449 program!
  *
  * @param stat the Scout449 responsible for this object
  */
 public Intro(Scout449 stat) {
   super("Loading Scout449");
   setVisible(false);
   setUndecorated(true);
   setIconImage(stat.getImage("winicon"));
   loadImage();
   getRootPane().putClientProperty("Window.shadow", Boolean.FALSE);
   setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
   Container c = getContentPane();
   c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));
   c.add(Box.createVerticalGlue());
   Loading load = new Loading();
   load.setOpaque(true);
   load.setAlignmentX(JComponent.CENTER_ALIGNMENT);
   c.add(load);
   setCursor(Constants.WAIT);
   c.add(Box.createVerticalGlue());
   // center the window
   Dimension ss = AppLib.winInfo.getScreenSize();
   setBounds(
       (ss.width - Constants.INTRO_WIDTH) / 2,
       (ss.height - Constants.INTRO_HEIGHT) / 2,
       Constants.INTRO_WIDTH,
       Constants.INTRO_HEIGHT);
   setVisible(true);
 }
 // Center given button in a box, centered vertically and 6 pixels on left and right
 private Box createBoxForButton(JButton button) {
   Box buttonRow = Box.createHorizontalBox();
   buttonRow.add(Box.createHorizontalStrut(6));
   buttonRow.add(button);
   buttonRow.add(Box.createHorizontalStrut(6));
   Box buttonBox = Box.createVerticalBox();
   buttonBox.add(Box.createVerticalGlue());
   buttonBox.add(buttonRow);
   buttonBox.add(Box.createVerticalGlue());
   return buttonBox;
 }
Example #4
0
  private void setupUI() {
    mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    mainPanel.add(createCurrentDirectoryPanel());
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(createLogLevelPanel());
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(createStackTracePanel());
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(createOptionsPanel());
    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(createCustomExecutorPanel());
    mainPanel.add(Box.createVerticalStrut(10));

    // add a panel that can be used to add custom things to the setup tab
    customPanelPlaceHolder = new JPanel(new BorderLayout());
    mainPanel.add(customPanelPlaceHolder);

    // Glue alone doesn't work in this situation. This forces everything to the top.
    JPanel expandingPanel = new JPanel(new BorderLayout());
    expandingPanel.add(Box.createVerticalGlue(), BorderLayout.CENTER);
    mainPanel.add(expandingPanel);

    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  }
  public HelpUI(Frame parent, String title) {
    sidebar = new Sidebar();
    sidebar.setBorder(new EmptyBorder(10, 10, 10, 10));
    infoView = new JTextPane();
    Dimension d1 = sidebar.getPreferredSize();
    infoView.setPreferredSize(new Dimension(d1.width * 3, d1.height - 5));
    infoView.setEditable(false);

    MouseAdapter ma =
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent me) {
            SidebarOption sopt = (SidebarOption) me.getComponent();
            if (sel != null) {
              sel.setSelected(false);
              sel.repaint();
            }
            sel = sopt;
            sel.setSelected(true);
            sel.repaint();
            renderInfo();
          }
        };

    general = new SidebarOption("General Info", HELP_GENERAL_LOC);
    general.addMouseListener(ma);
    sidebar.add(general);

    sidebar.add(Box.createVerticalStrut(scy(10)));

    artifact = new SidebarOption("Artifacts", HELP_ARTIFACTS_LOC);
    artifact.addMouseListener(ma);
    sidebar.add(artifact);

    sidebar.add(Box.createVerticalStrut(scy(10)));

    net = new SidebarOption("Networking", HELP_NET_LOC);
    net.addMouseListener(ma);
    sidebar.add(net);

    sidebar.add(Box.createVerticalStrut(scy(10)));

    gpl = new SidebarOption("License", HELP_GPL_LOC);
    gpl.addMouseListener(ma);
    sidebar.add(gpl);

    general.setSelected(true);
    sel = general;

    sidebar.add(Box.createVerticalGlue());

    add(BorderLayout.WEST, sidebar);
    add(BorderLayout.CENTER, new JScrollPane(infoView));
    setResizable(false);
    pack();
    setLocationRelativeTo(parent);
    setTitle(title);

    renderInfo();
  }
Example #6
0
  /** OptionPaneDemo Constructor */
  public OptionPaneDemo(SwingSet2 swingset) {
    // Set the title for this demo, and an icon used to represent this
    // demo inside the SwingSet2 app.
    super(swingset, "OptionPaneDemo", "toolbar/JOptionPane.gif");

    JPanel demo = getDemoPanel();

    demo.setLayout(new BoxLayout(demo, BoxLayout.X_AXIS));

    JPanel bp =
        new JPanel() {
          public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
          }
        };
    bp.setLayout(new BoxLayout(bp, BoxLayout.Y_AXIS));

    bp.add(Box.createRigidArea(VGAP30));
    bp.add(Box.createRigidArea(VGAP30));

    bp.add(createInputDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createWarningDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createMessageDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createComponentDialogButton());
    bp.add(Box.createRigidArea(VGAP15));
    bp.add(createConfirmDialogButton());
    bp.add(Box.createVerticalGlue());

    demo.add(Box.createHorizontalGlue());
    demo.add(bp);
    demo.add(Box.createHorizontalGlue());
  }
  @Inject
  public CheckoutPanel(BookInventory inventory, CreditCardService cardService, Logger logger) {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    this.logger = logger;

    this.cartTableModel = new CartTableModel();

    final CheckoutInventoryTableModel inventoryModel = new CheckoutInventoryTableModel(inventory);
    inventoryModel.addTableModelListener(
        new TableModelListener() {

          public void tableChanged(TableModelEvent event) {
            if (inventoryModel.isLastColumn(event.getColumn())) {
              for (int i = event.getFirstRow(); i <= event.getLastRow(); i++) {
                addToCart(inventoryModel.decrementInventry(event.getFirstRow()));
              }
            }
          }
        });
    this.add(new JScrollPane(new CheckoutInventoryTable(inventoryModel)));
    this.add(Box.createVerticalStrut(20));
    this.add(new JScrollPane(new CartTable(cartTableModel)));
    this.add(Box.createVerticalStrut(20));
    this.add(new PaymentPanel(cardService));

    this.add(Box.createVerticalGlue());

    this.setPreferredSize(new Dimension(600, 400));
  }
  /**
   * Méthode de création du panelInit
   *
   * @return
   */
  private JPanel createPanelInit() {

    JPanel panRight = new JPanel();
    panRight.setLayout(new BoxLayout(panRight, BoxLayout.Y_AXIS));

    butListParty = new JButton("Liste des parties");
    butListParty.addActionListener(this);

    JPanel panCreate = new JPanel();
    panCreate.setLayout(new BoxLayout(panCreate, BoxLayout.X_AXIS));
    textCreate = new JTextField("", 40);
    textCreate.setMaximumSize(textCreate.getPreferredSize());
    butCreateParty = new JButton("Creation de parties ");
    butCreateParty.addActionListener(this);
    SpinnerModel model = new SpinnerNumberModel(3, 2, 8, 1);
    spinNbPlayer = new JSpinner(model);
    spinNbPlayer.setMaximumSize(spinNbPlayer.getPreferredSize());
    panCreate.add(new JLabel("Nouveau nom de partie : "));
    panCreate.add(textCreate);
    panCreate.add(Box.createHorizontalStrut(20));
    panCreate.add(new JLabel("Nombres de joueurs : "));
    panCreate.add(spinNbPlayer);
    panCreate.add(butCreateParty);

    JPanel panJoin = new JPanel();
    panJoin.setLayout(new BoxLayout(panJoin, BoxLayout.X_AXIS));
    textJoin = new JTextField("", 2);
    textJoin.setMaximumSize(textJoin.getPreferredSize());
    butJoinParty = new JButton("Rejoindre la partie ");
    butJoinParty.addActionListener(this);
    panJoin.add(new JLabel("Num Partie : "));
    panJoin.add(textJoin);
    panJoin.add(butJoinParty);

    panRight.add(butListParty);
    panRight.add(panCreate);
    panRight.add(panJoin);
    panRight.add(Box.createVerticalGlue());

    textInfoInit = new JTextArea(20, 100);
    textInfoInit.setLineWrap(true);

    JScrollPane scroll =
        new JScrollPane(
            textInfoInit,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    JPanel panAll = new JPanel();
    panAll.setLayout(new BoxLayout(panAll, BoxLayout.X_AXIS));
    panAll.add(scroll);
    panAll.add(panRight);

    return panAll;
  }
 private void init() {
   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
   Box labelBox = Box.createHorizontalBox();
   labelBox.add(new JLabel("Initialize Variable: "));
   labelBox.add(varName);
   labelBox.add(Box.createHorizontalGlue());
   add(labelBox);
   add(Box.createVerticalStrut(10));
   varEditPane.setLayout(new BorderLayout());
   add(varEditPane);
   add(Box.createVerticalGlue());
 }
  public void createFileChooserDemo() {
    theImage = new JLabel("");
    jpgIcon = createImageIcon("filechooser/jpgIcon.jpg", "jpg image");
    gifIcon = createImageIcon("filechooser/gifIcon.gif", "gif image");

    JPanel demoPanel = getDemoPanel();
    demoPanel.setLayout(new BoxLayout(demoPanel, BoxLayout.Y_AXIS));

    JPanel innerPanel = new JPanel();
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.X_AXIS));

    demoPanel.add(Box.createRigidArea(VGAP20));
    demoPanel.add(innerPanel);
    demoPanel.add(Box.createRigidArea(VGAP20));

    innerPanel.add(Box.createRigidArea(HGAP20));

    // Create a panel to hold buttons
    JPanel buttonPanel =
        new JPanel() {
          public Dimension getMaximumSize() {
            return new Dimension(getPreferredSize().width, super.getMaximumSize().height);
          }
        };
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS));

    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createPlainFileChooserButton());
    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createPreviewFileChooserButton());
    buttonPanel.add(Box.createRigidArea(VGAP15));
    buttonPanel.add(createCustomFileChooserButton());
    buttonPanel.add(Box.createVerticalGlue());

    // Create a panel to hold the image
    JPanel imagePanel = new JPanel();
    imagePanel.setLayout(new BorderLayout());
    imagePanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
    JScrollPane scroller = new JScrollPane(theImage);
    scroller.getVerticalScrollBar().setUnitIncrement(10);
    scroller.getHorizontalScrollBar().setUnitIncrement(10);
    imagePanel.add(scroller, BorderLayout.CENTER);

    // add buttons and image panels to inner panel
    innerPanel.add(buttonPanel);
    innerPanel.add(Box.createRigidArea(HGAP30));
    innerPanel.add(imagePanel);
    innerPanel.add(Box.createRigidArea(HGAP20));
  }
  protected boolean _addButtonExit_() {
    String strMethod = "_addButtonExit_()";

    add(Box.createHorizontalGlue());
    add(Box.createVerticalGlue());

    if (this._btnExit_ == null) {
      MySystem.s_printOutError(this, strMethod, "nil this._btnExit");
      return false;
    }

    add(this._btnExit_);
    // this._addSeparator_();
    return true;
  }
 public void init() {
   horizontal.add(new Button("水平按钮一"));
   horizontal.add(Box.createHorizontalGlue());
   horizontal.add(new Button("水平按钮二"));
   // 水平方向不可拉伸的间距,其宽度为10px
   horizontal.add(Box.createHorizontalStrut(10));
   horizontal.add(new Button("水平按钮三"));
   vertical.add(new Button("垂直按钮一"));
   vertical.add(Box.createVerticalGlue());
   vertical.add(new Button("垂直按钮二"));
   // 垂直方向不可拉伸的间距,其高度为10px
   vertical.add(Box.createVerticalStrut(10));
   vertical.add(new Button("垂直按钮三"));
   f.add(horizontal, BorderLayout.NORTH);
   f.add(vertical);
   f.pack();
   f.setVisible(true);
 }
Example #13
0
  public MainPanel() {
    super(new BorderLayout());
    l1.setToolTipText("Test1");
    l2.setToolTipText("Test2");
    l3.setToolTipText("<html><img src='" + url + "'>Test3</html>");

    JPanel p1 = new JPanel(new BorderLayout());
    p1.setBorder(BorderFactory.createTitledBorder("javax.swing.Timer"));
    p1.add(l1);
    JPanel p2 = new JPanel(new BorderLayout());
    p2.setBorder(BorderFactory.createTitledBorder("Animated Gif"));
    p2.add(l2, BorderLayout.NORTH);
    p2.add(l3, BorderLayout.SOUTH);

    Box box = Box.createVerticalBox();
    box.add(p1);
    box.add(Box.createVerticalStrut(20));
    box.add(p2);
    box.add(Box.createVerticalGlue());
    add(box);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(320, 240));
  }
Example #14
0
  public MainPanel() {
    super(new BorderLayout());
    setSilderUI(slider1);
    setSilderUI(slider2);

    Box box1 = Box.createHorizontalBox();
    box1.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    box1.add(new JSlider(SwingConstants.VERTICAL, 0, 1000, 100));
    box1.add(Box.createHorizontalStrut(20));
    box1.add(slider1);
    box1.add(Box.createHorizontalGlue());

    Box box2 = Box.createVerticalBox();
    box2.setBorder(BorderFactory.createEmptyBorder(20, 0, 20, 20));
    box2.add(makeTitledPanel("Default", new JSlider(0, 1000, 100)));
    box2.add(Box.createVerticalStrut(20));
    box2.add(makeTitledPanel("Jump to clicked position", slider2));
    box2.add(Box.createVerticalGlue());

    add(box1, BorderLayout.WEST);
    add(box2);
    // setBorder(BorderFactory.createEmptyBorder(5, 20, 5, 10));
    setPreferredSize(new Dimension(320, 240));
  }
  /** Constructs all components of the frame and makes the frame visible to the user. */
  public void build() {

    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    resolution = new JComboBox<Resolution>();
    for (Resolution res : Resolution.values()) {
      resolution.addItem(res);
    }

    resolution.setSelectedItem(prefs.getResolution());

    bitrateLabel = new JLabel("Maximum Bitrate = " + prefs.getBitrate() + " Mbps", JLabel.CENTER);
    bitrate = new JSlider(JSlider.HORIZONTAL, 0, 100, prefs.getBitrate());
    bitrate.setMajorTickSpacing(20);
    bitrate.setMinorTickSpacing(1);
    bitrate.setPaintLabels(true);
    bitrate.setPaintTicks(true);
    bitrate.setToolTipText(Integer.toString(bitrate.getValue()) + " Mbps");

    bitrate.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent ce) {
            bitrate.setToolTipText(Integer.toString(bitrate.getValue()) + " Mbps");
            bitrateLabel.setText("Maximum Bitrate = " + bitrate.getValue() + " Mbps");
          }
        });

    resolution.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            Resolution newRes = (Resolution) resolution.getSelectedItem();
            bitrate.setValue(newRes.defaultBitrate);
          }
        });

    fullscreen = new JCheckBox("Fullscreen");
    fullscreen.setSelected(prefs.getFullscreen());

    openGlRenderer = new JCheckBox("Use OpenGL Renderer (Experimental)");
    openGlRenderer.setSelected(prefs.getUseOpenGlRenderer());

    localAudio = new JCheckBox("Play audio on host PC");
    localAudio.setSelected(prefs.getLocalAudio());

    Box resolutionBox = Box.createHorizontalBox();
    resolutionBox.add(Box.createHorizontalGlue());
    resolutionBox.add(resolution);
    resolutionBox.add(Box.createHorizontalGlue());

    Box bitrateLabelBox = Box.createHorizontalBox();
    bitrateLabelBox.add(Box.createHorizontalGlue());
    bitrateLabelBox.add(bitrateLabel);
    bitrateLabelBox.add(Box.createHorizontalGlue());

    Box bitrateBox = Box.createHorizontalBox();
    bitrateBox.add(Box.createHorizontalGlue());
    bitrateBox.add(bitrate);
    bitrateBox.add(Box.createHorizontalGlue());

    Box fullscreenBox = Box.createHorizontalBox();
    fullscreenBox.add(Box.createHorizontalGlue());
    fullscreenBox.add(fullscreen);
    fullscreenBox.add(Box.createHorizontalGlue());

    Box openGlRendererBox = Box.createHorizontalBox();
    openGlRendererBox.add(Box.createHorizontalGlue());
    openGlRendererBox.add(openGlRenderer);
    openGlRendererBox.add(Box.createHorizontalGlue());

    Box localAudioBox = Box.createHorizontalBox();
    localAudioBox.add(Box.createHorizontalGlue());
    localAudioBox.add(localAudio);
    localAudioBox.add(Box.createHorizontalGlue());

    mainPanel.add(Box.createVerticalStrut(10));
    mainPanel.add(resolutionBox);
    mainPanel.add(Box.createVerticalStrut(5));
    mainPanel.add(bitrateLabelBox);
    mainPanel.add(Box.createVerticalStrut(5));
    mainPanel.add(bitrateBox);
    mainPanel.add(Box.createVerticalStrut(5));
    mainPanel.add(fullscreenBox);
    mainPanel.add(Box.createVerticalStrut(5));
    mainPanel.add(openGlRendererBox);
    mainPanel.add(Box.createVerticalStrut(5));
    mainPanel.add(localAudioBox);
    mainPanel.add(Box.createVerticalGlue());

    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            super.windowClosing(e);
            if (prefsChanged()) {
              writePreferences();
            }
          }
        });

    this.getContentPane().add(mainPanel);

    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    // center on screen
    this.setLocation(
        (int) dim.getWidth() / 2 - this.getWidth() / 2,
        (int) dim.getHeight() / 2 - this.getHeight() / 2);

    this.setVisible(true);
  }
Example #16
0
  public GuideCertInstallPane() {
    super();
    setLayout(new GridBagLayout());

    ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();

    setBorder(
        new TitledBorder(
            new CompoundBorder(
                new EtchedBorder(),
                new EmptyBorder(
                    COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE)),
            resource.getString("GuideCertInstallPane", "title")));

    int y = 0;

    GridBagUtil.constrain(
        this,
        new MultilineLabel(resource.getString("GuideCertInstallPane", "explain")),
        0,
        ++y,
        1,
        1,
        1.0,
        0.0,
        GridBagConstraints.NORTH,
        GridBagConstraints.BOTH,
        0,
        0,
        SEPARATED_COMPONENT_SPACE,
        0);

    GridBagUtil.constrain(
        this,
        Box.createVerticalGlue(),
        0,
        ++y,
        1,
        1,
        1.0,
        1.0,
        GridBagConstraints.NORTH,
        GridBagConstraints.BOTH,
        0,
        0,
        0,
        0);

    GridBagUtil.constrain(
        this,
        new JLabel(resource.getString(null, "clickNextToContinue")),
        0,
        ++y,
        1,
        1,
        1.0,
        0.0,
        GridBagConstraints.NORTH,
        GridBagConstraints.BOTH,
        0,
        0,
        0,
        0);
  }
  public CustomizePluginsStepPanel() {
    myCardLayout = new JBCardLayout();
    setLayout(myCardLayout);
    JPanel gridPanel = new JPanel(new GridLayout(0, COLS));
    myCustomizePanel = new IdSetPanel();
    JBScrollPane scrollPane =
        new JBScrollPane(
            gridPanel,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.getVerticalScrollBar().setUnitIncrement(10);
    add(scrollPane, MAIN);
    add(myCustomizePanel, CUSTOMIZE);

    // PluginManager.loadDisabledPlugins(new File(PathManager.getConfigPath()).getPath(),
    // myDisabledPluginIds);
    // for (IdeaPluginDescriptor pluginDescriptor : myAllPlugins) {
    //  if (pluginDescriptor.getPluginId().getIdString().equals("com.intellij")) {
    ////    skip 'IDEA CORE' plugin
    // continue;
    // }
    //  //PluginManager.initClassLoader(PluginGroups.class.getClassLoader(),
    // (IdeaPluginDescriptorImpl)pluginDescriptor);
    // }
    Map<String, List<String>> groups = PluginGroups.getInstance().getTree();
    for (Map.Entry<String, List<String>> entry : groups.entrySet()) {
      final String group = entry.getKey();
      if (PluginGroups.CORE.equals(group)) continue;

      JPanel groupPanel = new JPanel(new GridBagLayout());
      GridBagConstraints gbc = new GridBagConstraints();
      gbc.insets = new Insets(0, 0, 10, 0);
      gbc.fill = GridBagConstraints.BOTH;
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      gbc.weightx = 1;
      JLabel titleLabel =
          new JLabel(
              "<html><body><h2 style=\"text-align:left;\">" + group + "</h2></body></html>") {
            @Override
            public boolean isEnabled() {
              return isGroupEnabled(group);
            }
          };
      groupPanel.add(titleLabel, gbc);
      JLabel descriptionLabel =
          new JLabel(PluginGroups.getInstance().getDescription(group)) {
            @Override
            public Dimension getPreferredSize() {
              Dimension size = super.getPreferredSize();
              size.width = Math.min(size.width, 200);
              return size;
            }

            @Override
            public boolean isEnabled() {
              return isGroupEnabled(group);
            }

            @Override
            public Color getForeground() {
              return ColorUtil.withAlpha(UIManager.getColor("Label.foreground"), .75);
            }
          };
      groupPanel.add(descriptionLabel, gbc);
      gbc.weighty = 1;
      groupPanel.add(Box.createVerticalGlue(), gbc);
      gbc.weighty = 0;
      if (PluginGroups.getInstance().getSets(group).size() == 1) {
        groupPanel.add(
            createLink(SWITCH_COMMAND + ":" + group, getGroupSwitchTextProvider(group)), gbc);
      } else {
        JPanel buttonsPanel = new JPanel(new GridLayout(1, 2, 10, 5));
        LinkLabel customizeButton =
            createLink(CUSTOMIZE_COMMAND + ":" + group, CUSTOMIZE_TEXT_PROVIDER);
        buttonsPanel.add(customizeButton);
        LinkLabel disableAllButton =
            createLink(SWITCH_COMMAND + ":" + group, getGroupSwitchTextProvider(group));
        buttonsPanel.add(disableAllButton);
        groupPanel.add(buttonsPanel, gbc);
      }
      gridPanel.add(groupPanel);
    }

    int cursor = 0;
    Component[] components = gridPanel.getComponents();
    int rowCount = components.length / COLS;
    for (Component component : components) {
      ((JComponent) component)
          .setBorder(
              new CompoundBorder(
                  new CustomLineBorder(
                      ColorUtil.withAlpha(JBColor.foreground(), .2),
                      0,
                      0,
                      cursor / 3 < rowCount - 1 ? 1 : 0,
                      cursor % COLS != COLS - 1 ? 1 : 0) {
                    @Override
                    protected Color getColor() {
                      return ColorUtil.withAlpha(JBColor.foreground(), .2);
                    }
                  },
                  BorderFactory.createEmptyBorder(GAP, GAP, GAP, GAP)));
      cursor++;
    }
  }
  /** Construct a new panel. */
  public JUnixPanel(ConfigApp app) {
    super(app, "Linux Paths:");

    /* initialize UI components */
    {
      pHomeDirComp = new JAbsoluteDirComp("Home Directory", sSize);
      add(pHomeDirComp);

      add(Box.createRigidArea(new Dimension(0, 20)));

      pTempDirComp = new JAbsoluteDirComp("Temporary Directory", sSize);
      add(pTempDirComp);

      add(Box.createRigidArea(new Dimension(0, 20)));

      pJavaHomeDirComp = new JAbsoluteDirComp("Java Home Directory", sSize);
      add(pJavaHomeDirComp);

      add(Box.createRigidArea(new Dimension(0, 40)));

      pJavadocDirComp = new JAbsoluteDirComp("Local Vendor Javadoc Directory", sSize);
      add(pJavadocDirComp);

      add(Box.createRigidArea(new Dimension(0, 20)));

      pExtraJavaLibsComp = new JAbsoluteJarsComp("Local Java Libraries", sSize);
      add(pExtraJavaLibsComp);

      add(Box.createRigidArea(new Dimension(0, 20)));
      add(Box.createVerticalGlue());

      pNotesDialog.setMessage(
          "Linux Parameters:",
          "The Home Directory is the absolute path to the parent directory of all user "
              + "home directories.  Usually this directory resides on a network file system and "
              + "may not be (/home) at your site.\n"
              + "\n"
              + "The Temporary Directory is absolute path to the directory used to write various "
              + "temporary files generated by Pipeline programs.  For optimal performance, this "
              + "directory should reside on a local file system.\n"
              + "\n"
              + "The Java Home Directory is the path to the root directory of the local Java "
              + "Runtime Environment (JRE) installed on Linux artist workstations used to run "
              + "Pipeline client programs.  By default, this is set to the JRE used to run this "
              + "configuration tool and the Pipeline server daemons in the Java Runtime section "
              + "above.  If you wish to use a different JRE for workstation clients than is used "
              + "for the server daemons, you can specify the location of the alternative JRE "
              + "here.\n"
              + "\n"
              + "The Local Vendor Javadoc Directory is the path to the root directory where the "
              + "documentation generated by javadoc for locally created Pipeline plugins and "
              + "standalone utils is located.  Providing this will allow users to easily access "
              + "the documentation for locally created plugins from Pipeline's user interface.\n"
              + "\n"
              + "The Local Java Libraries is a optional set of JAR files containing common Java "
              + "class shared by a large number of locally created plugins and/or standalone "
              + "utils.  Any JARs provided will be added to the Java classpath for all Pipeline "
              + "programs.  This is typically used for relatively large 3rd party libraries for "
              + "things such as XML parsing or SQL database connections which would otherwise "
              + "need to be embedded in many different plugin JARs.  Since these libraries "
              + "be dynamically updated (like plugins can), they are not suitable for anything "
              + "which might need to modified without a Pipeline shutdown.  This feature is "
              + "only an optimization to reduce plugin size and memory footprint but is not "
              + "required in order to use 3rd party Java libraries with Pipeline.");
    }
  }
Example #19
0
  @Override
  protected void zmenaVyberu(final Set<Alela> aAlelyx) {
    jmenaVybranychAlel = Alela.alelyToNames(aAlelyx);
    final Genotyp genotyp = new Genotyp(aAlelyx, bag.getGenom());
    final Sklivec sklivec = bag.getSklivec(genotyp);
    jskelneikony.removeAll();
    // BoundingRect br = Imagant.sjednoceni(sklivec.imaganti);
    {
      jskelneikony.add(Box.createVerticalStrut(20));
      final JButton jLabel = new JButton();
      jLabel.setAlignmentX(CENTER_ALIGNMENT);
      // jLabel.setText("všechna skla přes sebe");
      final Imagant imagant = Sklo.prekresliNaSebe(sklivec.imaganti);
      if (imagant != null) {
        jLabel.setIcon(new ImageIcon(imagant.getImage()));
      }
      jskelneikony.add(jLabel);
    }
    jskelneikony.add(Box.createVerticalStrut(50));

    final Iterator<SkloAplikant> iterator = bag.getSada().getSkloAplikanti().iterator();

    for (final Imagant imagant : sklivec.imaganti) {
      final SkloAplikant skloAplikant = iterator.next();
      final Box panel = Box.createHorizontalBox();
      final TitledBorder border = BorderFactory.createTitledBorder(skloAplikant.sklo.getName());
      border.setTitleJustification(TitledBorder.CENTER);
      panel.setBorder(border);
      final JLabel jLabel = new JLabel();
      // jLabel.setText("sklo");
      if (imagant != null) {
        jLabel.setIcon(new ImageIcon(imagant.getImage()));
      }
      jLabel.setAlignmentX(CENTER_ALIGNMENT);

      panel.add(Box.createHorizontalGlue());
      panel.add(jLabel);
      panel.add(Box.createHorizontalGlue());

      panel.setMinimumSize(new Dimension(150, 100));
      panel.setPreferredSize(new Dimension(150, 100));

      // JLabel jJmenoSady = new JLabel(skloAplikant.sklo.getName());
      // jJmenoSady.setAlignmentX(JComponent.CENTER_ALIGNMENT);
      // jskelneikony.add(jJmenoSady);
      jskelneikony.add(panel);
      jskelneikony.add(Box.createVerticalStrut(10));
    }
    jskelneikony.add(Box.createVerticalGlue());

    final JCheckBox jZobrazovaniVseho = new JCheckBox("Zobrazit vše");
    jZobrazovaniVseho.setSelected(zobrazovatVse);
    jskelneikony.add(jZobrazovaniVseho);

    jZobrazovaniVseho.addItemListener(
        e -> {
          zobrazovatVse = jZobrazovaniVseho.isSelected();
          resetBag(bag);
        });

    // a teď vyrendrovat vše přes sebe

    System.out.println(genotyp);
    jskelneikony.revalidate();
    // pack();
  }
Example #20
0
public class ListPanel extends JPanel {
  private java.util.List<JPanel> rows = new ArrayList<>();
  private java.util.List<Component> struts = new ArrayList<>();
  private Gui gui;
  private Component puff = Box.createVerticalGlue();

  public ListPanel(Gui gui) {
    this.gui = gui;
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(puff);
  }

  public void addRow(Component... components) {
    remove(puff);
    final JPanel row = new JPanel();
    row.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent event) {
            gui.notifyObserver("/use " + rows.indexOf(event.getSource()));
          }
        });
    row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS));
    // row.add(Box.createHorizontalStrut(3));
    row.setMinimumSize(new Dimension(10, 30));
    row.setMaximumSize(new Dimension(250, 30));
    for (Component component : components) {
      row.add(component);
    }
    JButton red = new JButton("x");
    red.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            int deleted = rows.indexOf(row);
            gui.notifyObserver("/use " + deleted);
            gui.notifyObserver("/disconnect");
          }
        });
    red.setBackground(Color.PINK.darker());
    red.setForeground(Color.WHITE);
    row.add(Box.createHorizontalGlue());
    row.add(red);
    rows.add(row);
    Component strut = Box.createVerticalStrut(5);
    struts.add(strut);
    add(row);
    add(strut);
    add(puff);
    repaint();
    updateUI();
  }

  public void removeRow(int index) {
    remove(rows.get(index));
    remove(struts.get(index));
    rows.remove(index);
    struts.remove(index);
    repaint();
    updateUI();
  }

  public void selectRow(int index) {
    int count = 0;
    for (JPanel row : rows) {
      if (count % 2 == 0) {
        row.setBackground(new Color(200, 200, 230));
      } else {
        row.setBackground(new Color(240, 240, 240));
      }
      ++count;
    }
    if (index != -1) {
      rows.get(index).setBackground(new Color(170, 250, 170));
    }
    repaint();
    updateUI();
  }
}
Example #21
0
  public ThumbMaker() {
    super("ThumbMaker");

    // grab the preferences so that they can be used to fill out the layout
    ThumbMakerPreferences myPrefs = ThumbMakerPreferences.getInstance();

    // content pane
    JPanel pane = new JPanel();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
    setContentPane(pane);

    // top panel
    JPanel top = new JPanel();
    top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
    pane.add(top);

    // left-hand panel
    JPanel left = new JPanel();
    left.setLayout(new BoxLayout(left, BoxLayout.Y_AXIS));
    top.add(left);

    // horizontal padding
    top.add(Box.createHorizontalStrut(5));

    // label for file list
    JLabel listLabel = GUIUtil.makeLabel("Files to process:");
    listLabel.setDisplayedMnemonic('f');
    String listTip = "List of files from which to create thumbnails";
    listLabel.setToolTipText(listTip);
    left.add(GUIUtil.pad(listLabel));

    // list of files to convert
    list = new JList();
    listLabel.setLabelFor(list);
    list.setToolTipText(listTip);
    list.setModel(new DefaultListModel());
    list.setDragEnabled(true);
    changeFilesInList = new ThumbTransferHandler();
    list.setTransferHandler(changeFilesInList);
    left.add(new JScrollPane(list));

    // progress bar
    progress = new JProgressBar(0, 1);
    progress.setString("[Drag and drop files onto list to begin]");
    progress.setStringPainted(true);
    progress.setToolTipText("Status of thumbnail processing operation");
    left.add(progress);

    // panel for process and remove buttons
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // add files button
    addFiles = new JButton("Add Files");
    addFiles.setMnemonic('d');
    addFiles.setToolTipText("Add files to be processed.");
    addFiles.addActionListener(this);
    p.add(addFiles);

    p.add(Box.createHorizontalStrut(5));

    // process button
    process = new JButton("Process");
    process.setMnemonic('p');
    process.setToolTipText("Begin creating thumbnails");
    process.addActionListener(this);
    p.add(process);

    p.add(Box.createHorizontalStrut(5));

    // remove button
    remove = new JButton("Remove");
    remove.setMnemonic('v');
    remove.setToolTipText("Remove selected files from the list");
    remove.addActionListener(this);
    p.add(remove);

    left.add(GUIUtil.pad(p));

    // right-hand panel
    JPanel right = new JPanel();
    right.setLayout(new BoxLayout(right, BoxLayout.Y_AXIS));
    top.add(right);

    // panel for resolution settings
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // resolution label
    JLabel resLabel = GUIUtil.makeLabel("Resolution: ");
    resLabel.setDisplayedMnemonic('s');
    resLabel.setToolTipText("Resolution of the thumbnails");
    p.add(resLabel);

    // x resolution text box
    xres =
        GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_WIDTH_PREF_NAME), 2);
    resLabel.setLabelFor(xres);
    xres.setToolTipText("Thumbnail width");
    p.add(xres);

    // "by" label
    JLabel byLabel = GUIUtil.makeLabel(" by ");
    byLabel.setDisplayedMnemonic('y');
    p.add(byLabel);

    // y resolution text box
    yres =
        GUIUtil.makeTextField(myPrefs.getStringPref(ThumbMakerPreferences.RES_HEIGHT_PREF_NAME), 2);
    byLabel.setLabelFor(yres);
    yres.setToolTipText("Thumbnail height");
    p.add(yres);

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(8));

    // aspect ratio checkbox
    aspect = new JCheckBox("Maintain aspect ratio", true);
    aspect.setMnemonic('m');
    aspect.setToolTipText(
        "When checked, thumbnails are not stretched, "
            + "but rather padded with the background color.");
    aspect.addActionListener(this);
    right.add(GUIUtil.pad(aspect));
    // make sure that the check box is initialized correctly
    aspect.setSelected(
        myPrefs
            .getStringPref(ThumbMakerPreferences.DO_MAINTAIN_ASPECT_PREF_NAME)
            .equalsIgnoreCase(ThumbMakerPreferences.BOOLEAN_TRUE_STRING));

    // panel for background color
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // load the color values from the preferences
    int redValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.RED_VALUE_PREF_NAME);
    int greenValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.GREEN_VALUE_PREF_NAME);
    int blueValueNumber = myPrefs.getIntegerPref(ThumbMakerPreferences.BLUE_VALUE_PREF_NAME);

    // background color label
    colorLabel = GUIUtil.makeLabel("Background color: ");
    String colorTip = "Thumbnail background color";
    colorLabel.setToolTipText(colorTip);
    p.add(colorLabel);

    // background color
    colorBox = new JPanel();
    colorBox.setToolTipText(colorTip);
    colorBox.setBorder(new LineBorder(Color.black, 1));
    Dimension colorBoxSize = new Dimension(45, 15);
    colorBox.setMaximumSize(colorBoxSize);
    colorBox.setMinimumSize(colorBoxSize);
    colorBox.setPreferredSize(colorBoxSize);
    colorBox.setBackground(new Color(redValueNumber, greenValueNumber, blueValueNumber));
    p.add(colorBox);

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(2));

    // red slider
    redLabel = GUIUtil.makeLabel("R");
    red = new JSlider(0, 255, redValueNumber);
    redValue = GUIUtil.makeLabel("" + redValueNumber);
    redValue.setToolTipText("Red color component slider");
    right.add(makeSlider(redLabel, red, redValue, "Red"));

    // green slider
    greenLabel = GUIUtil.makeLabel("G");
    green = new JSlider(0, 255, greenValueNumber);
    greenValue = GUIUtil.makeLabel("" + greenValueNumber);
    greenValue.setToolTipText("Green color component slider");
    right.add(makeSlider(greenLabel, green, greenValue, "Green"));

    // blue slider
    blueLabel = GUIUtil.makeLabel("B");
    blue = new JSlider(0, 255, blueValueNumber);
    blueValue = GUIUtil.makeLabel("" + blueValueNumber);
    right.add(makeSlider(blueLabel, blue, blueValue, "Blue"));

    right.add(Box.createVerticalStrut(8));

    // panel for algorithm
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // algorithm label
    JLabel algorithmLabel = GUIUtil.makeLabel("Algorithm: ");
    algorithmLabel.setDisplayedMnemonic('l');
    String algorithmTip = "Resizing algorithm to use";
    algorithmLabel.setToolTipText(algorithmTip);
    p.add(algorithmLabel);

    // algorithm combo box
    algorithm =
        GUIUtil.makeComboBox(
            new String[] {"Smooth", "Standard", "Fast", "Replicate", "Area averaging"});
    algorithmLabel.setLabelFor(algorithm);
    algorithm.setToolTipText(algorithmTip);
    p.add(algorithm);
    // set the algorithm value from the preferences
    algorithm.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.RESIZE_ALG_PREF_NAME));

    right.add(GUIUtil.pad(p));

    // panel for output format
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // format label
    JLabel formatLabel = GUIUtil.makeLabel("Format: ");
    formatLabel.setDisplayedMnemonic('f');
    String formatTip = "Thumbnail output format";
    formatLabel.setToolTipText(formatTip);
    p.add(formatLabel);

    // format combo box
    format = GUIUtil.makeComboBox(new String[] {"PNG", "JPG"});
    formatLabel.setLabelFor(format);
    format.setToolTipText(formatTip);
    p.add(format);
    // set the format value from the preferences
    format.setSelectedIndex(myPrefs.getIntegerPref(ThumbMakerPreferences.THUMB_FORMAT_PREF_NAME));

    right.add(GUIUtil.pad(p));
    right.add(Box.createVerticalStrut(5));

    // panel for prepend string
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));

    // prepend label
    JLabel prependLabel = GUIUtil.makeLabel("Prepend: ");
    prependLabel.setDisplayedMnemonic('e');
    String prependTip = "Starting string for each thumbnail filename";
    prependLabel.setToolTipText(prependTip);
    p.add(prependLabel);

    // prepend field
    prepend =
        GUIUtil.makeTextField(
            myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_PREPEND_PREF_NAME), 4);
    prependLabel.setLabelFor(prepend);
    prepend.setToolTipText(prependTip);
    p.add(prepend);

    p.add(Box.createHorizontalStrut(5));

    // append label
    JLabel appendLabel = GUIUtil.makeLabel("Append: ");
    appendLabel.setDisplayedMnemonic('a');
    String appendTip = "Ending string for each thumbnail filename";
    appendLabel.setToolTipText(appendTip);
    p.add(appendLabel);

    // append field
    append =
        GUIUtil.makeTextField(
            myPrefs.getStringPref(ThumbMakerPreferences.STRING_TO_APPEND_PREF_NAME), 4);
    appendLabel.setLabelFor(append);
    append.setToolTipText(appendTip);
    p.add(append);

    right.add(GUIUtil.pad(p));

    // vertical padding
    right.add(Box.createVerticalGlue());

    // bottom panel
    JPanel bottom = new JPanel();
    bottom.setLayout(new BoxLayout(bottom, BoxLayout.X_AXIS));
    pane.add(bottom);

    // output folder label
    JLabel outputLabel = GUIUtil.makeLabel("Output folder: ");
    outputLabel.setDisplayedMnemonic('o');
    String outputTip = "Thumbnail output folder";
    outputLabel.setToolTipText(outputTip);
    bottom.add(outputLabel);

    // output folder field
    String filePath =
        new File(myPrefs.getStringPref(ThumbMakerPreferences.FILE_PATH_STRING_PREF_NAME))
            .getAbsolutePath();
    output = GUIUtil.makeTextField(filePath, 8);
    outputLabel.setLabelFor(output);
    output.setToolTipText(outputTip);
    // start this in default and then lock down so "..." is used
    output.setEditable(false);
    output.setBackground(Color.LIGHT_GRAY);
    bottom.add(output);

    // add a file chooser button "..."
    dotDotDot = new JButton("...");
    dotDotDot.setMnemonic('.');
    dotDotDot.setToolTipText("Select destination directory.");
    dotDotDot.addActionListener(this);
    bottom.add(dotDotDot);

    right.add(GUIUtil.pad(p));

    setFromPreferences();
    addWindowListener(this);
  }
Example #22
0
  public OptionsDialogOld(JFrame parent) {

    super(parent, true);

    game = new SurroundGame(10, 2, 1, 1);

    setTitle("Game Options");
    setUndecorated(true);
    closeStatus = false;

    try {
      background =
          ImageIO.read(
              new File(
                  "C:\\Users\\Frank\\" + "workspace\\Surround\\src\\package1\\" + "bcktile.png"));
    } catch (IOException e) {
      JOptionPane.showMessageDialog(null, "Image not found");
    }

    Font font2 = new Font("Cooper Black", Font.BOLD, 30);

    okButton = new JButton("OK");
    okButton.setFont(font2);
    cancelButton = new JButton("CANCEL");
    cancelButton.setFont(font2);
    okButton.addActionListener(this);
    cancelButton.addActionListener(this);

    JPanel container = new ImagePanel(background);
    container.setLayout(new BorderLayout());
    JLabel title = new JLabel("Game Options", SwingConstants.CENTER);
    Font font = new Font("Cooper Black", Font.BOLD, 60);
    title.setFont(font);
    // title.setAlignmentX(CENTER_ALIGNMENT);
    container.add(BorderLayout.NORTH, title);

    JPanel panel = new JPanel();
    panel.setName("Game Options");
    panel.setLayout(new GridLayout(5, 2));
    DefaultListCellRenderer dlcr = new DefaultListCellRenderer();
    dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);
    String[] board = {
      "4 x 4", "5 x 5", "6 x 6", "7 x 7", "8 x 8", "9 x 9", "10 x 10", "11 x 11", "12 x 12"
    };
    boardBox = new JComboBox<String>(board);
    boardBox.setFont(font2);
    boardBox.setRenderer(dlcr);

    JLabel sizeLabel = new JLabel("Size of the board:");
    sizeLabel.setFont(font2);
    panel.add(sizeLabel);
    panel.add(boardBox);
    String[] players = {"2", "3", "4", "5", "6", "7", "8", "9", "10"};
    String[] turns = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
    playersBox = new JComboBox<String>(players);
    playersBox.setFont(font2);
    playersBox.setRenderer(dlcr);
    JLabel playersLabel = new JLabel("Number of players:");
    playersLabel.setFont(font2);
    panel.add(playersLabel);
    panel.add(playersBox);
    humansBox = new JComboBox<String>(turns);
    humansBox.setFont(font2);
    humansBox.setRenderer(dlcr);
    JLabel humansLabel = new JLabel("Number of human players:");
    humansLabel.setFont(font2);
    panel.add(humansLabel);
    panel.add(humansBox);
    startBox = new JComboBox<String>(turns);
    startBox.setFont(font2);
    startBox.setRenderer(dlcr);
    JLabel startLabel = new JLabel("Starting player:");
    startLabel.setFont(font2);
    panel.add(startLabel);
    panel.add(startBox);

    panel.add(okButton);
    panel.add(cancelButton);

    // container.setPreferredSize(new Dimension(700,700));
    container.add(BorderLayout.CENTER, panel);

    panel.setOpaque(false);
    container.setOpaque(false);

    Box box = new Box(BoxLayout.Y_AXIS);
    box.add(Box.createVerticalGlue());
    box.add(container);
    // box.setVisible(true);

    // setContentPane(background);
    // background.
    getContentPane().add(box);
    // add(box);
    // getContentPane().add(container);

    setAlwaysOnTop(true);

    setSize(parent.getSize());
    setLocation(parent.getLocation());

    setVisible(true);
  }
    /** make the box view */
    protected void makeContents() {
      _view.add(makeDefaultFolderNavigationButton());

      _view.add(Box.createVerticalGlue());
    }
Example #24
0
  public WizardStep getStage(String stage) {

    final WhatsNew _this = this;

    WizardStep ws = new WizardStep();

    int ind = stage.indexOf(":");

    Version v = new Version(stage.substring(0, ind));

    int lind = Integer.parseInt(stage.substring(ind + 1));

    java.util.List<WhatsNewItem> its = this.items.get(v);

    if (its == null) {

      return null;
    }

    WhatsNewItem item = its.get(lind);

    if (item == null) {

      return null;
    }

    ws.title = item.title;
    ws.helpText = this.getFirstHelpText();

    if ((item.description != null) || (item.component != null)) {

      final Box b = new Box(BoxLayout.Y_AXIS);

      if (item.description != null) {

        JTextPane hp = UIUtils.createHelpTextPane(item.description, this.projectViewer);

        hp.setBorder(null);
        hp.setSize(new Dimension(UIUtils.getPopupWidth() - 25, 500));

        Box hpb = new Box(BoxLayout.Y_AXIS);
        hpb.add(hp);
        hpb.setMaximumSize(hpb.getPreferredSize());
        hpb.setBorder(UIUtils.createPadding(0, 5, 0, 0));
        b.add(hpb);
      }

      if (item.component != null) {

        if (item.description != null) {

          b.add(Box.createVerticalStrut(5));
        }

        item.component.setAlignmentY(Component.TOP_ALIGNMENT);
        item.component.setBorder(UIUtils.createPadding(5, 10, 0, 0));

        b.add(item.component);
      }

      b.add(Box.createVerticalGlue());

      ws.panel = b;
    }

    return ws;
  }
Example #25
0
  public SketchProperties(Editor e, Sketch s) {
    super();

    editor = e;
    sketch = s;

    fields = new HashMap<String, JComponent>();

    this.setPreferredSize(new Dimension(500, 400));
    this.setMinimumSize(new Dimension(500, 400));
    this.setMaximumSize(new Dimension(500, 400));
    this.setSize(new Dimension(500, 400));
    Point eLoc = editor.getLocation();
    int x = eLoc.x;
    int y = eLoc.y;

    Dimension eSize = editor.getSize();
    int w = eSize.width;
    int h = eSize.height;

    int cx = x + (w / 2);
    int cy = y + (h / 2);

    this.setLocation(new Point(cx - 250, cy - 200));
    this.setModal(true);

    outer = new JPanel(new BorderLayout());
    outer.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    this.add(outer);

    win = new JPanel();
    win.setLayout(new BorderLayout());
    outer.add(win, BorderLayout.CENTER);

    buttonBar = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    saveButton = new JButton("OK");
    saveButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            save();
            SketchProperties.this.dispose();
          }
        });

    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            SketchProperties.this.dispose();
          }
        });

    buttonBar.add(saveButton);
    buttonBar.add(cancelButton);

    win.add(buttonBar, BorderLayout.SOUTH);

    tabs = new JTabbedPane();

    overviewPane = new JPanel();
    overviewPane.setLayout(new BoxLayout(overviewPane, BoxLayout.PAGE_AXIS));
    overviewPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    addTextField(overviewPane, "author", "Sketch author:");
    addTextArea(overviewPane, "summary", "Summary:");
    addTextArea(overviewPane, "license", "Copyright / License:");
    tabs.add("Overview", overviewPane);

    objectsPane = new JPanel();
    objectsPane.setLayout(new BoxLayout(objectsPane, BoxLayout.PAGE_AXIS));
    objectsPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    addTextField(objectsPane, "board", "Board:");
    addTextField(objectsPane, "core", "Core:");
    addTextField(objectsPane, "compiler", "Compiler:");
    addTextField(objectsPane, "port", "Serial port:");
    addTextField(objectsPane, "programmer", "Programmer:");
    JButton setDef = new JButton("Set to current IDE values");
    setDef.setMaximumSize(setDef.getPreferredSize());
    setDef.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setObjectValues();
          }
        });
    objectsPane.add(Box.createVerticalGlue());
    objectsPane.add(setDef);

    tabs.add("Objects", objectsPane);

    win.add(tabs, BorderLayout.CENTER);

    this.setTitle("Sketch Properties");

    this.pack();
    this.setVisible(true);
  }