public FPGACommanderListWindow(
      String Title, Color fg, boolean count, FPGACommanderListModel model) {
    super((count) ? Title + " (0)" : Title);
    this.Title = Title;
    setResizable(true);
    setAlwaysOnTop(false);
    setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
    Color bg = Color.black;

    textArea.setBackground(bg);
    textArea.setForeground(fg);
    textArea.setSelectionBackground(fg);
    textArea.setSelectionForeground(bg);
    textArea.setFont(new Font("monospaced", Font.PLAIN, FontSize));
    textArea.setModel(model);
    textArea.setCellRenderer(model.getMyRenderer(count));
    textArea.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    model.addListDataListener(this);

    JScrollPane textMessages = new JScrollPane(textArea);
    textMessages.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    textMessages.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    add(textMessages);
    setLocationRelativeTo(null);
    textArea.addKeyListener(this);
    pack();
    addWindowListener(this);
    this.count = count;
    this.model = model;
  }
Пример #2
0
  private JScrollPane getClusterList() {
    if (clustList == null) {
      clustList = new JList();

      clustList.setSelectionBackground(new Color(83, 126, 126));
      clustList.setSelectionForeground(Color.BLACK);
      clustList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
      clustList.setFont(
          new Font(
              clustList.getFont().getName(),
              clustList.getFont().getStyle(),
              clustList.getFont().getSize() + 1));

      String[] clustStr = new String[numClusters];
      for (int i = 0; i < numClusters; i++) {
        clustStr[i] = "Cluster " + (i + 1);
      }

      clustList.setListData(clustStr);

      clustList.addListSelectionListener(
          new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent e) {
              if (clustInfo != null && clustList.getSelectedIndex() >= 0) {
                if (!e.getValueIsAdjusting()) {
                  ((clustTableModel) clustInfo.getModel())
                      .setData(infos.infoCluster[clustList.getSelectedIndex()].statClust);
                  clustInfo.tableChanged(new TableModelEvent(clustInfo.getModel()));
                  clustDet.setCluster(clustList.getSelectedIndex());
                  String cur =
                      DESCR_LABEL.replaceFirst(
                          "X", Integer.toString(clustList.getSelectedIndex() + 1));
                  cur = cur.replaceFirst("Y", Integer.toString(numClusters));
                  desctText.setText(
                      cur.replaceFirst(
                          "Z", Integer.toString(infos.numElem[clustList.getSelectedIndex()])));
                }
              }
            }
          });
    }
    clustList.setSelectedIndex(0);

    JScrollPane p =
        new JScrollPane(
            clustList,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    p.setPreferredSize(new Dimension(120, 115));
    return p;
  }
    private MyCheckboxTreeCellRenderer(
        final SelectionManager selectionManager,
        Map<VirtualFile, String> modulesSet,
        final Project project,
        final JTree tree,
        final Collection<VirtualFile> roots) {
      super(new BorderLayout());
      mySelectionManager = selectionManager;
      myModulesSet = modulesSet;
      myRoots = roots;
      setBackground(tree.getBackground());
      myColoredRenderer =
          new ColoredTreeCellRenderer() {
            @Override
            public void customizeCellRenderer(
                JTree tree,
                Object value,
                boolean selected,
                boolean expanded,
                boolean leaf,
                int row,
                boolean hasFocus) {
              append(value.toString());
            }
          };
      myFictive = new JBList();
      myFictive.setBackground(tree.getBackground());
      myFictive.setSelectionBackground(UIUtil.getListSelectionBackground());
      myFictive.setSelectionForeground(UIUtil.getListSelectionForeground());

      myTextRenderer =
          new WithModulesListCellRenderer(project, myModulesSet) {
            @Override
            protected void putParentPath(Object value, FilePath path, FilePath self) {
              if (myRoots.contains(self.getVirtualFile())) {
                super.putParentPath(value, path, self);
              }
            }
          };
      myTextRenderer.setBackground(tree.getBackground());

      myCheckbox = new JCheckBox();
      myCheckbox.setBackground(tree.getBackground());
      myEmpty = new JLabel("");

      add(myCheckbox, BorderLayout.WEST);
      add(myTextRenderer, BorderLayout.CENTER);
      myCheckbox.setVisible(true);
    }
    protected Component buildPage() {
      JList listBox = SwingComponentFactory.buildList(this.buildSelectedNodesListModel());
      listBox.setBorder(BorderFactory.createEmptyBorder());
      listBox.setCellRenderer(new DisplayableListCellRenderer());

      listBox.setBackground(UIManager.getColor("Panel.background"));
      listBox.setForeground(UIManager.getColor("List.foreground"));
      listBox.setSelectionBackground(UIManager.getColor("ScrollPane.background"));
      listBox.setSelectionForeground(listBox.getForeground());

      JScrollPane scrollPane = new JScrollPane(listBox);
      scrollPane.setBorder(new EmptyBorder(5, 0, 0, 0));
      scrollPane.getVerticalScrollBar().setUnitIncrement(10);
      scrollPane.setViewportBorder(BorderFactory.createEmptyBorder());

      return scrollPane;
    }
Пример #5
0
 public void setSelectionForeground(Color newValue) {
   sourceList.setSelectionForeground(newValue);
   destList.setSelectionForeground(newValue);
 }
Пример #6
0
  private void makeFrame(String[] audioFiles) {
    // the following makes sure that our application exits when
    // the user closes its window
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JPanel contentPane = (JPanel) getContentPane();
    contentPane.setBorder(new EmptyBorder(6, 10, 10, 10));

    // Specify the layout manager with nice spacing
    contentPane.setLayout(new BorderLayout(8, 8));

    // Create the left side with combobox and scroll list
    JPanel leftPane = new JPanel();
    {
      leftPane.setLayout(new BorderLayout(8, 8));

      fileList = new JList(audioFiles);
      fileList.setForeground(new Color(140, 171, 226));
      fileList.setBackground(new Color(0, 0, 0));
      fileList.setSelectionBackground(new Color(87, 49, 134));
      fileList.setSelectionForeground(new Color(140, 171, 226));
      JScrollPane scrollPane = new JScrollPane(fileList);
      scrollPane.setColumnHeaderView(new JLabel("Audio files"));
      leftPane.add(scrollPane, BorderLayout.CENTER);
    }
    contentPane.add(leftPane, BorderLayout.CENTER);

    // Create the center with image, text label, and slider
    JPanel centerPane = new JPanel();
    {
      centerPane.setLayout(new BorderLayout(8, 8));

      infoLabel = new JLabel("  ");
      infoLabel.setHorizontalAlignment(SwingConstants.CENTER);
      infoLabel.setForeground(new Color(140, 171, 226));
      centerPane.add(infoLabel, BorderLayout.CENTER);
    }
    contentPane.add(centerPane, BorderLayout.EAST);

    // Create the toolbar with the buttons
    JPanel toolbar = new JPanel();
    {
      toolbar.setLayout(new GridLayout(1, 0));

      JButton button = new JButton("Play");
      button.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              play();
            }
          });
      toolbar.add(button);

      button = new JButton("Stop");
      button.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              stop();
            }
          });
      toolbar.add(button);

      button = new JButton("Pause");
      button.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              pause();
            }
          });
      toolbar.add(button);

      button = new JButton("Resume");
      button.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              resume();
            }
          });
      toolbar.add(button);
    }

    contentPane.add(toolbar, BorderLayout.NORTH);

    // building is done - arrange the components
    pack();

    // place this frame at the center of the screen and show
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation(d.width / 2 - getWidth() / 2, d.height / 2 - getHeight() / 2);
    setVisible(true);
  }