Example #1
2
 /**
  * This function is used to re-run the analyser, and re-create the rows corresponding the its
  * results.
  */
 private void refreshReviewTable() {
   reviewPanel.removeAll();
   rows.clear();
   GridBagLayout gbl = new GridBagLayout();
   reviewPanel.setLayout(gbl);
   GridBagConstraints gbc = new GridBagConstraints();
   gbc.fill = GridBagConstraints.HORIZONTAL;
   gbc.gridy = 0;
   try {
     Map<String, Long> sums =
         analyser.processLogFile(config.getLogFilename(), fromDate.getDate(), toDate.getDate());
     for (Entry<String, Long> entry : sums.entrySet()) {
       String project = entry.getKey();
       double hours = 1.0 * entry.getValue() / (1000 * 3600);
       addRow(gbl, gbc, project, hours);
     }
     for (String project : main.getProjectsTree().getTopLevelProjects())
       if (!rows.containsKey(project)) addRow(gbl, gbc, project, 0);
     gbc.insets = new Insets(10, 0, 0, 0);
     addLeftLabel(gbl, gbc, "TOTAL");
     gbc.gridx = 1;
     gbc.weightx = 1;
     totalLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 3));
     gbl.setConstraints(totalLabel, gbc);
     reviewPanel.add(totalLabel);
     gbc.weightx = 0;
     addRightLabel(gbl, gbc);
   } catch (IOException e) {
     e.printStackTrace();
   }
   recomputeTotal();
   pack();
 }
  /**
   * Sets the mute status icon to the status panel.
   *
   * @param isMute indicates if the call with this peer is muted
   */
  public void setMute(final boolean isMute) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setMute(isMute);
            }
          });
      return;
    }

    if (isMute) {
      muteStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MUTE_STATUS_ICON)));
      muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3));
    } else {
      muteStatusLabel.setIcon(null);
      muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    }

    // Update input volume control button state to reflect the current
    // mute status.
    if (localLevel.isSelected() != isMute) localLevel.setSelected(isMute);

    this.revalidate();
    this.repaint();
  }
Example #3
0
 /**
  * Component initialization.
  *
  * @throws java.lang.Exception
  */
 private void jbInit() throws Exception {
   image1 = new ImageIcon(pt.inescporto.siasoft.MenuFrame.class.getResource("about.png"));
   imageLabel.setIcon(image1);
   setTitle("About");
   panel1.setLayout(borderLayout1);
   panel2.setLayout(borderLayout2);
   insetsPanel1.setLayout(flowLayout1);
   insetsPanel2.setLayout(flowLayout1);
   insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
   gridLayout1.setRows(4);
   gridLayout1.setColumns(1);
   label1.setText(product);
   label2.setText(version);
   label3.setText(copyright);
   label4.setText(comments);
   insetsPanel3.setLayout(gridLayout1);
   insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10));
   button1.setText("OK");
   button1.addActionListener(this);
   insetsPanel2.add(imageLabel, null);
   panel2.add(insetsPanel2, BorderLayout.WEST);
   getContentPane().add(panel1, null);
   insetsPanel3.add(label1, null);
   insetsPanel3.add(label2, null);
   insetsPanel3.add(label3, null);
   insetsPanel3.add(label4, null);
   panel2.add(insetsPanel3, BorderLayout.CENTER);
   insetsPanel1.add(button1, null);
   panel1.add(insetsPanel1, BorderLayout.SOUTH);
   panel1.add(panel2, BorderLayout.NORTH);
   setResizable(true);
 }
Example #4
0
  public ButtonTabComponent(final JTabbedPane pane) {
    // unset default FlowLayout' gaps
    super(new FlowLayout(FlowLayout.LEFT, 0, 0));
    if (pane == null) {
      throw new NullPointerException("TabbedPane is null");
    }
    this.pane = pane;
    setOpaque(false);

    // make JLabel read titles from JTabbedPane
    JLabel label =
        new JLabel() {
          private static final long serialVersionUID = 1L;

          public String getText() {
            int i = pane.indexOfTabComponent(ButtonTabComponent.this);
            if (i != -1) return pane.getTitleAt(i);
            return null;
          }
        };

    add(label);
    // add more space between the label and the button
    label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    // tab button
    JButton button = new TabButton();
    add(button);
    // add more space to the top of the component
    setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
  }
    protected void initComponents() {
      int border = 2;
      this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
      this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

      // Description label
      JPanel descriptionPanel = new JPanel(new GridLayout(0, 1, 0, 0));
      descriptionPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border));
      String text = thread.getRetrievable().getName();
      text = text.length() > 40 ? text.substring(0, 37) + "..." : text;
      descriptionLabel = new JLabel(text);
      descriptionPanel.add(descriptionLabel);
      this.add(descriptionPanel);

      // Progrees and cancel button
      JPanel progressPanel = new JPanel();
      progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.X_AXIS));
      progressPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border));
      progressBar = new JProgressBar(0, 100);
      progressBar.setPreferredSize(new Dimension(100, 16));
      progressPanel.add(progressBar);
      progressPanel.add(Box.createHorizontalStrut(8));
      cancelButton = new JButton("Cancel");
      cancelButton.setBackground(Color.RED);
      cancelButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              cancelButtonActionPerformed(event);
            }
          });
      progressPanel.add(cancelButton);
      this.add(progressPanel);
    }
Example #6
0
  public FileNameRenderer(JTable table) {
    Border b = UIManager.getBorder("Table.noFocusBorder");
    if (Objects.isNull(b)) { // Nimbus???
      Insets i = focusCellHighlightBorder.getBorderInsets(textLabel);
      b = BorderFactory.createEmptyBorder(i.top, i.left, i.bottom, i.right);
    }
    noFocusBorder = b;

    p.setOpaque(false);
    panel.setOpaque(false);

    // http://www.icongalore.com/ XP Style Icons - Windows Application Icon, Software XP Icons
    nicon = new ImageIcon(getClass().getResource("wi0063-16.png"));
    sicon =
        new ImageIcon(
            p.createImage(
                new FilteredImageSource(nicon.getImage().getSource(), new SelectedImageFilter())));

    iconLabel = new JLabel(nicon);
    iconLabel.setBorder(BorderFactory.createEmptyBorder());

    p.add(iconLabel, BorderLayout.WEST);
    p.add(textLabel);
    panel.add(p, BorderLayout.WEST);

    Dimension d = iconLabel.getPreferredSize();
    dim.setSize(d);
    table.setRowHeight(d.height);
  }
  private void initComponents() {
    jfxPanel = new JFXPanel();

    createScene();

    ActionListener al =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            loadURL(txtURL.getText());
          }
        };

    btnGo.addActionListener(al);
    txtURL.addActionListener(al);

    progressBar.setPreferredSize(new Dimension(150, 18));
    progressBar.setStringPainted(true);

    JPanel topBar = new JPanel(new BorderLayout(5, 0));
    topBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
    topBar.add(txtURL, BorderLayout.CENTER);
    topBar.add(btnGo, BorderLayout.EAST);

    JPanel statusBar = new JPanel(new BorderLayout(5, 0));
    statusBar.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
    statusBar.add(lblStatus, BorderLayout.CENTER);
    statusBar.add(progressBar, BorderLayout.EAST);

    panel.add(topBar, BorderLayout.NORTH);
    panel.add(jfxPanel, BorderLayout.CENTER);
    panel.add(statusBar, BorderLayout.SOUTH);

    frame.getContentPane().add(panel);
  }
Example #8
0
  public ComboBoxDemo() {
    super(new BorderLayout());

    String[] petStrings = {"Bird", "Cat", "Dog", "Rabbit", "Pig"};

    // Create the combo box, select the item at index 4.
    // Indices start at 0, so 4 specifies the pig.
    JComboBox petList = new JComboBox(petStrings);
    petList.setSelectedIndex(4);
    petList.addActionListener(this);

    // Set up the picture.
    picture = new JLabel();
    picture.setFont(picture.getFont().deriveFont(Font.ITALIC));
    picture.setHorizontalAlignment(JLabel.CENTER);
    updateLabel(petStrings[petList.getSelectedIndex()]);
    picture.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));

    // The preferred size is hard-coded to be the width of the
    // widest image and the height of the tallest image + the border.
    // A real program would compute this.
    picture.setPreferredSize(new Dimension(177, 122 + 10));

    // Lay out the demo.
    add(petList, BorderLayout.PAGE_START);
    add(picture, BorderLayout.PAGE_END);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
  }
Example #9
0
 public JComponent buildRightTabbedPane() {
   cl = new CardLayout();
   tabbedPane = new JPanel(cl);
   tabbedPane.setBorder(BorderFactory.createEmptyBorder());
   JScrollPane scrollPane = new JScrollPane(tabbedPane);
   scrollPane.setBorder(BorderFactory.createEmptyBorder());
   return scrollPane;
 }
 public void setOrientation(int o) {
   orientation = o;
   panel.setLayout(new BoxLayout(panel, orientation));
   if (isHorisontal()) {
     panel.setBorder(BorderFactory.createEmptyBorder(9, 0, 0, 0));
   } else {
     panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
   }
 }
Example #11
0
  public ComboBoxDemo2() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    String[] patternExamples = {
      "dd MMMMM yyyy",
      "dd.MM.yy",
      "MM/dd/yy",
      "yyyy.MM.dd G 'at' hh:mm:ss z",
      "EEE, MMM d, ''yy",
      "h:mm a",
      "H:mm:ss:SSS",
      "K:mm a,z",
      "yyyy.MMMMM.dd GGG hh:mm aaa"
    };

    currentPattern = patternExamples[0];

    // Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Enter the pattern string or");
    JLabel patternLabel2 = new JLabel("select one from the list:");

    JComboBox patternList = new JComboBox(patternExamples);
    patternList.setEditable(true);
    patternList.addActionListener(this);

    // Create the UI for displaying result.
    JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); // == LEFT
    result = new JLabel(" ");
    result.setForeground(Color.black);
    result.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // Lay out everything.
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternPanel.add(patternList);

    JPanel resultPanel = new JPanel(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(patternPanel);
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(resultPanel);

    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    reformat();
  } // constructor
Example #12
0
    public AppFrame() {
      // Create the WorldWindow.
      this.wwjPanel = new ApplicationTemplate.AppPanel(this.canvasSize, true);
      this.wwjPanel.setPreferredSize(canvasSize);

      ApplicationTemplate.insertBeforePlacenames(this.wwjPanel.getWwd(), layer);

      JPanel shapesPanel = makeShapeSelectionPanel();
      shapesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

      JPanel attrsPanel = makeAttributesPanel();
      attrsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

      // Put the pieces together.
      JPanel controlPanel = new JPanel(new BorderLayout());
      controlPanel.add(shapesPanel, BorderLayout.CENTER);
      JPanel p = new JPanel(new BorderLayout(6, 6));
      p.add(attrsPanel, BorderLayout.CENTER);
      controlPanel.add(p, BorderLayout.SOUTH);

      this.getContentPane().add(wwjPanel, BorderLayout.CENTER);
      this.getContentPane().add(controlPanel, BorderLayout.WEST);
      this.pack();

      // Center the application on the screen.
      Dimension prefSize = this.getPreferredSize();
      Dimension parentSize;
      java.awt.Point parentLocation = new java.awt.Point(0, 0);
      parentSize = Toolkit.getDefaultToolkit().getScreenSize();
      int x = parentLocation.x + (parentSize.width - prefSize.width) / 2;
      int y = parentLocation.y + (parentSize.height - prefSize.height) / 2;
      this.setLocation(x, y);
      this.setResizable(true);

      wwjPanel
          .getWwd()
          .addRenderingListener(
              new RenderingListener() {
                public void stageChanged(RenderingEvent event) {
                  if (!event.getStage().equals(RenderingEvent.BEFORE_BUFFER_SWAP)) return;

                  if (currentShape instanceof Polyline) {
                    Polyline p = (Polyline) currentShape;
                    String length = Double.toString(p.getLength());
                    textRenderer.beginRendering(wwjPanel.getWidth(), wwjPanel.getHeight());
                    textRenderer.draw(length, 100, 100);
                    textRenderer.endRendering();
                  }
                }
              });

      // Enable dragging and other selection responses
      this.setupSelection();
    }
    public MainFrame() {
      try {
        mainPanel.setLayout(new BorderLayout());
        mainPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9));
        mainPanel.add(outputContainer, java.awt.BorderLayout.CENTER);
        outputArea.setLineWrap(true);
        outputContainer.add(new JScrollPane(outputArea), java.awt.BorderLayout.CENTER);
        outputContainer.setBorder(new javax.swing.border.TitledBorder("Results"));

        this.getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER);

        java.util.ArrayList<JButton> btns = new java.util.ArrayList<JButton>();
        {
          JPanel westPanel = new JPanel(new GridLayout(0, 1, 0, 10));
          westPanel.setBorder(BorderFactory.createEmptyBorder(9, 9, 9, 9));
          JPanel opsPanel = new JPanel(new GridLayout(6, 1));
          opsPanel.setBorder(new javax.swing.border.TitledBorder("Operations"));

          for (Action action : operations) {
            JPanel p = new JPanel(new BorderLayout());
            JButton jb = new JButton(action);
            btns.add(jb);
            p.add(jb, BorderLayout.NORTH);
            opsPanel.add(p);
          }

          westPanel.add(opsPanel);
          controlContainer.add(westPanel, BorderLayout.CENTER);
        }

        this.getContentPane().add(controlContainer, BorderLayout.WEST);
        this.pack();

        Dimension dim = btns.get(0).getSize();
        for (JButton btn : btns) {
          btn.setPreferredSize(dim);
        }

        java.awt.Dimension prefSize = this.getPreferredSize();
        prefSize.setSize(prefSize.getWidth(), 1.1 * prefSize.getHeight());
        this.setSize(prefSize);

        java.awt.Dimension parentSize;
        java.awt.Point parentLocation = new java.awt.Point(0, 0);
        parentSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        int x = parentLocation.x + (parentSize.width - prefSize.width) / 2;
        int y = parentLocation.y + (parentSize.height - prefSize.height) / 2;
        this.setLocation(x, y);
        this.setResizable(true);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Example #14
0
    /**
     * Constructor.
     *
     * @param title the title of the tab component
     * @param editor the editor of the tab (used to close the tab)
     */
    public TabComponent(final AbstractEditorPanel editor) {

      setLayout(new BorderLayout());
      setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
      setOpaque(false);

      // title
      title = new JLabel(editor.getTitle());
      title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
      add(title, BorderLayout.WEST);

      // close
      final JButton close = new JButton(Project.getEditorImageIconOrEmpty("icon_cross.png"));
      close.setPreferredSize(new Dimension(16, 16));
      close.setUI(new BasicButtonUI());
      close.setBorderPainted(false);
      close.setOpaque(false);
      close.addActionListener(
          new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent ae) {
              removeEditor(editor, true);
            }
          });
      close.addMouseListener(
          new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent me) {}

            @Override
            public void mousePressed(MouseEvent me) {}

            @Override
            public void mouseReleased(MouseEvent me) {}

            @Override
            public void mouseEntered(MouseEvent me) {

              close.setBorderPainted(true);
            }

            @Override
            public void mouseExited(MouseEvent me) {

              close.setBorderPainted(false);
            }
          });
      add(close, BorderLayout.EAST);
    }
Example #15
0
  /**
   * Creates an instance of <tt>CallManager</tt>.
   *
   * @param mainFrame The main application window.
   */
  public CallManager(MainFrame mainFrame) {
    super(new BorderLayout());

    this.mainFrame = mainFrame;

    this.phoneNumberCombo = new CallComboBox(this);

    this.accountSelectorBox = new AccountSelectorBox(this);

    this.buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));

    this.comboPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5));

    this.init();
  }
Example #16
0
 private RobotDescriptionPanel getDescriptionPanel() {
   if (descriptionPanel == null) {
     descriptionPanel = new RobotDescriptionPanel();
     descriptionPanel.setBorder(BorderFactory.createEmptyBorder(1, 10, 1, 10));
   }
   return descriptionPanel;
 }
  /** Initializes the <tt>RenameContactDialog</tt> by adding the buttons, fields, etc. */
  private void init() {
    this.setTitle(GuiActivator.getResources().getI18NString("service.gui.RENAME_CONTACT"));

    this.getRootPane().setDefaultButton(renameButton);
    this.renameButton.setName("rename");
    this.cancelButton.setName("cancel");

    this.renameButton.setMnemonic(
        GuiActivator.getResources().getI18nMnemonic("service.gui.RENAME"));
    this.cancelButton.setMnemonic(
        GuiActivator.getResources().getI18nMnemonic("service.gui.CANCEL"));

    this.renameButton.addActionListener(this);
    this.cancelButton.addActionListener(this);

    this.buttonsPanel.add(renameButton);
    this.buttonsPanel.add(cancelButton);

    this.mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));

    this.mainPanel.add(renameContactPanel, BorderLayout.NORTH);
    this.mainPanel.add(buttonsPanel, BorderLayout.SOUTH);

    this.getContentPane().add(mainPanel);
  }
Example #18
0
  /**
   * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as
   * <tt>CallPeer</tt> display name, call duration, security status.
   *
   * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information
   *     such as <tt>CallPeer</tt> display name, call duration, security status
   */
  private Component createStatusBar() {
    // stateLabel
    callStatusLabel.setForeground(Color.WHITE);
    dtmfLabel.setForeground(Color.WHITE);
    callStatusLabel.setText(callPeer.getState().getLocalizedStateString());

    PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridx = 0;
    constraints.gridy = 0;
    statusPanel.add(securityStatusLabel, constraints);
    initSecurityStatusLabel();

    constraints.gridx++;
    statusPanel.add(holdStatusLabel, constraints);

    constraints.gridx++;
    statusPanel.add(muteStatusLabel, constraints);

    constraints.gridx++;
    callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12));
    statusPanel.add(callStatusLabel, constraints);

    constraints.gridx++;
    constraints.weightx = 1f;
    statusPanel.add(dtmfLabel, constraints);

    return statusPanel;
  }
Example #19
0
  public MainPanel() {
    super(new BorderLayout());
    JPanel p = new JPanel(new GridLayout(2, 1));
    final JComboBox<String> c0 = makeComboBox(true, false);
    final JComboBox<String> c1 = makeComboBox(false, false);
    final JComboBox<String> c2 = makeComboBox(true, true);
    final JComboBox<String> c3 = makeComboBox(false, true);

    p.add(makeTitlePanel("setEditable(false)", Arrays.asList(c0, c1)));
    p.add(makeTitlePanel("setEditable(true)", Arrays.asList(c2, c3)));
    p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(p, BorderLayout.NORTH);
    add(
        new JButton(
            new AbstractAction("add") {
              @Override
              public void actionPerformed(ActionEvent e) {
                String str = new Date().toString();
                for (JComboBox<String> c : Arrays.asList(c0, c1, c2, c3)) {
                  MutableComboBoxModel<String> m = (MutableComboBoxModel<String>) c.getModel();
                  m.insertElementAt(str, m.getSize());
                }
              }
            }),
        BorderLayout.SOUTH);
    setPreferredSize(new Dimension(320, 240));
  }
  private int addButton(SIPCommButton button, int gridX, int xBounds, boolean isLast) {
    lastAddedButton = button;

    constraints.insets = new Insets(0, 0, V_GAP, 0);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = gridX;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    this.add(button, constraints);

    int yBounds =
        TOP_BORDER
            + BOTTOM_BORDER
            + 2 * V_GAP
            + ComponentUtils.getStringSize(nameLabel, nameLabel.getText()).height
            + ComponentUtils.getStringSize(displayDetailsLabel, displayDetailsLabel.getText())
                .height;

    button.setBounds(xBounds, yBounds, BUTTON_WIDTH, BUTTON_HEIGHT);

    button.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    setButtonBg(button, gridX, isLast);

    return button.getWidth();
  }
 /** Sets the correct border depending on the contained object. */
 private void setBorder() {
   /*
    * !!! When changing border values we should make sure that we
    * recalculate the X and Y coordinates of the buttons added in
    * initButtonsPanel and initContactActionButtons functions. If not
    * correctly calculated problems may occur when clicking buttons!
    */
   if (treeNode instanceof ContactNode
       && !(((ContactNode) treeNode).getContactDescriptor() instanceof ShowMoreContact)) {
     this.setBorder(
         BorderFactory.createEmptyBorder(TOP_BORDER, LEFT_BORDER, BOTTOM_BORDER, RIGHT_BORDER));
   } else // GroupNode || ShowMoreContact
   {
     this.setBorder(BorderFactory.createEmptyBorder(0, LEFT_BORDER, 0, RIGHT_BORDER));
   }
 }
Example #22
0
  private MainPanel() {
    super(new GridLayout(3, 1, 5, 5));
    final JTree tree = new JTree();
    final JCheckBox c = new JCheckBox("CheckBox", true);
    c.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            tree.setEnabled(c.isSelected());
          }
        });
    c.setFocusPainted(false);
    JScrollPane l1 = new JScrollPane(tree);
    l1.setBorder(new ComponentTitledBorder(c, l1, BorderFactory.createEtchedBorder()));

    JLabel icon = new JLabel(new ImageIcon(getClass().getResource("16x16.png")));
    JLabel l2 = new JLabel("<html>aaaaaaaaaaaaaaaa<br>bbbbbbbbbbbbbbbbb");
    l2.setBorder(new ComponentTitledBorder(icon, l2, BorderFactory.createEtchedBorder()));

    JButton b = new JButton("Button");
    b.setFocusPainted(false);
    JLabel l3 = new JLabel("ccccccccccccccc");
    l3.setBorder(new ComponentTitledBorder(b, l3, BorderFactory.createEtchedBorder()));

    add(l1);
    add(l2);
    add(l3);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(320, 240));
  }
 private void jbInit() throws Exception {
   border1 = BorderFactory.createEmptyBorder(20, 20, 20, 20);
   contentPane.setBorder(border1);
   contentPane.setLayout(borderLayout1);
   controlsPane.setLayout(gridLayout1);
   gridLayout1.setColumns(1);
   gridLayout1.setHgap(10);
   gridLayout1.setRows(0);
   gridLayout1.setVgap(10);
   okButton.setVerifyInputWhenFocusTarget(true);
   okButton.setMnemonic('O');
   okButton.setText("OK");
   buttonsPane.setLayout(flowLayout1);
   flowLayout1.setAlignment(FlowLayout.CENTER);
   messagePane.setEditable(false);
   messagePane.setText("");
   borderLayout1.setHgap(10);
   borderLayout1.setVgap(10);
   this.setTitle("Subscription Authorization");
   this.getContentPane().add(contentPane, BorderLayout.CENTER);
   contentPane.add(controlsPane, BorderLayout.SOUTH);
   controlsPane.add(responsesComboBox, null);
   controlsPane.add(buttonsPane, null);
   buttonsPane.add(okButton, null);
   contentPane.add(messageScrollPane, BorderLayout.CENTER);
   messageScrollPane.getViewport().add(messagePane, null);
 }
Example #24
0
 public MainPanel() {
   super(new BorderLayout());
   panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
   panel.add(
       makePanel(
           "Look&Feel Default",
           new JButton(
               new AbstractAction("showMessageDialog1") {
                 @Override
                 public void actionPerformed(ActionEvent e) {
                   JOptionPane.showMessageDialog(panel, "showMessageDialog1");
                 }
               })));
   panel.add(
       makePanel(
           "notice2.wav",
           new JButton(
               new AbstractAction("showMessageDialog2") {
                 @Override
                 public void actionPerformed(ActionEvent e) {
                   UIManager.put(
                       "AuditoryCues.playList", UIManager.get("AuditoryCues.noAuditoryCues"));
                   loadAndPlayAudio("notice2.wav");
                   JOptionPane.showMessageDialog(panel, "showMessageDialog2");
                   UIManager.put("AuditoryCues.playList", OPTION_PANE_AUDITORY_CUES);
                 }
               })));
   JMenuBar mb = new JMenuBar();
   mb.add(LookAndFeelUtil.createLookAndFeelMenu());
   add(mb, BorderLayout.NORTH);
   add(panel);
   setPreferredSize(new Dimension(320, 240));
 }
    private ColorWheelPanel(
        ColorListener listener, boolean enableOpacity, boolean opacityInPercent) {
      setLayout(new BorderLayout());
      setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

      myColorWheel = new ColorWheel();
      add(myColorWheel, BorderLayout.CENTER);

      myColorWheel.addListener(listener);

      myBrightnessComponent = new SlideComponent("Brightness", true);
      myBrightnessComponent.setToolTipText("Brightness");
      myBrightnessComponent.addListener(
          value -> {
            myColorWheel.setBrightness(1f - (value / 255f));
            myColorWheel.repaint();
          });

      add(myBrightnessComponent, BorderLayout.EAST);

      if (enableOpacity) {
        myOpacityComponent = new SlideComponent("Opacity", false);
        myOpacityComponent.setUnits(
            opacityInPercent ? SlideComponent.Unit.PERCENT : SlideComponent.Unit.LEVEL);
        myOpacityComponent.setToolTipText("Opacity");
        myOpacityComponent.addListener(
            integer -> {
              myColorWheel.setOpacity(integer.intValue());
              myColorWheel.repaint();
            });

        add(myOpacityComponent, BorderLayout.SOUTH);
      }
    }
  /**
   * Creates an instance of the <tt>LoginWindow</tt>.
   *
   * @param chatRoom the chat room for which we're authenticating
   */
  public ChatRoomAuthenticationWindow(ChatRoomWrapper chatRoom) {
    this.chatRoom = chatRoom;

    ImageIcon logoImage = new ImageIcon(chatRoom.getParentProvider().getImage());

    backgroundPanel = new LoginWindowBackground(logoImage);

    this.backgroundPanel.setPreferredSize(new Dimension(420, 230));

    this.backgroundPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    this.backgroundPanel.setBorder(BorderFactory.createEmptyBorder(20, 5, 5, 5));

    this.getContentPane().setLayout(new BorderLayout());

    this.init();

    this.getContentPane().add(backgroundPanel, BorderLayout.CENTER);

    this.setResizable(false);

    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    this.setTitle(
        GuiActivator.getResources()
            .getI18NString(
                "service.gui.AUTHENTICATION_WINDOW_TITLE",
                new String[] {chatRoom.getParentProvider().getName()}));

    this.enableKeyActions();
  }
  public TestSwingExample1() {
    super("ActionExample");

    setChannel(currentChannel); // enable/disable the Actions as appropriate

    channelLabel.setHorizontalAlignment(JLabel.CENTER);
    channelLabel.setFont(new Font("Serif", Font.PLAIN, 32));

    getContentPane().add(channelLabel, BorderLayout.NORTH);

    JPanel buttonPanel = new JPanel(new GridLayout(2, 2, 16, 6));
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(6, 16, 16, 16));
    getContentPane().add(buttonPanel, BorderLayout.CENTER);

    buttonPanel.add(new JButton(upAction));
    buttonPanel.add(new JButton(gotoFavoriteAction));
    buttonPanel.add(new JButton(downAction));
    buttonPanel.add(new JButton(setFavoriteAction));

    JMenuBar mb = new JMenuBar();
    JMenu menu = new JMenu("Channel");
    menu.add(new JMenuItem(upAction));
    menu.add(new JMenuItem(downAction));
    menu.addSeparator();
    menu.add(new JMenuItem(gotoFavoriteAction));
    menu.add(new JMenuItem(setFavoriteAction));
    mb.add(menu);
    setJMenuBar(mb);
  }
Example #28
0
  /** {@inheritDoc} */
  @Override
  public Component getListCellRendererComponent(
      JList list,
      final Object value,
      final int index,
      boolean isSelected,
      final boolean cellHasFocus) {

    Component label = getObjectComponent(list, value, index, isSelected, cellHasFocus);
    if (label instanceof JComponent) ((JComponent) label).setOpaque(false);

    panel.removeAll();
    panel.add(label);
    panel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    panel.restoreBackground();

    if (cellHasFocus)
      if (panel.isBackgroundRestored())
        panel.setBackground(UIUtils.setAlpha(list.getSelectionBackground(), 100));
      else panel.setBorder(BorderFactory.createLineBorder(list.getSelectionBackground()));

    if (isSelected)
      if (panel.isBackgroundRestored())
        panel.setBackground(UIUtils.setAlpha(list.getSelectionBackground(), 200));
      else panel.setBorder(BorderFactory.createLineBorder(list.getSelectionBackground()));

    if (index == hoveredIndex) panel.mouseEntered(null);

    return panel;
  }
Example #29
0
  public CreInvChecker(Component parent) {
    typeButtons = new JCheckBox[CHECKTYPES.length];
    JPanel boxPanel = new JPanel(new GridLayout(0, 1));
    for (int i = 0; i < typeButtons.length; i++) {
      typeButtons[i] = new JCheckBox(CHECKTYPES[i], true);
      boxPanel.add(typeButtons[i]);
    }
    bstart.setMnemonic('s');
    bcancel.setMnemonic('c');
    bstart.addActionListener(this);
    bcancel.addActionListener(this);
    selectframe.getRootPane().setDefaultButton(bstart);
    selectframe.setIconImage(Icons.getIcon("Find16.gif").getImage());
    boxPanel.setBorder(BorderFactory.createTitledBorder("Select test to check:"));

    JPanel bpanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
    bpanel.add(bstart);
    bpanel.add(bcancel);

    JPanel mainpanel = new JPanel(new BorderLayout());
    mainpanel.add(boxPanel, BorderLayout.CENTER);
    mainpanel.add(bpanel, BorderLayout.SOUTH);
    mainpanel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

    JPanel pane = (JPanel) selectframe.getContentPane();
    pane.setLayout(new BorderLayout());
    pane.add(mainpanel, BorderLayout.CENTER);

    selectframe.pack();
    Center.center(selectframe, parent.getBounds());
    selectframe.setVisible(true);
  }
Example #30
0
  void jbInit() throws Exception {

    setLayout(new AlignLayout(2, 5, 5));

    all = new JRadioButton("All");

    all.setSelected(true);

    select = new JRadioButton("User Data");
    select.setSelected(false);
    select.addItemListener(
        new java.awt.event.ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            select_itemStateChanged(e);
          }
        });

    userData = new JTextField(15);
    //      userData.setEnabled(false);
    ToggleDocument td = new ToggleDocument();
    td.addToggleDocumentListener(this);
    userData.setDocument(td);

    ButtonGroup bg = new ButtonGroup();
    bg.add(all);
    bg.add(select);

    add(all);
    add(new JLabel(""));
    add(select);
    add(userData);

    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  }