コード例 #1
1
  /**
   * 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();
  }
コード例 #2
1
  private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) {
    final JTable theTable = new JTable();
    PrimitiveFormPropertyPair pfpPair =
        new PrimitiveFormPropertyPair(primitiveForm.getName(), property);
    _dynamicTables.put(pfpPair, theTable);
    DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType();
    final DynamicDOTItemManager tableModel =
        (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property);
    theTable.setModel(tableModel);

    class NumberComparator implements Comparator<Number> {

      public int compare(Number o1, Number o2) {
        final double d1 = o1.doubleValue();
        final double d2 = o2.doubleValue();
        if (d1 < d2) {
          return -1;
        }
        if (d1 == d2) {
          return 0;
        }
        return 1;
      }
    }
    TableRowSorter<DynamicDOTItemManager> tableRowSorter =
        new TableRowSorter<DynamicDOTItemManager>();
    tableRowSorter.setModel(tableModel);
    tableRowSorter.setComparator(4, new NumberComparator());
    tableRowSorter.setComparator(5, new NumberComparator());
    theTable.setRowSorter(tableRowSorter);

    JButton newDOTItemButton = new JButton("Neue Zeile");
    newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable());
    JButton deleteDOTItemButton = new JButton("Zeile löschen");
    deleteDOTItemButton.setEnabled(false);
    JButton showConflictsButton = new JButton("Zeige Konflikte");

    addButtonListeners(
        primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton);
    addListSelectionListener(theTable, deleteDOTItemButton);

    JPanel dotButtonsPanel = new JPanel();
    dotButtonsPanel.setLayout(new SpringLayout());

    dotButtonsPanel.add(newDOTItemButton);
    dotButtonsPanel.add(deleteDOTItemButton);
    dotButtonsPanel.add(showConflictsButton);

    dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
    SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20);

    JPanel thePanel = new JPanel();
    thePanel.setLayout(new SpringLayout());
    thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK));
    thePanel.add(new JScrollPane(theTable));
    thePanel.add(dotButtonsPanel);
    SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5);

    return thePanel;
  }
コード例 #3
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));
  }
コード例 #4
0
 /**
  * Renvoit le JPanel à afficher, avec en paramètre un booléen indiquant s'il s'agit du dernier
  * élément à afficher dans une liste d'enfants (auquel cas un bouton + peut être affiché)
  */
 private JPanel getPanel(final boolean dernier) {
   panelEnfants = new JPanel(new GridBagLayout());
   panelElement = new JPanel(new BorderLayout());
   if (!attribut && affParent != null && affParent.enfantsMultiples(refNoeud)) {
     final JPanel panelBoutons = new JPanel(new BorderLayout());
     if (dernier) {
       final JButton boutonPlus = new JButton("+");
       boutonPlus.setAction(
           new AbstractAction("+") {
             public void actionPerformed(final ActionEvent e) {
               affParent.ajouterAffichageEnfant(AffichageFormulaire.this);
             }
           });
       panelBoutons.add(boutonPlus, BorderLayout.WEST);
     }
     final JButton boutonMoins = new JButton("-");
     boutonMoins.setAction(
         new AbstractAction("-") {
           public void actionPerformed(final ActionEvent e) {
             affParent.retirerAffichageEnfant(AffichageFormulaire.this);
           }
         });
     panelBoutons.add(boutonMoins, BorderLayout.EAST);
     panelElement.add(panelBoutons, BorderLayout.EAST);
     panelElement.add(panelEnfants, BorderLayout.CENTER);
   } else panelElement.add(panelEnfants, BorderLayout.CENTER);
   if (affParent != null) {
     panelElement.add(getPanelTitre(), BorderLayout.NORTH);
     panelEnfants.setBorder(
         BorderFactory.createCompoundBorder(
             BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
     panelElement.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
   }
   majPanel(null);
   if (affParent == null) {
     panelEnfants.setFocusCycleRoot(true);
     panelElement =
         new JPanel(new BorderLayout()) {
           @Override
           public Dimension getMaximumSize() {
             if (System.getProperty("os.name")
                 .startsWith("Mac OS")) { // curseur pas visible à droite sur la JVM d'Apple avec
               // getMaximumSize()
               final Dimension tps = doc.textPane.getSize();
               final JaxeElement je = doc.getElementForNode(noeud);
               return (new Dimension(tps.width - 20 * (je.indentations() + 1) - 2, tps.height));
             }
             return (super.getMaximumSize());
           }
         };
     panelElement.setOpaque(false);
     panelElement.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
     panelEnfants.setBorder(
         BorderFactory.createCompoundBorder(
             BorderFactory.createTitledBorder(getTitre()),
             BorderFactory.createEmptyBorder(5, 5, 5, 5)));
     panelElement.add(panelEnfants, BorderLayout.CENTER);
   }
   return (panelElement);
 }
コード例 #5
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);
    }
コード例 #6
0
  @Override
  protected void changeBorder() {
    int flags;

    Border empty = BorderFactory.createEmptyBorder();

    int iInsets = bSmallTitle ? 0 : 2;

    if (getOrientation().isHorizontal()) {
      flags = CEclipseBorder.TOP_RIGHT | CEclipseBorder.BOTTOM_RIGHT;
      empty = new EmptyBorder(iInsets, 2, iInsets, 4);
    } else {
      flags = CEclipseBorder.BOTTOM_LEFT | CEclipseBorder.BOTTOM_RIGHT;
      empty = new EmptyBorder(2, iInsets, 4, iInsets);
    }

    Border border = new CEclipseBorder(getOrigin().getController(), 6, flags);

    Insets ins = getOutsideInsets();
    Border b =
        new CompoundBorder(
            BorderFactory.createEmptyBorder(ins.top, ins.left, ins.bottom, ins.right),
            new CompoundBorder(border, empty));

    setBorder(ThemeManager.BORDER_MODIFIER + ".title.eclipse.button.flat", b);
  }
コード例 #7
0
ファイル: PasswordField.java プロジェクト: zhilu/classifier
  public PasswordField(String label) {
    setLayout(new BorderLayout());
    m_label = new JLabel(label);

    if (label.length() > 0) {
      m_label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
    }
    add(m_label, BorderLayout.WEST);

    m_password = new JPasswordField();
    m_password.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyReleased(KeyEvent e) {
            super.keyReleased(e);
            m_support.firePropertyChange("", null, null);
          }
        });
    m_password.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusLost(FocusEvent e) {
            super.focusLost(e);
            m_support.firePropertyChange("", null, null);
          }
        });

    add(m_password, BorderLayout.CENTER);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  }
コード例 #8
0
    @Override
    public Object[] createKeysAndValues() {
      return new Object[] {
        // Tab control - XXX REPLACE WITH RelativeColor - need to figure out base
        // colors for each color
        TAB_FOCUS_FILL_DARK, new Color(210, 220, 243),
        TAB_FOCUS_FILL_BRIGHT, new Color(238, 242, 253),
        TAB_UNSEL_FILL_DARK, new Color(236, 235, 229),
        TAB_UNSEL_FILL_BRIGHT, new Color(252, 251, 246),
        TAB_SEL_FILL, Color.white,
        TAB_SEL_FILL_BRIGHT, Color.white,
        TAB_SEL_FILL_DARK, new Color(243, 241, 224),
        TAB_BORDER, new Color(145, 167, 180),
        TAB_BOTTOM_BORDER, new Color(127, 157, 185),
        TAB_SEL_BORDER, new Color(145, 155, 156),
        TAB_HIGHLIGHT_HEADER, new Color(230, 139, 44),
        TAB_HIGHLIGHT_HEADER_FILL, new Color(255, 199, 60),
        STANDARD_BORDER, new Color(127, 157, 185),
        TAB_CLOSE_BUTTON, Color.black,
        TAB_CLOSE_BUTTON_HIGHLIGHT, new Color(172, 57, 28),
        TAB_CLOSE_BUTTON_BORDER_FOCUS, new Color(181, 201, 243),
        TAB_CLOSE_BUTTON_BORDER_SELECTED, new Color(203, 202, 187),
        TAB_CLOSE_BUTTON_BORDER_UNSEL, new Color(200, 201, 192),
        TAB_SEL_BOTTOM_BORDER, new Color(238, 235, 218),

        // Borders for the tab control
        EDITOR_TAB_OUTER_BORDER, BorderFactory.createEmptyBorder(),
        EDITOR_TAB_CONTENT_BORDER, new MatteBorder(0, 1, 1, 1, new Color(127, 157, 185)),
        EDITOR_TAB_TABS_BORDER, BorderFactory.createEmptyBorder(),
        VIEW_TAB_OUTER_BORDER, BorderFactory.createEmptyBorder(),
        VIEW_TAB_CONTENT_BORDER, new MatteBorder(0, 1, 1, 1, new Color(127, 157, 185)),
        VIEW_TAB_TABS_BORDER, BorderFactory.createEmptyBorder(),
      };
    }
コード例 #9
0
ファイル: Frame1_AboutBox.java プロジェクト: pedrocleto/Java
 /**
  * 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);
 }
コード例 #10
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));
  }
コード例 #11
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);
  }
コード例 #12
0
  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);
  }
コード例 #13
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;
 }
コード例 #14
0
  @Override
  protected JComponent createCenterPanel() {
    final JPanel panel = new JPanel(new BorderLayout());
    JTextArea area =
        new JTextArea(
            "The imported language extends other languages.\n"
                + "It might be useful to import all or some of them.");
    area.setEditable(false);
    area.setBackground(this.getContentPane().getBackground());
    area.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));
    panel.add(area, BorderLayout.NORTH);

    JPanel center = new JPanel(new GridBagLayout());
    JTextArea label = new JTextArea("Select additional languages to import:");
    label.setEditable(false);
    label.setBackground(getContentPane().getBackground());
    label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    center.add(
        label,
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            0.0,
            GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL,
            new Insets(0, 0, 0, 0),
            0,
            0));

    myList = new JBList(myCandidates.toArray());

    myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    myList.setSelectionInterval(0, myList.getModel().getSize() - 1);
    myList.setCellRenderer(new MyDefaultListCellRenderer());
    myList.setBorder(BorderFactory.createEtchedBorder());
    center.add(
        ScrollPaneFactory.createScrollPane(myList),
        new GridBagConstraints(
            0,
            GridBagConstraints.RELATIVE,
            1,
            1,
            1.0,
            1.0,
            GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    panel.add(center, BorderLayout.CENTER);
    panel.setPreferredSize(new Dimension(400, 250));

    return panel;
  }
コード例 #15
0
 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));
   }
 }
コード例 #16
0
ファイル: ComboBoxDemo2.java プロジェクト: aki-s/emacs.pub
  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
 public AppSubscriptionsPanel(
     final ClientDavConnection connection,
     final ClientApplication clientApplication,
     final DavApplication dav) {
   super(new BorderLayout());
   _jSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
   ApplicationSubscriptionInfo subscriptionInfo;
   try {
     subscriptionInfo = connection.getSubscriptionInfo(dav, clientApplication);
   } catch (IOException e) {
     subscriptionInfo = null;
     e.printStackTrace();
     JOptionPane.showMessageDialog(
         this, "Konnte die Anmeldungen nicht auflisten. " + e.getMessage());
   }
   final TitledBorder sendBorder =
       BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Sende-Anmeldungen");
   final TitledBorder receiveBorder =
       BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Empfangs-Anmeldungen");
   final TitledBorder labelBorder = BorderFactory.createTitledBorder("Details");
   final JComponent paneSend = new JPanel(new BorderLayout());
   _senderList =
       new JList(
           new MyListModel(
               subscriptionInfo == null
                   ? Collections.emptyList()
                   : subscriptionInfo.getSenderSubscriptions()));
   paneSend.add(new JScrollPane(_senderList), BorderLayout.CENTER);
   final JComponent paneReceive = new JPanel(new BorderLayout());
   _receiverList =
       new JList(
           new MyListModel(
               subscriptionInfo == null
                   ? Collections.emptyList()
                   : subscriptionInfo.getReceiverSubscriptions()));
   paneReceive.add(new JScrollPane(_receiverList), BorderLayout.CENTER);
   paneSend.setBorder(sendBorder);
   paneReceive.setBorder(receiveBorder);
   _jSplitPane.setLeftComponent(paneSend);
   _jSplitPane.setRightComponent(paneReceive);
   _jSplitPane.setResizeWeight(0.5);
   _senderList.addMouseListener(new MyMouseListener(_senderList));
   _receiverList.addMouseListener(new MyMouseListener(_receiverList));
   _senderList.setFocusable(false);
   _receiverList.setFocusable(false);
   this.add(_jSplitPane, BorderLayout.CENTER);
   _label = new JEditorPane("text/html", "");
   _label.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
   _label.setFont(_label.getFont().deriveFont(Font.PLAIN));
   _label.setBorder(labelBorder);
   _label.setEditable(false);
   final JScrollPane pane = new JScrollPane(_label);
   pane.setBorder(BorderFactory.createEmptyBorder());
   pane.setPreferredSize(new Dimension(400, 160));
   this.add(pane, BorderLayout.SOUTH);
 }
コード例 #18
0
ファイル: Shapes.java プロジェクト: syzh1991/DigitalEarth
    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();
    }
コード例 #19
0
    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();
      }
    }
コード例 #20
0
  /** Lays all of the UI components used by the app into the mainframe's default container panel. */
  private void layoutComponents() {
    final JPanel topPanel = layoutTopPanel();
    final JPanel centerPanel = layoutCenterPanel();
    final JPanel buttonPanel = layoutButtonPanel();

    // when adding the content to the root panel we must follow the look &
    // feel guidelines which state 2 padding units between the edges of the
    // root panel and the components. If the bottom and right components
    // are 3D or shadowed components then it should be 2 padding units - 1
    // for consistency.

    // the top panel gives us our border for the top and left sides
    final Border topBorder =
        BorderFactory.createEmptyBorder(
            LFPAD * 2, // top
            LFPAD * 2, // left
            0, // bottom
            LFPAD * 2 - 1); // right
    topPanel.setBorder(topBorder);

    // the center border needs to have a visible separation from the top
    // panel components
    final Border centerBorder =
        BorderFactory.createEmptyBorder(
            LFPAD * 2, // top
            LFPAD * 2, // left
            0, // bottom
            LFPAD * 2 - 1); // right
    centerPanel.setBorder(centerBorder);

    // the bottom panel gives us our border for the bottom and right sides
    // and also must be separated from the top panel by 3 padding units - 1
    // to give any buttons appropriate spacing
    final Border bottomBorder =
        BorderFactory.createEmptyBorder(
            LFPAD * 3 - 1, // top
            LFPAD * 2, // left
            LFPAD * 2 - 1, // bottom
            LFPAD * 2 - 1); // right
    buttonPanel.setBorder(bottomBorder);

    // finally, change our root panel to have a BorderLayout and force the
    // top panel to use the North section and the bottom panel to use the
    // South section. this will allow the root panel to be resized freely
    // and the other panels should react correctly in both grow and shrink
    // resizing scenarios.
    final JPanel contentPanel = (JPanel) getContentPane();
    contentPanel.setLayout(new BorderLayout());
    contentPanel.add(topPanel, BorderLayout.NORTH);
    contentPanel.add(centerPanel, BorderLayout.CENTER);
    contentPanel.add(buttonPanel, BorderLayout.SOUTH);
  }
コード例 #21
0
ファイル: EditorTabs.java プロジェクト: kenygia/solarus
    /**
     * 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);
    }
コード例 #22
0
ファイル: Frame.java プロジェクト: danalor1/2048-java
  public Frame(boolean isStar) {
    super("2048");
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new BorderLayout());
    this.isStar = isStar;

    background = new JLabel(new ImageIcon("Images\\background.png"));
    this.setResizable(false);
    add(background);
    background.setLayout(new FlowLayout());
    newGameButton = new JButton(new ImageIcon("Images\\newGame.png"));
    recordTableButton = new JButton(new ImageIcon("Images\\recordTableButton.png"));
    designButton = new JButton(new ImageIcon("Images\\changeDesign.png"));
    newGameButton.setBorder(BorderFactory.createEmptyBorder());
    newGameButton.setContentAreaFilled(false);
    recordTableButton.setBorder(BorderFactory.createEmptyBorder());
    recordTableButton.setContentAreaFilled(false);
    designButton.setBorder(BorderFactory.createEmptyBorder());
    designButton.setContentAreaFilled(false);
    background.add(newGameButton);
    background.add(recordTableButton);
    background.add(designButton);
    newGameButton.addActionListener(this);
    recordTableButton.addActionListener(this);
    designButton.addActionListener(this);
    this.addKeyListener(this);
    board = new Board(highscores, this);
    this.pack();
    nextImage = new JLabel(new ImageIcon("images\\next2.png"));
    background.add(board.getBoard());
    background.add(nextImage);
    background.add(board.getScoreLabel());
    if (isStar != this.board.getChangedDesign()) {
      this.board.ChaneDesign();

      background.setIcon(new ImageIcon("Images\\Background2.png"));
      newGameButton.setIcon(new ImageIcon("Images\\newGameStar.png"));
      recordTableButton.setIcon(new ImageIcon("Images\\recordTableStarButton.png"));
      designButton.setIcon(new ImageIcon("Images\\changeDesignStar.png"));
      nextImage.setIcon(new ImageIcon("Images\\next2Star.png"));
      this.board.getScoreLabel().setText("Stars collected:" + this.board.getScore().getScore());
    }

    // board.ChaneDesign();

    this.setSize(476, 570);
    this.pack();
    this.setVisible(true);
    this.requestFocusInWindow();
  }
コード例 #23
0
  private JPanel createTopPanel(YWorkItem item) {
    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.setBackground(YAdminGUI._apiColour);

    JPanel leftPanel = new JPanel(new BorderLayout());
    leftPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    JTextArea explanatoryText = new JTextArea();
    explanatoryText.setText(
        "The data you submitted for this work item was \n"
            + "validated against a schema (see below).  For some reason the\n"
            + "this data did not succeed in passing the constrainst set\n"
            + "inside the schema.\n"
            + "Usage Note: If this is causing problems try using the Web server\n"
            + "version of YAWL, which supports automatic forms generation.\n"
            + "Otherwise you could copy the schema from this page and use it\n "
            + "to create a valid output document using an XML development tool.");
    explanatoryText.setEditable(false);
    explanatoryText.setFont(new Font("Arial", Font.BOLD, 12));
    explanatoryText.setForeground(Color.DARK_GRAY);
    explanatoryText.setBackground(YAdminGUI._apiColour);
    leftPanel.add(explanatoryText);
    topPanel.add(leftPanel, BorderLayout.WEST);

    JPanel rightPanel = new JPanel(new GridLayout(4, 2));

    rightPanel.setBackground(YAdminGUI._apiColour);
    rightPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "Work Item Details"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    YTask task =
        YEngine.getInstance().getTaskDefinition(item.getSpecificationID(), item.getTaskID());
    String taskName = task.getName();

    String[] text = {
      item.getSpecificationID().toString(), taskName, item.getIDString(), item.getStartTimeStr()
    };
    String[] labels = {"Specification ID", "Task Name", "WorkItem ID", "Task Started"};
    for (int i = 0; i < text.length; i++) {
      String s = text[i];
      rightPanel.add(new JLabel(labels[i]));
      JTextField t = new JTextField(s);
      t.setEditable(false);
      rightPanel.add(t);
    }
    topPanel.add(rightPanel, BorderLayout.CENTER);
    return topPanel;
  }
コード例 #24
0
  public static void main(String[] args) {
    JFrame frame = new JFrame("Demo of Additional Borders");
    frame.setIconImage(JideIconsFactory.getImageIcon(JideIconsFactory.JIDE32).getImage());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new BorderLayout());

    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
    panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS, 10));

    JTextArea textField = new JTextArea();
    JPanel border = new JPanel(new BorderLayout());
    border.setPreferredSize(new Dimension(100, 100));
    border.add(new JScrollPane(textField), BorderLayout.CENTER);
    border.setBorder(
        new JideTitledBorder(
            new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH),
            "PartialEtchedBorder"));

    JTextArea textField2 = new JTextArea();
    JPanel border2 = new JPanel(new BorderLayout());
    border2.setPreferredSize(new Dimension(100, 100));
    border2.add(new JScrollPane(textField2), BorderLayout.CENTER);
    border2.setBorder(
        new JideTitledBorder(
            new PartialLineBorder(Color.darkGray, 1, PartialSide.NORTH), "PartialLineBorder"));

    JTextArea textField3 = new JTextArea();
    JPanel border3 = new JPanel(new BorderLayout());
    border3.setPreferredSize(new Dimension(100, 100));
    border3.add(new JScrollPane(textField3), BorderLayout.CENTER);
    border3.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                new PartialLineBorder(Color.gray, 1, true), "Rounded Corners Border"),
            BorderFactory.createEmptyBorder(0, 6, 4, 6)));

    panel.add(border, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createVerticalStrut(12));
    panel.add(border2, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createVerticalStrut(12));
    panel.add(border3, JideBoxLayout.FLEXIBLE);
    panel.add(Box.createGlue(), JideBoxLayout.VARY);

    panel.setPreferredSize(new Dimension(500, 400));
    frame.getContentPane().add(panel, BorderLayout.CENTER);
    frame.pack();
    frame.setVisible(true);
  }
コード例 #25
0
ファイル: CallManager.java プロジェクト: ymatlashenko/olyo
  /**
   * 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();
  }
コード例 #26
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);
  }
コード例 #27
0
  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);
  }
コード例 #28
0
  /**
   * 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();
  }
コード例 #29
0
    private void addComponents() {
      this.setLayout(new BorderLayout());
      this.setSize(new Dimension(350, 200));
      // set display location
      Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
      this.setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);

      textArea = new JTextArea();
      textArea.setLineWrap(true);
      textArea.setEditable(false);
      textArea.setBorder(BorderFactory.createLineBorder(Color.gray));
      JScrollPane scrollPane =
          new JScrollPane(
              textArea,
              JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
              JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      scrollPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
      this.add(scrollPane, BorderLayout.CENTER);

      JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
      JButton closeButton = new JButton("Close");
      closeButton.addActionListener(
          new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              PopupDialog.this.setVisible(false);
            }
          });
      buttonPanel.add(closeButton);
      this.add(buttonPanel, BorderLayout.SOUTH);
    }
コード例 #30
-1
  public BaseGoogleLoginUI(@NotNull String signinText) {
    setLayout(new GridBagLayout());
    setPreferredSize(new Dimension(MIN_WIDTH, PREFERRED_HEIGHT));
    setOpaque(false);

    JLabel googleIcon = new JBLabel();

    setBorder(BorderFactory.createEmptyBorder(10, 15, 15, 15));
    googleIcon.setHorizontalAlignment(SwingConstants.CENTER);
    googleIcon.setVerticalAlignment(SwingConstants.CENTER);
    googleIcon.setOpaque(false);
    googleIcon.setIcon(GoogleLoginIcons.GOOGLE_LOGO);
    googleIcon.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.weighty = 0;
    add(googleIcon, c);

    JTextArea signinTextArea = new JTextArea();
    signinTextArea.setFont(UIUtil.getLabelFont());
    signinTextArea.setLineWrap(true);
    signinTextArea.setWrapStyleWord(true);
    signinTextArea.setOpaque(false);
    signinTextArea.setText(signinText);
    c.gridx = 0;
    c.gridy = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.CENTER;
    add(signinTextArea, c);
  }