예제 #1
0
  private void setPalette() {
    mZoomPalettePanel.removeAll();
    if (mVisualConfig.getBlocksColorRange() == null) {
      return;
    }

    List<Color> colorRange = null;
    if (mVisualConfig.getBlocksColorRange() == null) {
      colorRange = Consts.defaultColorRange;
    } else {
      colorRange = mVisualConfig.getBlocksColorRange();
    }

    JLabel paletteLabel = new JLabel("Zoom Palette:");
    paletteLabel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
    paletteLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
    mZoomPalettePanel.add(paletteLabel);

    mPalettePanel = new JPanel();
    mPalettePanel.setLayout(new BoxLayout(mPalettePanel, BoxLayout.X_AXIS));
    mZoomPalettePanel.add(mPalettePanel);

    for (int i = 0; i < colorRange.size(); i++) {
      JPanel paletteSquarePanel = new JPanel();
      paletteSquarePanel.setLayout(new BoxLayout(paletteSquarePanel, BoxLayout.Y_AXIS));

      Color color = colorRange.get(i);
      JPanel colorPanel = new JPanel();
      colorPanel.setBackground(color);

      colorPanel.setMinimumSize(new Dimension(20, 20));
      colorPanel.setPreferredSize(new Dimension(20, 20));
      colorPanel.setMaximumSize(new Dimension(20, 20));

      paletteSquarePanel.add(colorPanel);

      String value = " ";
      if (i == 0 && mVisualConfig.getRangeLowValue() != null) {
        value = Integer.toString(mVisualConfig.getRangeLowValue());
      } else if (i == colorRange.size() - 1 && mVisualConfig.getRangeHighValue() != null) {
        value = Integer.toString(mVisualConfig.getRangeHighValue());
      }

      JLabel valueLabel = new JLabel(value);
      valueLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
      paletteSquarePanel.add(valueLabel);

      mPalettePanel.add(paletteSquarePanel);
    }
  }
예제 #2
0
 public DisplayWord(String name, Type type, int fill) {
   this.type = type;
   setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
   setAlignmentX(RIGHT_ALIGNMENT);
   if (name != null) {
     JLabel title = new JLabel(name + ":");
     title.setAlignmentY(CENTER_ALIGNMENT);
     title.setAlignmentX(RIGHT_ALIGNMENT);
     add(title);
     add(Box.createHorizontalStrut(5));
   }
   if (fill > 0) {
     JLabel filler = new JLabel(new String(new char[fill]).replace('\0', ' '));
     filler.setFont(monoFont);
     add(filler);
   }
   text = new JLabel();
   text.setAlignmentY(CENTER_ALIGNMENT);
   text.setAlignmentX(LEFT_ALIGNMENT);
   text.setFont(monoFont);
   text.setHorizontalTextPosition(JLabel.LEFT);
   add(text);
   setValue(0);
 }
예제 #3
0
  /**
   * Initializes the icon image.
   *
   * @param icon the icon to show on the left of the window
   */
  private void initIcon(ImageIcon icon) {
    // If an icon isn't provided set the application logo icon by default.
    if (icon == null)
      icon =
          DesktopUtilActivator.getResources().getImage("service.gui.SIP_COMMUNICATOR_LOGO_64x64");

    JLabel iconLabel = new JLabel(icon);

    iconLabel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));

    iconLabel.setAlignmentY(Component.TOP_ALIGNMENT);

    JPanel iconPanel = new TransparentPanel(new BorderLayout());
    iconPanel.add(iconLabel, BorderLayout.NORTH);

    getContentPane().add(iconPanel, BorderLayout.WEST);
  }
예제 #4
0
  public BeerPanel() {

    setPreferredSize(new Dimension(TopViewPanel.WIDTH, 50));
    setBackground(Color.BLACK);
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    p_scala = new ColorScalaPanel(500, 50, 10, (float) 0.1, (float) 0.2, (float) 1, (float) 1);

    repaint();
    revalidate();

    beerLabel = new JLabel(new ImageIcon("art/beerpong/beer1.jpg"));
    p_scala.setAlignmentY(Component.CENTER_ALIGNMENT);
    beerLabel.setAlignmentY(Component.CENTER_ALIGNMENT);

    add(beerLabel);
    add(p_scala);
  }
예제 #5
0
  private void insertParameter(ConfigParamDescr descr, String format, int pos) {
    try {
      StyledDocument doc = (StyledDocument) editorPane.getDocument();

      // The component must first be wrapped in a style
      Style style = doc.addStyle("Parameter-" + numParameters, null);
      JLabel label = new JLabel(descr.getDisplayName());
      label.setAlignmentY(0.8f); // make sure we line up
      label.setFont(new Font("Helvetica", Font.PLAIN, 14));
      label.setForeground(Color.BLUE);
      label.setName(descr.getKey());
      label.setToolTipText("key: " + descr.getKey() + "    format: " + format);
      StyleConstants.setComponent(style, label);
      doc.insertString(pos, format, style);
      numParameters++;
    } catch (BadLocationException e) {
    }
  }
    /** Constructor, assembles the components of the panel */
    public AssetIndicator() {
      super();

      // Make the layout a vertical box layout
      setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
      setBorder(BorderFactory.createEmptyBorder(4, 10, 2, 10));
      setAlignmentX(0.0f);
      setAlignmentY(0.0f);

      // Create the label, make the font a bit smaller and add it to
      // the panel
      assetLabel = new JLabel("");
      assetLabel.setAlignmentX(0.0f);
      assetLabel.setAlignmentY(0.0f);
      Font font = assetLabel.getFont();
      assetLabel.setFont(font.deriveFont(Font.PLAIN, 11));
      //            assetLabel.setPreferredSize(getSize());
      add(assetLabel);

      // Create the progress bar and add it to the panel. Make sure it
      // is always of a maximum height
      progressBar = new JProgressBar();
      //            progressBar.addComponentListener(new ComponentAdapter() {
      //                @Override
      //                public void componentResized(ComponentEvent e) {
      //                    Dimension size = progressBar.getSize();
      //                    size.setSize(size.getWidth(), 15);
      //                    progressBar.setSize(size);
      //                }
      //
      //            });
      progressBar.setAlignmentX(0.0f);
      progressBar.setAlignmentY(0.0f);
      progressBar.setValue(0);
      //            progressBar.setPreferredSize(getSize());
      add(progressBar);
    }
  public void doInit() {

    final InviteResponseMessageBox _this = this;

    if (!this.message.isDealtWith()) {

      // Show the response.
      this.responseBox = new Box(BoxLayout.Y_AXIS);

      this.add(this.responseBox);

      JComponent l =
          UIUtils.createBoldSubHeader(
              String.format(
                  "%s the invitation", (this.message.isAccepted() ? "Accepted" : "Rejected")),
              (this.message.isAccepted()
                  ? Constants.ACCEPTED_ICON_NAME
                  : Constants.REJECTED_ICON_NAME));

      this.responseBox.add(l);
      this.responseBox.setBorder(UIUtils.createPadding(5, 5, 0, 5));

      if (this.message.isAccepted()) {

        if ((this.message.getEditorName() != null) || (this.message.getEditorAvatar() != null)) {

          JTextPane desc =
              UIUtils.createHelpTextPane(
                  "Additionally they provided the following name/avatar.", this.projectViewer);

          this.responseBox.add(Box.createVerticalStrut(5));

          this.responseBox.add(desc);
          desc.setBorder(null);
          desc.setSize(new Dimension(UIUtils.getPopupWidth() - 20, desc.getPreferredSize().height));

          Box editorInfo = new Box(BoxLayout.X_AXIS);
          editorInfo.setAlignmentX(Component.LEFT_ALIGNMENT);
          editorInfo.setBorder(UIUtils.createPadding(5, 5, 5, 5));

          this.responseBox.add(editorInfo);

          if (this.message.getEditorAvatar() != null) {

            JLabel avatar = new JLabel();

            avatar.setAlignmentY(Component.TOP_ALIGNMENT);
            avatar.setVerticalAlignment(SwingConstants.TOP);

            editorInfo.add(avatar);
            avatar.setOpaque(false);

            avatar.setIcon(
                new ImageIcon(UIUtils.getScaledImage(_this.message.getEditorAvatar(), 50)));

            avatar.setBorder(
                new CompoundBorder(UIUtils.createPadding(0, 0, 0, 5), UIUtils.createLineBorder()));
          }

          if (this.message.getEditorName() != null) {

            JLabel name = new JLabel(this.message.getEditorName());
            editorInfo.add(name);

            name.setBorder(null);
            name.setAlignmentY(Component.TOP_ALIGNMENT);
            name.setVerticalAlignment(JLabel.TOP);
            name.setAlignmentX(Component.LEFT_ALIGNMENT);
            name.setFont(
                name.getFont()
                    .deriveFont((float) UIUtils.getScaledFontSize(14))
                    .deriveFont(java.awt.Font.PLAIN));
          }
        }
      }

      final EditorEditor ed = this.message.getEditor();

      JButton ok = new JButton("Ok, got it");

      ok.addActionListener(
          new ActionAdapter() {

            public void actionPerformed(ActionEvent ev) {

              try {

                if (_this.message.isAccepted()) {

                  ed.setEditorStatus(EditorEditor.EditorStatus.current);

                  if (_this.message.getEditorName() != null) {

                    ed.setName(_this.message.getEditorName());
                  }

                  if (_this.message.getEditorAvatar() != null) {

                    ed.setAvatar(_this.message.getEditorAvatar());
                  }

                  EditorsEnvironment.updateEditor(ed);

                  // Is this response for an invite message or just out of the blue from a web
                  // service invite?
                  if (!EditorsEnvironment.hasSentMessageOfTypeToEditor(
                      ed, InviteMessage.MESSAGE_TYPE)) {

                    EditorsEnvironment.sendUserInformationToEditor(ed, null, null, null);
                  }

                } else {

                  ed.setEditorStatus(EditorEditor.EditorStatus.rejected);

                  EditorsEnvironment.updateEditor(ed);
                }

                _this.message.setDealtWith(true);

                EditorsEnvironment.updateMessage(_this.message);

                _this.responseBox.setVisible(false);

              } catch (Exception e) {

                Environment.logError("Unable to update editor: " + ed, e);

                UIUtils.showErrorMessage(
                    _this.projectViewer,
                    "Unable to update {editor}, please contact Quoll Writer support for assitance.");

                return;
              }
            }
          });

      JButton[] buts = new JButton[] {ok};

      JPanel bb = UIUtils.createButtonBar2(buts, Component.LEFT_ALIGNMENT);
      bb.setOpaque(false);
      bb.setAlignmentX(Component.LEFT_ALIGNMENT);
      bb.setBorder(UIUtils.createPadding(5, 0, 0, 0));

      this.responseBox.add(bb);

      return;
    }

    boolean accepted = this.message.isAccepted();
    String iconName = (accepted ? Constants.ACCEPTED_ICON_NAME : Constants.REJECTED_ICON_NAME);

    String message = "Accepted invitation to be {an editor}";

    if (!accepted) {

      message = "Rejected invitation to be {an editor}";
    }

    JComponent h = UIUtils.createBoldSubHeader(message, iconName);

    this.add(h);
  }
예제 #8
0
 private JLabel createParamValue() {
   JLabel text = new JLabel();
   text.setAlignmentY(TOP_ALIGNMENT);
   return text;
 }
예제 #9
0
  public DivPanel init() {
    Dimension d = new Dimension(120, 80);
    this.setSize(d);
    this.setPreferredSize(d);

    if (iconPanel == null && textPanel == null) {
      return this;
    }
    arrangement = arrangement % 5;

    this.setLayout(new SpringLayout());

    if (icon != null) {
      iconPanel = iconPanel == null ? new FPanel() : iconPanel;
    }
    textPanel = textPanel == null ? new FPanel() : textPanel;

    switch (arrangement) {
      case ICON_LEFT_AND_TEXT_RIGHT:
        if ((icon != null && text != null)) {
          this.add(iconPanel);
          this.add(textPanel);
          SpringUtilities.makeCompactGrid(this, 1, 2, initX, initY, xPad, yPad);
        } else if (icon != null) {
          this.add(iconPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        } else if (text != null) {
          this.add(textPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        }

        break;

      case ICON_RIGHT_AND_TEXT_LEFT:
        if ((icon != null && text != null)) {
          this.add(textPanel);
          this.add(iconPanel);
          SpringUtilities.makeCompactGrid(this, 1, 2, initX, initY, xPad, yPad);
        } else if (icon != null) {
          this.add(iconPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        } else if (text != null) {
          this.add(textPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        }
        break;

      case ICON_TOP_AND_TEXT_BOTTOM:
        if ((icon != null && text != null)) {
          this.add(iconPanel);
          this.add(textPanel);
          SpringUtilities.makeCompactGrid(this, 2, 1, initX, initY, xPad, yPad);
        } else if (icon != null) {
          this.add(iconPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        } else if (text != null) {
          this.add(textPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        }
        break;

      case ICON_BOTTOM_AND_TEXT_TOP:
        if ((icon != null && text != null)) {
          this.add(textPanel);
          this.add(iconPanel);
          SpringUtilities.makeCompactGrid(this, 2, 1, initX, initY, xPad, yPad);
        } else if (icon != null) {
          this.add(iconPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        } else if (text != null) {
          this.add(textPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        }
        break;

      case ICON_BACK_AND_TEXT_FRONT:
        if ((icon != null && text != null)) {
          JPanel tempPanel = new JPanel();
          this.add(tempPanel);
          OverlayLayout ov = new OverlayLayout(tempPanel);

          tempPanel.setLayout(ov);
          tempPanel.setMaximumSize(iconPanel.getMaximumSize());
          if (iconPanel != null) tempPanel.setBackground(iconPanel.getBackground());

          textLabel.setAlignmentX(0.5f);
          textLabel.setAlignmentY(0.5f);
          textLabel.setMaximumSize(iconLabel.getMaximumSize());
          tempPanel.add(textLabel);

          iconLabel.setAlignmentX(0.5f);
          iconLabel.setAlignmentY(0.5f);
          tempPanel.add(iconLabel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        } else if (icon != null) {
          this.add(iconPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        } else if (text != null) {
          this.add(textPanel);
          SpringUtilities.makeCompactGrid(this, 1, 1, initX, initY, xPad, yPad);
        }
    }
    return this;
  }
예제 #10
0
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    closeButton = new javax.swing.JButton();
    javax.swing.JLabel appTitleLabel = new javax.swing.JLabel();
    javax.swing.JLabel versionLabel = new javax.swing.JLabel();
    javax.swing.JLabel appVersionLabel = new javax.swing.JLabel();
    javax.swing.JLabel vendorLabel = new javax.swing.JLabel();
    javax.swing.JLabel appVendorLabel = new javax.swing.JLabel();
    javax.swing.JLabel appDescLabel = new javax.swing.JLabel();
    javax.swing.JLabel imageLabel = new javax.swing.JLabel();
    jLabel1 = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    org.jdesktop.application.ResourceMap resourceMap =
        org.jdesktop.application.Application.getInstance(connect.ConnectApp.class)
            .getContext()
            .getResourceMap(ConnectAboutBox.class);
    setTitle(resourceMap.getString("title")); // NOI18N
    setModal(true);
    setName("aboutBox"); // NOI18N
    setResizable(false);

    javax.swing.ActionMap actionMap =
        org.jdesktop.application.Application.getInstance(connect.ConnectApp.class)
            .getContext()
            .getActionMap(ConnectAboutBox.class, this);
    closeButton.setAction(actionMap.get("closeAboutBox")); // NOI18N
    closeButton.setText(resourceMap.getString("closeButton.text")); // NOI18N
    closeButton.setName("closeButton"); // NOI18N

    appTitleLabel.setFont(
        appTitleLabel
            .getFont()
            .deriveFont(
                appTitleLabel.getFont().getStyle() | java.awt.Font.BOLD,
                appTitleLabel.getFont().getSize() + 4));
    appTitleLabel.setText(resourceMap.getString("Application.title")); // NOI18N
    appTitleLabel.setName("appTitleLabel"); // NOI18N

    versionLabel.setFont(
        versionLabel.getFont().deriveFont(versionLabel.getFont().getStyle() | java.awt.Font.BOLD));
    versionLabel.setText(resourceMap.getString("versionLabel.text")); // NOI18N
    versionLabel.setName("versionLabel"); // NOI18N

    appVersionLabel.setText(resourceMap.getString("Application.version")); // NOI18N
    appVersionLabel.setName("appVersionLabel"); // NOI18N

    vendorLabel.setFont(
        vendorLabel.getFont().deriveFont(vendorLabel.getFont().getStyle() | java.awt.Font.BOLD));
    vendorLabel.setText(resourceMap.getString("vendorLabel.text")); // NOI18N
    vendorLabel.setName("vendorLabel"); // NOI18N

    appVendorLabel.setText(resourceMap.getString("Application.vendor")); // NOI18N
    appVendorLabel.setName("appVendorLabel"); // NOI18N

    appDescLabel.setText(resourceMap.getString("appDescLabel.text")); // NOI18N
    appDescLabel.setName("appDescLabel"); // NOI18N

    imageLabel.setIcon(resourceMap.getIcon("imageLabel.icon")); // NOI18N
    imageLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
    imageLabel.setAlignmentY(0.0F);
    imageLabel.setName("imageLabel"); // NOI18N

    jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
    jLabel1.setName("jLabel1"); // NOI18N

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        imageLabel,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        126,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(appTitleLabel)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(versionLabel)
                                    .addGap(18, 18, 18)
                                    .addComponent(appVersionLabel))
                            .addComponent(appDescLabel)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(vendorLabel)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel1)
                                            .addComponent(appVendorLabel))
                                    .addGap(28, 28, 28)
                                    .addComponent(closeButton)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(appTitleLabel)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(appDescLabel)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(versionLabel)
                                            .addComponent(appVersionLabel))
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(
                                        layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(vendorLabel)
                                            .addComponent(appVendorLabel)
                                            .addComponent(closeButton))
                                    .addGap(3, 3, 3)
                                    .addComponent(jLabel1))
                            .addComponent(
                                imageLabel,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                129,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    pack();
  } // </editor-fold>//GEN-END:initComponents