Package javax.swing

Examples of javax.swing.JList


    private JScrollPane getFreeDbList() {
        if (freeDbPane == null) {
            DefaultListModel freedbModel = new DefaultListModel();
            for (int i = 0; i < result.getTracksNumber(); i++)
                freedbModel.addElement(result.getTrackTitle(i));
            this.freedb = new JList(freedbModel);
            this.freedb.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            this.freedb.setCellRenderer(new FreedbRenderer());
            freeDbPane = new JScrollPane(freedb);
            freedb.getSelectionModel().addListSelectionListener(
                    new ListSelectionListener() {
View Full Code Here


    public Component getComponent() {
        Box domainBox = new Box(BoxLayout.PAGE_AXIS);
        JLabel label = new JLabel(GanttLanguage.getInstance().getText(
                "chooseRoleSets"));

        final JList roleSetsList = new JList(myListModel);
        roleSetsList.setCellRenderer(myListModel.getCellRenderer());
        roleSetsList.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                int index = roleSetsList.locationToIndex(e.getPoint());
                myListModel.toggle(index);
            }
        });
        roleSetsList.setAlignmentX(0);
        label.setLabelFor(roleSetsList);
        label.setAlignmentX(0);

        domainBox.add(label);
        domainBox.add(Box.createVerticalStrut(5));
View Full Code Here

      frame.getContentPane().add(splitPane, BorderLayout.CENTER);
      {
        JScrollPane clientScrollPane = new JScrollPane();
        splitPane.setLeftComponent(clientScrollPane);
        {
          clientList = new JList();
          clientList.setListData(connectedClients.toArray());
          clientScrollPane.setViewportView(clientList);
        }
      }
      {
View Full Code Here

    Arrays.sort(records, NUMBER_SORTER);
    final DefaultListModel listModel = new DefaultListModel();
    for (int i = 0; i < records.length; i++) {
      listModel.addElement(records[i]);
    }
    final JList list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JLabel desc = new JLabel(LangageManager
        .getProperty("statistic.categorydescription.bitrate"));
    final JCheckBox compressBox = new JCheckBox(LangageManager
        .getProperty("statistic.compressbitrates"));
    compressBox.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent arg0) {
        if (compressBox.isSelected()) {
          StringCountRecord[] recs = statistic
              .getRecords(Statistic.MAP_BITRATE);
          String[] compressed = compressBitrates(recs);
          listModel.removeAllElements();
          for (int i = 0; i < compressed.length; i++) {
            listModel.addElement(compressed[i]);
          }
        } else {
          StringCountRecord[] recs = statistic
              .getRecords(Statistic.MAP_BITRATE);
          Arrays.sort(recs, NUMBER_SORTER);
          listModel.removeAllElements();
          for (int i = 0; i < recs.length; i++) {
            listModel.addElement(recs[i]);
          }
        }
        list.repaint();
      }
    });
    result.add(compressBox, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
        GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
            0, 0, 0), 0, 0));
View Full Code Here

  public static JPanel createFor(Statistic statistic, String category,
      String description) {
    JPanel result = new JPanel(new GridBagLayout());
    StringCountRecord[] records = statistic.getRecords(category);
    Arrays.sort(records);
    JList list = new JList(records);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JLabel desc = new JLabel(description);
    result.add(desc, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
        GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
            0, 0, 0), 0, 0));
    result.add(new JScrollPane(list), new GridBagConstraints(0, 1, 1, 1,
View Full Code Here

         * (((TestGanttRolloverButton)buttonList.getElementAt(i)).getText());
         * else iconList.addElement
         * (((TestGanttRolloverButton)buttonList.getElementAt(i)).getIcon()); } }
         */

        list = new JList();
        listDeleted = new JList();
        listDeleted.setName("listDeleted");
        scrollPane = new JScrollPane(listDeleted);
        scrollPane.setPreferredSize(new Dimension(110, 200));
        deletedPanel.add(scrollPane, BorderLayout.EAST);

View Full Code Here

        buttonBox.add(new JButton(myDeleteAction));
        topPanel.add(buttonBox, BorderLayout.SOUTH);
        topPanel.setBorder(BorderFactory.createEmptyBorder(5,5,0,5));
        add(topPanel, BorderLayout.NORTH);
        //
        JList list = new JList(myListModel);
        list.setName("list");
        list.setBorder(BorderFactory.createLoweredBevelBorder());
        myListSelectionModel = list.getSelectionModel();
        myListSelectionModel.addListSelectionListener(new ListSelectionListener() {
      public void valueChanged(ListSelectionEvent e) {
        updateActions();
      }
        });
View Full Code Here

        super(new BorderLayout());



        fontNameList = new JList();

        fontNameList.setCellRenderer(new FontNameListCellRenderer());

        fontNameList.setVisibleRowCount(7);

        // fontNameList.setAutoscrolls(true);

        fontNameList.addListSelectionListener(new ListSelectionListener() {

            public void valueChanged(ListSelectionEvent e) {

                if (!fontNameList.isSelectionEmpty() && !e.getValueIsAdjusting()) {

                    try {

                        adjusting = true;

                        String fn = ((Font) fontNameList.getSelectedValue()).getName();

                        fontName.setText(fn.equals(AUTOMATIC) ? "Automatic" : fn);

                        fontName.requestFocus();

                    } catch (IllegalStateException iee) {

                    }

                    adjusting = false;

                    changeFontBasedOnState();

                }

            }

        });



        // Create the font style selection panel

        JPanel stylePanel = null;

        if (showStyles) {

            stylePanel = new JPanel(new GridBagLayout());

            stylePanel.setBorder(BorderFactory.createTitledBorder("Font style"));



            GridBagConstraints gBC = new GridBagConstraints();

            gBC.fill = GridBagConstraints.BOTH;

            gBC.anchor = GridBagConstraints.CENTER;

            gBC.weighty = 0.0;

            gBC.insets = new Insets(2, 2, 2, 2);



            ActionListener l = new ActionListener() {

                public void actionPerformed(ActionEvent evt) {

                    changeFontBasedOnState();

                }

            };



            UIUtil.jGridBagAdd(stylePanel, bold = new JCheckBox("Bold"), gBC, GridBagConstraints.REMAINDER);

            bold.addActionListener(l);

            bold.setMnemonic('b');

            UIUtil.jGridBagAdd(stylePanel, italic = new JCheckBox("Italic"), gBC, GridBagConstraints.REMAINDER);

            italic.setMnemonic('i');

            italic.addActionListener(l);

        }



        // Create the font size list

        // @todo make this more specific to the font. not sure how yet :-)

        JPanel sizePanel = null;

        if (showSize) {

            fontSizeList = new JList(new Integer[] { new Integer(8), new Integer(9), new Integer(10), new Integer(11),

                            new Integer(12), new Integer(14), new Integer(16), new Integer(18), new Integer(20), new Integer(22),

                            new Integer(24), new Integer(26), new Integer(28), new Integer(36), new Integer(48), new Integer(72) });
View Full Code Here

        list[16] = "Default";
        list[17] = "Night Calendar";
        list[18] = "Default";
        list[19] = "Night Calendar";

        listCalendar = new JList(list);
        panelDate = new GanttPanelDate(new GanttCalendar());

        JPanel panel1 = new JPanel();
        JPanel panel2 = new JPanel();
        JPanel panel3 = new JPanel();
View Full Code Here

        }
        if (e.getKeyCode() == KeyEvent.VK_LEFT
            || e.getKeyCode() == KeyEvent.VK_RIGHT) {
          this.model.fireChange();
        }
        final JList list = getSelectionWindow().getValueList();
        if (e.getKeyCode() == KeyEvent.VK_UP) {
          if (list.getSelectedIndex() > 0) {
            list.setSelectedIndex(list.getSelectedIndex() - 1);
          }
          e.consume();
        }
        if (e.getKeyCode() == KeyEvent.VK_DOWN) {
          if (list.getSelectedIndex() < list.getModel().getSize() - 1) {
            list.setSelectedIndex(list.getSelectedIndex() + 1);
          }
          e.consume();
        }
        if (e.getKeyCode() == KeyEvent.VK_ENTER) {
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              select(list.getSelectedIndex());
            }
          });
          e.consume();
        }
      }
View Full Code Here

TOP

Related Classes of javax.swing.JList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.