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;
  }
Esempio n. 2
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();
  }
    public DisplayUserDirectory() {
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);

      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.fill = GridBagConstraints.HORIZONTAL;

      hmlabel.setForeground(Color.black);
      add(hmlabel, gbc);
      add(Box.createHorizontalStrut(10), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(hmdir, gbc);
      add(Box.createVerticalStrut(15), gbc);

      gbc.gridwidth = 1;
      vjlabel.setForeground(Color.black);
      add(vjlabel, gbc);
      add(Box.createHorizontalStrut(10), gbc);
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(vjdir, gbc);
      add(Box.createVerticalStrut(0), gbc);

      gbc.gridwidth = 1;
      vjlabel2.setForeground(Color.black);
      add(vjlabel2, gbc);
      setBorder(
          new CompoundBorder(
              // i18n
              // BorderFactory.createTitledBorder(" User_Directories "),
              BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
  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);
  }
Esempio n. 5
0
  /** @param frameName title name for frame */
  public ShowSavedResults(String frameName) {
    super(frameName);
    aboutRes =
        new JTextArea(
            "Select a result set from"
                + "\nthose listed and details"
                + "\nof that analysis will be"
                + "\nshown here. Then you can"
                + "\neither delete or view those"
                + "\nresults using the buttons below.");
    aboutScroll = new JScrollPane(aboutRes);
    ss = new JScrollPane(sp);
    ss.getViewport().setBackground(Color.white);

    //  resMenu.setLayout(new FlowLayout(FlowLayout.LEFT,10,1));
    ClassLoader cl = getClass().getClassLoader();
    rfii = new ImageIcon(cl.getResource("images/Refresh_button.gif"));

    // results status
    resButtonStatus = new JPanel(new BorderLayout());
    Border loweredbevel = BorderFactory.createLoweredBevelBorder();
    Border raisedbevel = BorderFactory.createRaisedBevelBorder();
    Border compound = BorderFactory.createCompoundBorder(raisedbevel, loweredbevel);
    statusField = new JTextField();
    statusField.setBorder(compound);
    statusField.setEditable(false);
  }
Esempio n. 6
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));
  }
Esempio n. 7
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;
  }
Esempio n. 8
0
  public FloorPanel(int floorNumber, String title, int directions) {
    super();

    setBackground(Color.GRAY);
    setLayout(new GridLayout(1, 2));

    Border border =
        BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK), title);
    setBorder(border);

    if (directions == Constants.DIRECTION_UP || directions == Constants.DIRECTION_BOTH) {
      // up button
      up = new JButton(UIUtils.UP_ARROW);
      add(up);
      up.addActionListener(this);
    }

    if (directions == Constants.DIRECTION_DOWN || directions == Constants.DIRECTION_BOTH) {
      // down button
      down = new JButton(UIUtils.DOWN_ARROW);
      add(down);
      down.addActionListener(this);
    }

    this.floorNumber = floorNumber;
  }
  private JComponent createLabelsPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(0, 2, 10, 1));

    // Creates a StyledLabel to warn up so that we don't include class loading time into the
    // performance test.
    // This is the same for all three cases.
    new JLabel("Bold Italic Underlined");

    long start = System.currentTimeMillis();
    for (int i = 0; i < COUNT; i++) {
      JLabel label = new JLabel("Bold Italic Underlined");
      panel.add(label);
    }
    panel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                new PartialLineBorder(Color.gray, 1, true),
                " JLabel (Plain) Examples - use " + (System.currentTimeMillis() - start) + " ms ",
                TitledBorder.CENTER,
                TitledBorder.CENTER,
                null,
                Color.RED),
            BorderFactory.createEmptyBorder(6, 4, 4, 4)));
    return panel;
  }
  @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);
  }
Esempio n. 11
0
  private JPanel createCentrePanel(YDataStateException exception) {
    JPanel centrePanel = new JPanel(new GridLayout(1, 2));

    JPanel msgPanel = new JPanel(new BorderLayout());
    msgPanel.setBackground(YAdminGUI._apiColour);
    msgPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "Schema for completing task"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    JTextPane msgTextPane = new JTextPane();
    msgTextPane.setContentType("text/plain");
    msgTextPane.setFont(new Font("courier", Font.PLAIN, 12));
    msgTextPane.setForeground(Color.RED);

    msgTextPane.setText(exception.getMessage());
    msgTextPane.setEditable(false);
    msgTextPane.setBackground(Color.LIGHT_GRAY);
    JPanel noWrapPanel = new JPanel();
    noWrapPanel.setLayout(new BorderLayout());
    noWrapPanel.add(msgTextPane);
    msgPanel.add(new JScrollPane(noWrapPanel));

    centrePanel.add(msgPanel, BorderLayout.NORTH);
    return centrePanel;
  }
Esempio n. 12
0
  // {{{createCenterPanelAll() method
  public JPanel createCenterPanelAll() {
    long filesSize = 0L;
    JPanel centerPanel = new JPanel(new BorderLayout());

    for (VFSFile selectedFile : selectedFiles) {
      if (selectedFile.getType() == VFSFile.DIRECTORY) {
        File ioFile = new File(selectedFile.getPath());
        filesSize += IOUtilities.fileLength(ioFile);
      } else if (selectedFile.getType() == VFSFile.FILE) filesSize += selectedFile.getLength();
    }

    JPanel propField = new JPanel();
    propField.setLayout(new GridLayout(2, 1));
    String path = local.getPath();
    if (OperatingSystem.isWindows()
        || OperatingSystem.isWindows9x()
        || OperatingSystem.isWindowsNT()) {
      path = path.substring(0, path.lastIndexOf(92)); // 92 = '\'
    } else {
      path = path.substring(0, path.lastIndexOf('/'));
    }
    propField.add(new JLabel(jEdit.getProperty("fileprop.path") + ": " + path));
    propField.add(
        new JLabel(
            jEdit.getProperty("fileprop.size")
                + ": "
                + StandardUtilities.formatFileSize(filesSize)));
    Border etch = BorderFactory.createEtchedBorder();
    propField.setBorder(
        BorderFactory.createTitledBorder(etch, jEdit.getProperty("fileprop.properties")));
    centerPanel.add(BorderLayout.CENTER, propField);

    return centerPanel;
  } // }}}
  private JPanel getPredefinedSettingsPanel() {
    if (predefinedSettingsPanel == null) {
      predefinedSettingsPanel = new JPanel();
      predefinedSettingsPanel.setBorder(
          BorderFactory.createTitledBorder(
              BorderFactory.createEtchedBorder(), "Predefined settings"));
      predefinedSettingsPanel.setLayout(new GridBagLayout());

      GridBagConstraints c = new GridBagConstraints();

      c.fill = GridBagConstraints.HORIZONTAL;
      c.insets = new Insets(5, 5, 5, 5);
      c.anchor = GridBagConstraints.PAGE_START;

      c.gridx = 0;
      c.gridy = 0;
      c.gridwidth = 3;
      predefinedSettingsPanel.add(new JLabel("Set all rendering settings towards:"), c);

      c.weightx = 1f / 3;
      c.gridwidth = 1;
      c.gridy = 2;
      predefinedSettingsPanel.add(getPredefinedPlatformDefaultButton(), c);
      c.gridx = 1;
      predefinedSettingsPanel.add(getPredefinedSpeedButton(), c);
      c.gridx = 2;
      predefinedSettingsPanel.add(getPredefinedQualityButton(), c);
    }
    return predefinedSettingsPanel;
  }
Esempio n. 14
0
    public DisplayResults() {
      GridBagLayout gbl = new GridBagLayout();
      GridBagConstraints gbc = new GridBagConstraints();
      setLayout(gbl);

      gbc.anchor = GridBagConstraints.NORTHWEST;
      gbc.fill = GridBagConstraints.HORIZONTAL;

      text.setForeground(Color.black);
      add(text, gbc);
      gbc.gridy = 0;
      gbc.gridwidth = GridBagConstraints.REMAINDER;
      add(emptyLabel, gbc);
      add(Box.createVerticalStrut(0), gbc);
      add(emptyLabel, gbc);

      /*	 gbc.gridy = 1;
      VTextMsg result = new VTextMsg(sshare, vnmrif, null);
      result.setPreferredSize(new Dimension(300, 30));
      result.setForeground(Color.black);
      add( result, gbc );
      */
      setBorder(
          new CompoundBorder(
              BorderFactory.createTitledBorder("  Results  "),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
Esempio n. 15
0
  public ViewHolder(String id, String loc, JSplitPane sp) {
    this.loc = loc;
    this.splitPane = sp;
    setLayout(new BorderLayout());
    // setMinimumSize(new Dimension(5, 5));
    addContainerListener(
        new ContainerListener() {

          public void componentAdded(ContainerEvent e) {
            if (getComponentCount() == 1) {
              splitPane.add(ViewHolder.this, ViewHolder.this.loc);
            }
          }

          public void componentRemoved(ContainerEvent e) {
            if (getComponentCount() == 0) {
              splitPane.remove(ViewHolder.this);
            }
          }
        });
    createHolder();
    setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY),
            BorderFactory.createEmptyBorder(2, 2, 2, 2)));
  }
Esempio n. 16
0
  /**
   * Build the UI of the given process according to the given data.
   *
   * @param processExecutionData Process data.
   * @return The UI for the configuration of the process.
   */
  public JComponent buildUIConf(ProcessExecutionData processExecutionData) {
    JPanel panel = new JPanel(new MigLayout("fill"));
    // For each input, display its title, its abstract and gets its UI from the dataUIManager
    for (Input i : processExecutionData.getProcess().getInput()) {
      JPanel inputPanel = new JPanel(new MigLayout("fill"));
      inputPanel.setBorder(BorderFactory.createTitledBorder(i.getTitle()));
      JLabel inputAbstrac = new JLabel(i.getResume());
      inputAbstrac.setFont(inputAbstrac.getFont().deriveFont(Font.ITALIC));
      inputPanel.add(inputAbstrac, "wrap");
      DataUI dataUI = dataUIManager.getDataUI(i.getDataDescription().getClass());
      if (dataUI != null) {
        inputPanel.add(dataUI.createUI(i, processExecutionData.getInputDataMap()), "wrap");
      }
      panel.add(inputPanel, "growx, wrap");
    }

    // For each output, display its title, its abstract and gets its UI from the dataUIManager
    for (Output o : processExecutionData.getProcess().getOutput()) {
      DataUI dataUI = dataUIManager.getDataUI(o.getDataDescription().getClass());
      if (dataUI != null) {
        JComponent component = dataUI.createUI(o, processExecutionData.getOutputDataMap());
        if (component != null) {
          JPanel outputPanel = new JPanel(new MigLayout("fill"));
          outputPanel.setBorder(BorderFactory.createTitledBorder(o.getTitle()));
          JLabel outputAbstrac = new JLabel(o.getResume());
          outputAbstrac.setFont(outputAbstrac.getFont().deriveFont(Font.ITALIC));
          outputPanel.add(outputAbstrac, "wrap");
          outputPanel.add(component, "wrap");
          panel.add(outputPanel, "growx, wrap");
        }
      }
    }
    return panel;
  }
Esempio n. 17
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));
  }
Esempio n. 18
0
  public DataView() {
    this.rssFeed = null;

    this.listModel = new DefaultListModel();
    this.getNewDataModel();

    this.setLayout(new GridBagLayout());
    this.cont = new GridBagConstraints();
    this.cont.anchor = GridBagConstraints.NORTHWEST;
    this.cont.fill = GridBagConstraints.BOTH;

    this.listData = new JList(this.listModel);
    this.listData.addListSelectionListener(this);
    this.listData.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    this.listDataScroll = new JScrollPane(this.listData);
    this.listDataScroll.setHorizontalScrollBarPolicy(
        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    this.listDataScroll.setBorder(BorderFactory.createTitledBorder("Liste des articles"));
    this.listDataScroll.setPreferredSize(new Dimension(1000, 300));

    this.desc = new JTextArea();
    this.desc.setBorder(BorderFactory.createTitledBorder("Description"));
    this.desc.setLineWrap(true);
    this.desc.setWrapStyleWord(true);
    this.desc.setPreferredSize(new Dimension(1000, 80));

    this.cont.gridx = 0;
    this.cont.gridy = 0;
    this.add(this.listDataScroll, cont);

    this.cont.gridx = 0;
    this.cont.gridy = 1;
    this.add(this.desc, cont);
  }
Esempio n. 19
0
public class MyListCellRenderer implements ListCellRenderer {
  private JLabel jlblCell = new JLabel(" ", JLabel.LEFT);
  private Border lineBorder = BorderFactory.createLineBorder(Color.black, 1);
  private Border emptyBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2);

  /** Implement this method in ListCellRenderer */
  public Component getListCellRendererComponent(
      JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    Object[] pair = (Object[]) value; // Cast value into an array
    jlblCell.setOpaque(true);
    jlblCell.setIcon((ImageIcon) pair[0]);
    jlblCell.setText(pair[1].toString());

    if (isSelected) {
      jlblCell.setForeground(list.getSelectionForeground());
      jlblCell.setBackground(list.getSelectionBackground());
    } else {
      jlblCell.setForeground(list.getForeground());
      jlblCell.setBackground(list.getBackground());
    }

    jlblCell.setBorder(cellHasFocus ? lineBorder : emptyBorder);

    return jlblCell;
  }
}
Esempio n. 20
0
  private void initComponents(String title) {
    getContentPane().setLayout(new BorderLayout());

    JPanel mainPane = new JPanel(new BorderLayout());
    mainPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

    JLabel text = new JLabel(title, JLabel.CENTER);
    text.setFont(FONT);
    text.setOpaque(true);
    text.setBackground(Color.orange);
    //		text.setFont(UIManager.getFont("Label.font"));
    mainPane.add(text, "North");

    JPanel panel = new JPanel(new GridLayout(1, 6));
    for (int i = 1; i <= 6; i++) {
      Die die = template.getCopy();
      die.setFace(i);
      FaceButton button = new FaceButton(die, i);
      panel.add(button);
    }
    mainPane.add(panel, "South");

    if (icon != null) {
      JLabel iconLabel = new JLabel(icon);
      iconLabel.setBorder(BorderFactory.createEtchedBorder());
      mainPane.add(iconLabel, "Center");
    }

    getContentPane().add(mainPane, "Center");
    setResizable(false);
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    pack();
  }
Esempio n. 21
0
    public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {

      Object[] values = (Object[]) list.getModel().getElementAt(index);
      String icoState = (String) (values[0]);

      setIcon(null);
      if (icoState.equals("bad")) { // Error
        setIcon(errIco);
        setBackground(list.getSelectionForeground()); // RED
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
      } else if (icoState.equals("good")) { // Ok
        setIcon(nrmIco);
        setBackground(list.getSelectionBackground()); // GREEN
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
      } else if (icoState.equals("goodcont")) { // Ok
        setIcon(imdIco);
        setBackground(list.getSelectionBackground()); // GREEN
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(list.getSelectionBackground(), 1));
      } else {
        setIcon(ibdIco); // Errorcont
        setBackground(list.getSelectionForeground()); // RED
        setForeground(Color.BLACK);
        setBorder(BorderFactory.createLineBorder(list.getSelectionForeground(), 1));
      }
      setText((String) (values[1]));
      setFont(list.getFont());
      return this;
    }
Esempio n. 22
0
  /** 查询 */
  private void search() {
    // 调用查询窗口
    Function function = new Function();
    Search search = new Search(this, staffInfo);
    function.setFunctionDialog(search);
    function.create();
    if (search.isUpdate()) {
      int searched = search.getSearched();

      switch (searched) {
        case 0:
          DMManage();
          break;
        case 1:
          break;
        case 3:
          break;
        case 4:
          break;
        case 5:
          break;
      }
      content = search.getResultContent();
      header = search.getResultHeader();
      displayPanel.setBorder(
          BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "查询结果"));
      setTable(content, header);
    }
  }
Esempio n. 23
0
  /**
   * And now for a little assembly. Put together the buttons, progress bar and status text field.
   */
  Example1(String name) {
    setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), name));

    progressBar.setMaximum(NUMLOOPS);

    startButton = new JButton("Start");
    startButton.addActionListener(startListener);
    startButton.setEnabled(true);

    interruptButton = new JButton("Cancel");
    interruptButton.addActionListener(interruptListener);
    interruptButton.setEnabled(false);

    JComponent buttonBox = new JPanel();
    buttonBox.add(startButton);
    buttonBox.add(interruptButton);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    add(buttonBox);
    add(progressBar);
    add(statusField);
    statusField.setAlignmentX(CENTER_ALIGNMENT);

    buttonBox.setBorder(spaceBelow);
    Border pbBorder = progressBar.getBorder();
    progressBar.setBorder(BorderFactory.createCompoundBorder(spaceBelow, pbBorder));
  }
Esempio n. 24
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);
  }
Esempio n. 25
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);
  }
Esempio n. 26
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);
 }
Esempio n. 27
0
  private void buildFields() {
    JLabel lbFaculty = new JLabel("Факультет:");
    lbFaculty.setHorizontalAlignment(SwingConstants.RIGHT);
    lbFaculty.setBounds(new Rectangle(PAD, 0 * H_B + PAD, W_L, H_B));
    add(lbFaculty);
    txtFaculty.setBounds(new Rectangle(W_L + 2 * PAD, 0 * H_B + PAD, W_T, H_B));
    txtFaculty.setBorder(BorderFactory.createEtchedBorder());
    add(txtFaculty);

    JLabel lbNOG = new JLabel("Группа:");
    lbNOG.setHorizontalAlignment(SwingConstants.RIGHT);
    lbNOG.setBounds(new Rectangle(PAD, 1 * H_B + PAD, W_L, H_B));
    add(lbNOG);
    txtNOG.setBounds(new Rectangle(W_L + 2 * PAD, 1 * H_B + PAD, W_T, H_B));
    txtNOG.setBorder(BorderFactory.createEtchedBorder());
    add(txtNOG);

    JLabel lbName = new JLabel("Имя:");
    lbName.setHorizontalAlignment(SwingConstants.RIGHT);
    lbName.setBounds(new Rectangle(PAD, 2 * H_B + PAD, W_L, H_B));
    add(lbName);
    txtName.setBounds(new Rectangle(W_L + 2 * PAD, 2 * H_B + PAD, W_T, H_B));
    txtName.setBorder(BorderFactory.createEtchedBorder());
    add(txtName);

    JLabel lbDOE = new JLabel("Дата зачисления:");
    lbDOE.setHorizontalAlignment(SwingConstants.RIGHT);
    lbDOE.setBounds(new Rectangle(PAD, 3 * H_B + PAD, W_L, H_B));
    add(lbDOE);
    txtDOE.setBounds(new Rectangle(W_L + 2 * PAD, 3 * H_B + PAD, W_T, H_B));
    txtDOE.setBorder(BorderFactory.createEtchedBorder());
    add(txtDOE);
  }
    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);
    }
Esempio n. 29
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(),
      };
    }
  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);
  }