/**
   * Constructor del panel
   *
   * @param ventanaPrincipal La ventana principal de la aplicación
   */
  public PanelListaRecetas(InterfazRecetario ventanaPrincipal) {
    interfaz = ventanaPrincipal;

    setLayout(new BorderLayout());
    setBorder(new CompoundBorder(new EmptyBorder(0, 5, 0, 5), new TitledBorder(" Recetas ")));
    setPreferredSize(new Dimension(250, 0));

    listaRecetas = new JList();
    listaRecetas.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    listaRecetas.addListSelectionListener(this);

    scroll = new JScrollPane(listaRecetas);

    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scroll.setBorder(
        new CompoundBorder(new EmptyBorder(3, 3, 3, 3), new LineBorder(Color.BLACK, 1)));

    botonAgregar = new JButton(AGREGAR);
    botonAgregar.setActionCommand(AGREGAR);
    botonAgregar.addActionListener(this);

    add(scroll, BorderLayout.CENTER);
    add(botonAgregar, BorderLayout.SOUTH);
  }
  public FeedbackViewerUI(
      DefaultListModel<AbstractFeedbackType> questionListModel,
      DefaultListModel<FeedbackViewerUserEntry> userListModel) {
    super();
    setTitle("Feedback Viewer");
    setIconImage(Loader.getImageIcon(Loader.IMAGE_STURESY).getImage());

    // Button Panel containing download/upload/etc. buttons
    JPanel buttonPanel = createButtonPanel();

    JPanel leftPanel = new JPanel();
    leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS));

    questionList = new JList<>(questionListModel);
    questionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    questionList.setCellRenderer(new NumberedListCellRenderer());
    userList = new JList<>(userListModel);
    userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    JScrollPane questionListScrollPane = new JScrollPane(questionList);
    JScrollPane userListScrollPane = new JScrollPane(userList);

    // Populate left panel of SplitPane
    leftPanel.add(new JLabel("Select by Question:"));
    leftPanel.add(questionListScrollPane);
    leftPanel.add(new JLabel("Select by User:"));
    leftPanel.add(userListScrollPane);

    splitPane = new JSplitPane();
    splitPane.setLeftComponent(leftPanel);

    add(splitPane, BorderLayout.CENTER);
    add(buttonPanel, BorderLayout.PAGE_END);

    setRightPanel(new JPanel());
  }
  private void initDialog(final DesignTimeContext designTimeContext) {
    if (designTimeContext == null) {
      throw new NullPointerException();
    }

    this.designTimeContext = designTimeContext;

    editParameterAction = new EditParameterAction();
    editParameterAction.setEnabled(false);

    queryListModel = new DefaultListModel();

    queryNameList = new JList(queryListModel);
    queryNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    queryNameList.setVisibleRowCount(5);
    queryNameList.addListSelectionListener(new QueryNameListSelectionListener());

    fileTextField = new JTextField(30);
    fileTextField.setEnabled(false);
    fileTextField.getDocument().addDocumentListener(new FileSyncHandler());

    stepsList = new JList();
    stepsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    stepsList.addListSelectionListener(new StepsListListener());

    nameTextField = new JTextField(30);
    nameTextField.setEnabled(false);
    nameTextField.getDocument().addDocumentListener(new NameSyncHandler());

    setTitle(Messages.getString("KettleDataSourceDialog.Title"));
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setModal(true);

    super.init();
  }
 @Override
 public boolean setArgs(String[] args) {
   try {
     // first make sure that there are the right number of args
     if (args.length != numArgs) {
       return false;
     }
     name = args[0];
     description = args[1];
     label = args[2];
     if (args[3].toLowerCase().contains("false")) {
       multiSelect = false;
       list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     } else { // true
       multiSelect = true;
       list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
     }
     //            if (args[4].toLowerCase().contains("false")) {
     //                this.isVisible() = false;
     //            }
     // value = (String)comboBox.getSelectedItem();
     createUI();
     return true;
   } catch (Exception e) {
     return false;
   }
 }
 public void operationMoteur() {
   cImportation = new C_ImportationProcessus();
   if (!importationComplete) LS_Fichiers.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   else LS_Fichiers.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
   LS_Fichiers.setModel(cImportation.getModeleFichiers());
   LD_Chemin.setModel(cImportation.getModeleChemin());
   doRechercher();
 }
 /**
  * This method initializes jList
  *
  * @return javax.swing.JList
  */
 private JList getAttributesList() {
   if (attributesList == null) {
     attributesList = new JList();
     if (singleSelection) {
       attributesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     } else {
       attributesList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
     }
     attributesList.setListData(availableAttributes);
   }
   return attributesList;
 }
Example #7
0
  private void luoKomponentit() {
    JLabel tervehdys = new JLabel("Hei " + this.ohjelma.kayttajanNimi() + "!");
    JButton kaanna = new JButton("Käännöstehtävä");
    JButton yhdista = new JButton("Yhdistä sanaparit");
    JButton omatTiedot = new JButton("Näytä omat tiedot");
    JButton ulos = new JButton("Kirjaudu ulos");
    JLabel tiedostot = new JLabel("Tiedostot");
    JList lista = new JList(this.ohjelma.tiedostojenNimet().toArray());

    lista.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    ValikonKuuntelija kuuntelija = new ValikonKuuntelija(this.ohjelma, this.frame, lista);

    lista.addListSelectionListener(new ListanKuuntelija(this.frame, this.ohjelma, lista));

    kaanna.addActionListener(kuuntelija);
    yhdista.addActionListener(kuuntelija);
    omatTiedot.addActionListener(kuuntelija);
    ulos.addActionListener(kuuntelija);

    add(tervehdys);
    add(kaanna);
    add(yhdista);
    add(omatTiedot);
    add(ulos);
    add(tiedostot);
    add(lista);
  }
Example #8
0
 /**
  * Shows a dialog that allows the user to select a VST plugin from list that displays all
  * VSTPlugins that are available in the system.
  *
  * @param preSelection The pre-selected element.
  * @return A <code>VstPlugin</code> if the user selcted one, or <code>null</code> if the user
  *     selected none or cancelled the dialog.
  */
 public static VstPluginDescriptor showSelectVstPluginDialog(VstPluginDescriptor preSelection) {
   VstPluginDescriptor[] vstPlugins = VstContainer.getInstance().getAllVstPluginDescriptors();
   VstItem[] items = new VstItem[vstPlugins.length];
   VstItem sel = null;
   for (int i = 0; i < vstPlugins.length; i++) {
     items[i] = new VstItem(vstPlugins[i]);
     if (vstPlugins[i] == preSelection) {
       sel = items[i];
     }
   }
   JList list = new JList(items);
   list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   if (sel != null) {
     list.setSelectedValue(sel, true);
   }
   Object[] message = new Object[] {new JScrollPane(list)};
   int option =
       JOptionPane.showConfirmDialog(
           getMainFrame(),
           message,
           SgEngine.getInstance().getResourceBundle().getString("vstplugin.select"),
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.PLAIN_MESSAGE,
           null);
   if (option == JOptionPane.OK_OPTION) {
     Object[] o = list.getSelectedValues();
     if (o != null && o.length > 0) {
       VstPluginDescriptor result = ((VstItem) o[0]).vstPlugin;
       return result;
     }
   }
   return null;
 }
Example #9
0
 /**
  * Shows a dialog that allows the user to select an Audio Unit from list that displays all
  * AudioUnits that are available in the system.
  *
  * @param preSelection The pre-selected element.
  * @return An <code>AudioUnitDescriptor</code> if the user selcted one, or <code>null</code> if
  *     the user selected none or cancelled the dialog.
  */
 public static AudioUnitDescriptor showSelectAudioUnitDialog(AudioUnitDescriptor preSelection) {
   AudioUnitDescriptor[] audioUnits = AUContainer.getInstance().getAllAudioUnitDescriptors();
   AuItem[] items = new AuItem[audioUnits.length];
   AuItem sel = null;
   for (int i = 0; i < audioUnits.length; i++) {
     items[i] = new AuItem(audioUnits[i]);
     if (audioUnits[i] == preSelection) {
       sel = items[i];
     }
   }
   JList list = new JList(items);
   list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   if (sel != null) {
     list.setSelectedValue(sel, true);
   }
   Object[] message = new Object[] {new JScrollPane(list)};
   int option =
       JOptionPane.showConfirmDialog(
           getMainFrame(),
           message,
           SgEngine.getInstance().getResourceBundle().getString("audiounit.select"),
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.PLAIN_MESSAGE,
           null);
   if (option == JOptionPane.OK_OPTION) {
     Object[] o = list.getSelectedValues();
     if (o != null && o.length > 0) {
       AudioUnitDescriptor result = ((AuItem) o[0]).audioUnit;
       return result;
     }
   }
   return null;
 }
Example #10
0
  BeanItemPanel usageDetails() {
    BeanItemPanel usage = new BeanItemPanel();

    usage.setName(Bundle.getMessage("Usage"));
    usage.setLayout(new BoxLayout(usage, BoxLayout.Y_AXIS));

    usage.addItem(
        new BeanEditItem(null, null, Bundle.getMessage("UsageText", bean.getDisplayName())));

    ArrayList<String> listeners = new ArrayList<String>();
    for (String ref : bean.getListenerRefs()) {
      if (!listeners.contains(ref)) {
        listeners.add(ref);
      }
    }

    Object[] strArray = new Object[listeners.size()];
    listeners.toArray(strArray);
    JList<Object> list = new JList<Object>(strArray);
    list.setLayoutOrientation(JList.VERTICAL);
    list.setVisibleRowCount(-1);
    list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    JScrollPane listScroller = new JScrollPane(list);
    listScroller.setPreferredSize(new Dimension(250, 80));
    listScroller.setBorder(
        BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black)));
    usage.addItem(new BeanEditItem(listScroller, Bundle.getMessage("ColumnLocation"), null));

    bei.add(usage);
    return usage;
  }
Example #11
0
 /**
  * Shows a dialog that enables the user to select audio input devices.
  *
  * @param multipleSelectionAllowed if <code>true</code>, indicates that more than one output
  *     device can be selected.
  * @return The selected <code>AudioDeviceDescriptor</code>s as an array, or <code>null</code> if
  *     the dialog was cancelled.
  */
 public static AudioDeviceDescriptor[] showSelectAudioInputDeviceDialog(
     boolean multipleSelectionAllowed) {
   JList list =
       new JList(
           SgEngine.getInstance()
               .getProperties()
               .getAudioInputDeviceList()
               .getDeviceDescriptors());
   list.setSelectionMode(
       multipleSelectionAllowed
           ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
           : ListSelectionModel.SINGLE_SELECTION);
   Object[] message = new Object[] {new JScrollPane(list)};
   int option =
       JOptionPane.showConfirmDialog(
           getMainFrame(),
           message,
           SgEngine.getInstance().getResourceBundle().getString("device.select.input.audio"),
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.PLAIN_MESSAGE,
           null);
   if (option == JOptionPane.OK_OPTION) {
     Object[] o = list.getSelectedValues();
     AudioDeviceDescriptor[] result = new AudioDeviceDescriptor[o.length];
     for (int i = 0; i < o.length; i++) {
       result[i] = (AudioDeviceDescriptor) o[i];
     }
     return result;
   }
   return null;
 }
  /** Initializes the config list. */
  private void initList() {
    configList.setModel(new DefaultListModel());
    configList.setCellRenderer(new ConfigListCellRenderer());
    configList.addListSelectionListener(this);
    configList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    JScrollPane configScrollList = new JScrollPane();

    configScrollList.getVerticalScrollBar().setUnitIncrement(30);

    configScrollList.getViewport().add(configList);

    add(configScrollList, BorderLayout.WEST);

    String osgiFilter =
        "(" + ConfigurationForm.FORM_TYPE + "=" + ConfigurationForm.ADVANCED_TYPE + ")";
    ServiceReference[] confFormsRefs = null;
    try {
      confFormsRefs =
          AdvancedConfigActivator.bundleContext.getServiceReferences(
              ConfigurationForm.class.getName(), osgiFilter);
    } catch (InvalidSyntaxException ex) {
    }

    if (confFormsRefs != null) {
      for (int i = 0; i < confFormsRefs.length; i++) {
        ConfigurationForm form =
            (ConfigurationForm) AdvancedConfigActivator.bundleContext.getService(confFormsRefs[i]);

        if (form.isAdvanced()) this.addConfigForm(form);
      }
    }
  }
Example #13
0
 /**
  * This method initializes jList
  *
  * @return javax.swing.JList
  */
 private JList getJList() {
   if (jList == null) {
     jList = new JList();
     jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   }
   return jList;
 }
  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;
  }
Example #15
0
  public TransactionPanel() {
    setLayout(new GridLayout(2, 1));
    setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, DARK_CHAMPAGNE));

    listModel.removeAllElements();
    readTransactions();
    receiptList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    titleLabel.setVerticalAlignment(SwingConstants.TOP);
    titleLabel.setFont(new Font(Font.SERIF, Font.BOLD, 24));
    listLabel.setVerticalAlignment(SwingConstants.BOTTOM);
    listLabel.setFont(new Font(Font.SERIF, Font.ITALIC, 18));

    buttonPanel.setBackground(DARK_CHAMPAGNE);
    buttonPanel.add(new MenuButton("Load", "Load", this));
    //		buttonPanel.add(new MenuButton("Delete","Delete",this));
    //		buttonPanel.add(new MenuButton("Void", "Void", this));
    //		buttonPanel.add(new MenuButton("Delete All","Delete All",this));
    buttonPanel.add(new MenuButton("Print", "Print", this));
    Tools.addBlankSpace(buttonPanel, 2);

    upperPanel.setBackground(DARK_CHAMPAGNE);
    upperPanel.add(titleLabel);
    upperPanel.add(buttonPanel);
    upperPanel.add(listLabel);

    add(upperPanel);
    add(
        new JScrollPane(
            receiptList,
            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS));
  }
Example #16
0
  public SplitPaneDemo() {

    // Create the list of images and put it in a scroll pane.

    list = new JList(imageNames);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);
    list.addListSelectionListener(this);

    JScrollPane listScrollPane = new JScrollPane(list);
    picture = new JLabel();
    picture.setFont(picture.getFont().deriveFont(Font.ITALIC));
    picture.setHorizontalAlignment(JLabel.CENTER);

    JScrollPane pictureScrollPane = new JScrollPane(picture);

    // Create a split pane with the two scroll panes in it.
    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listScrollPane, pictureScrollPane);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(150);

    // Provide minimum sizes for the two components in the split pane.
    Dimension minimumSize = new Dimension(100, 50);
    listScrollPane.setMinimumSize(minimumSize);
    pictureScrollPane.setMinimumSize(minimumSize);

    // Provide a preferred size for the split pane.
    splitPane.setPreferredSize(new Dimension(400, 200));
    updateLabel(imageNames[list.getSelectedIndex()]);
  }
  /** @return */
  protected void createList() {
    listModel = createListDataModel();

    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    ListCellRenderer cellRenderer = getListCellRenderer();
    if (cellRenderer != null) {
      list.setCellRenderer(cellRenderer);
    }

    list.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
              updateUIEnabled();
            }
          }
        });

    list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            super.mouseClicked(e);
            if (e.getClickCount() == 2) {
              editItem(list.getSelectedValue(), false);
            }
          }
        });
  }
  private Component crearLista() {
    listModel = new DefaultListModel<String>();
    listModel.addElement("cerveza.png");
    listModel.addElement("pintxo.png");
    listModel.addElement("tigre1.png");
    listModel.addElement("tigre2.png");
    listModel.addElement("tigre3.png");
    listModel.addElement("tigre4.png");
    listModel.addElement("tigre5.png");
    listModel.addElement("tigre6.png");
    listModel.addElement("tigre7.png");
    listModel.addElement("tigre8.png");
    listModel.addElement("tigre9.png");
    listModel.addElement("tigre10.png");
    listModel.addElement("tigre11.png");
    listModel.addElement("tigre12.png");
    listModel.addElement("total.png");
    listModel.addElement("vino.png");

    lista = new JList<String>(listModel);
    lista.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lista.setSelectedIndex(0);
    // lista.addListSelectionListener(this);

    JScrollPane listScrollPane = new JScrollPane(lista);

    return listScrollPane;
  }
  private void setRozkladScrollPane() {
    Vector<String> rozklad = new Vector<String>();
    String tytul = "Rozklad";
    if (przystanek != null) {
      tytul += " na Przystanku " + przystanek.getNazwa();
      RozkladAbstract r = przystanek.getRozklad();
      String rozkladString = r.pokazRozklad();
      String[] rozkladTab = rozkladString.split("\n");
      for (String s : rozkladTab) {
        rozklad.add(s);
      }
    }
    rozkladJList = new JList(rozklad);
    rozkladJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    rozkladJList.setVisibleRowCount(20);
    rozkladJList.addListSelectionListener(
        new ListSelectionListener() {

          public void valueChanged(ListSelectionEvent e) {
            String linia = (String) rozkladJList.getSelectedValue();
          }
        });

    TitledBorder tr = BorderFactory.createTitledBorder(tytul);
    rozkladScrollPane = new JScrollPane(rozkladJList);
    rozkladScrollPane.setBorder(tr);
    rozkladScrollPane.setPreferredSize(new Dimension(350, 400));
  }
  private void setPrzystankiScrollPane() {
    Vector<String> przystanki = new Vector<String>();
    String tytul = "Przystanki";
    if (linia != null) {
      tytul += " Linii " + linia.getNazwa();
    }
    if (trasa != null) {
      tytul += " - Kierunek: " + trasa.getKierunek();
      Droga d = trasa.getDroga();
      for (Przystanek p : d.getListaPrzyst()) {
        przystanki.add(p.getNazwa());
      }
    }
    przystankiJList = new JList(przystanki);
    przystankiJList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    przystankiJList.setVisibleRowCount(15);
    przystankiJList.addListSelectionListener(
        new ListSelectionListener() {

          public void valueChanged(ListSelectionEvent e) {
            String przystanekString = (String) przystankiJList.getSelectedValue();
            przystanek = trasa.getPrzystanek(przystanekString);
            updateRozkladScrollPane();
          }
        });

    TitledBorder tr = BorderFactory.createTitledBorder(tytul);
    przystankiScrollPane = new JScrollPane(przystankiJList);
    przystankiScrollPane.setBorder(tr);
    przystankiScrollPane.setPreferredSize(new Dimension(350, 350));
  }
Example #21
0
  public void makeInterface() {
    frame = new JFrame("俄罗斯方块多人对战");

    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    frame.setResizable(false);

    listModel = new DefaultListModel();
    listModel.ensureCapacity(100);

    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    list.setSelectedIndex(0);

    JButton exitButton = new JButton("Disconnect/Exit");
    exitButton.setActionCommand("exit");
    exitButton.addActionListener(this);

    JScrollPane listScroller = new JScrollPane(list);
    listScroller.setPreferredSize(new Dimension(250, 125));

    frame.getContentPane().add(listScroller, BorderLayout.CENTER);
    frame.getContentPane().add(exitButton, BorderLayout.SOUTH);

    frame.pack();
    frame.setVisible(false);
  }
Example #22
0
 private void initPlugins() {
   plugins.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   plugins.addListSelectionListener(
       new ListSelectionListener() {
         @Override
         public void valueChanged(ListSelectionEvent e) {
           if (plugins.getSelectedIndex() != -1) {
             PluginLoader loader = getCurrentLoader();
             description.setText(loader.getDescription());
             description.revalidate();
             config.setEnabled(loader.getConfigDialog(SelectionFrame.this) != null);
             StringBuilder sb = new StringBuilder();
             if (stat.isEmpty()) {
               sb = sb.append(loader.getName());
             } else {
               sb = sb.append(stat).append(" > ").append(loader.getName());
             }
             for (int i = 0;
                 i < InterfaceConfig.SELECTION_FRAME_PROPERTIES.getInt("tabs-count");
                 i++) {
               sb = sb.insert(0, "    ");
             }
             status.setText(sb.toString());
           }
         }
       });
   setLoaders(TaskState.getLoaders());
 }
Example #23
0
  /** Initializes GUI components */
  public void init() {
    this.setLayout(new BorderLayout());

    nodeListModel = new DefaultListModel();

    nodeList = new JList(nodeListModel);
    nodeList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
    nodeList.setCellRenderer(new NodeCellRenderer(main));
    nodeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    nodeList.addMouseListener(new PopupListener(new NodeOptions(main)));

    listPane = new JScrollPane(nodeList);

    // Build the clear button
    clearButton = new JButton("Clear");
    clearButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clearButtonPressed();
          }
        });
    clearButton.setMnemonic(KeyEvent.VK_K);
    add(listPane, BorderLayout.CENTER);
    add(clearButton, BorderLayout.SOUTH);
  }
Example #24
0
  public OpponentFrame(final Server ss) {
    thiss = this;
    this.server = ss;
    update = new Timer();
    setResizable(false);
    setTitle("player list -  Sinius Chess");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 249, 323);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    list = new JList<String>();
    list.setValueIsAdjusting(true);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    update.schedule(
        new TimerTask() {
          @Override
          public void run() {
            list.setListData(server.getOnlinePlayers());
          }
        },
        1,
        3000);
    list.setBounds(10, 62, 221, 189);
    contentPane.add(list);

    JLabel lblConnectedTo = new JLabel("Connected to " + server.ip + ":" + server.port);
    lblConnectedTo.setBounds(10, 12, 221, 14);
    contentPane.add(lblConnectedTo);

    JLabel lblOnlinePlayers = new JLabel("online players:");
    lblOnlinePlayers.setBounds(10, 37, 96, 14);
    contentPane.add(lblOnlinePlayers);

    JButton btnChalange = new JButton("Chalange Player");
    btnChalange.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (list.getSelectedValue() == null) {
              JOptionPane.showMessageDialog(
                  thiss, "Select an opponent", "No opponent selected", JOptionPane.ERROR_MESSAGE);
              return;
            }
            if (list.getSelectedValue().equals(ss.myName)) {
              JOptionPane.showMessageDialog(
                  thiss,
                  "Cannot play against yourself",
                  "chose an other opponent",
                  JOptionPane.ERROR_MESSAGE);
              return;
            }
            server.sendMessage(
                new Message("client" + server.id, "match_request", list.getSelectedValue()));
          }
        });
    btnChalange.setBounds(10, 263, 221, 23);
    contentPane.add(btnChalange);
  }
  // -------------------------------------------------------------------------------------- //
  // ---------------------------------- Constructor Helpers ------------------------------- //
  // -------------------------------------------------------------------------------------- //
  private void buildActiveKits(JPanel container) {
    // initialize variable
    final int WIDTH = 150;

    // set containment panel properties
    container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS));
    setComponentSize(container, 150, PAGE_HEIGHT);

    JLabel header = new JLabel("Active Kits");
    header.setHorizontalAlignment(header.CENTER);
    header.setFont(new Font("Serif", Font.BOLD, 18));
    setComponentSize(header, WIDTH, 25);

    // create list model and list
    listModel = new DefaultListModel();
    kitList = new JList(listModel);
    kitList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    kitList.addListSelectionListener(this);
    kitList.setFixedCellHeight(25);
    JScrollPane listScrollPane = new JScrollPane(kitList);

    // add elements to containment panel
    container.add(header);
    container.add(listScrollPane);
  }
Example #26
0
  /**
   * Instantiates a new help search panel.
   *
   * @param root the root
   * @param dialog the dialog
   */
  public HelpSearchPanel(HelpIndexRoot root, HelpDialog dialog) {
    this.root = root;
    this.dialog = dialog;

    setLayout(new BorderLayout());

    JPanel queryPanel = new JPanel();
    queryPanel.setLayout(new BorderLayout());
    queryPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    queryField = new JTextField();
    queryField.setActionCommand(MenuUtils.SEARCH_BUTTON);
    queryField.addActionListener(this);
    queryPanel.add(queryField, BorderLayout.CENTER);
    searchButton = new JButton(MenuUtils.SEARCH_BUTTON);
    searchButton.setActionCommand(MenuUtils.SEARCH_BUTTON);
    searchButton.addActionListener(this);
    queryPanel.add(searchButton, BorderLayout.EAST);
    add(queryPanel, BorderLayout.NORTH);

    listModel = new DefaultListModel();
    listModel.addElement("[No search results]");
    resultList = new JList(listModel);
    resultList.addListSelectionListener(this);
    resultList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    resultsScrollPane = new JScrollPane(resultList);
    add(resultsScrollPane, BorderLayout.CENTER);
  }
Example #27
0
  public ViewLinksPanel(final ActionListener pDownloadAction, final ActionListener pOpenAction) {
    mLinksListModel = new DefaultListModel();

    mLinksScrollPane = new JScrollPane();
    mLinksList = new JList(mLinksListModel);
    mLinksList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    Image img =
        Toolkit.getDefaultToolkit()
            .getImage(
                ViewIterationsDialog.class.getResource(
                    "/com/docdoku/client/resources/icons/view_large.png"));
    ImageIcon viewIcon = new ImageIcon(img);

    mViewDocButton = new JButton(I18N.BUNDLE.getString("ViewDocument_button"), viewIcon);
    mViewDocButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent pAE) {
            Dialog dialog =
                (Dialog) SwingUtilities.getAncestorOfClass(Dialog.class, ViewLinksPanel.this);
            DocumentMaster docM = MainModel.getInstance().getDocM(getSelectedLink());
            new ViewDocDetailsDialog(dialog, docM.getLastIteration(), pDownloadAction, pOpenAction);
          }
        });
    createLayout();
    createListener();
  }
Example #28
0
  private void actualizarReferencias() {
    if (petList != null) {
      petList.setCellRenderer(null);
    }

    petList = new JList();
    petList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    paleta = imagen.getPaleta();

    // Elementos iniciales
    elementosMuestra = new DefaultListModel<String>();
    for (int i = 0; i < paleta.getValores().size(); i++) {
      elementosMuestra.addElement("" + i);
    }

    //		System.out.println("Referencias: " + paleta.getValores().size());
    petList.setModel(elementosMuestra);
    petList.setSelectedIndex(0);
    ColorListRenderer elem = new ColorListRenderer(this, imagen.getPaleta());
    elem.setPreferredSize(new Dimension(150, 30));
    petList.setCellRenderer(elem);
    //		panel_1.add(petList);
    scrollPane.setViewportView(petList);

    petList.updateUI();
  }
 private void jbInit() throws Exception {
   this.setSize(new Dimension(560, 293));
   setTitle("Please select a contact to send");
   _scrollPaneContactList.setBounds(15, 10, 530, 237);
   _listContactList.setOpaque(false);
   _listContactList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   _listContactList.setCellRenderer(new ContactListRenderer());
   _listContactList.addListSelectionListener(
       new ListSelectionListener() {
         public void valueChanged(ListSelectionEvent listSelectionEvent) {
           _listContactList_valueChanged(listSelectionEvent);
         }
       });
   _listContactList.setVisibleRowCount(JLIST_VISIBLE_ROW_COUNT);
   _scrollPaneContactList.addScrollUpButtonActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _scrollPaneContactList_scrollUp(actionEvent);
         }
       });
   _scrollPaneContactList.addScrollDownButtonActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _scrollPaneContactList_scrollDown(actionEvent);
         }
       });
   _scrollPaneContactList.addToViewport(_listContactList);
   _panelContent.add(_scrollPaneContactList, null);
 }
Example #30
0
 @Override
 protected Void doInBackground() throws Exception {
   try {
     DefaultListModel dimListModel = new DefaultListModel();
     List<Dimension> dims =
         SdmxClientHandler.getDimensions(QueryPanel.selectedProvider, QueryPanel.selectedDataflow);
     int i = 0;
     for (Iterator<Dimension> iterator = dims.iterator(); iterator.hasNext(); ) {
       Dimension dim = iterator.next();
       dimListModel.add(i++, dim.getId());
     }
     JList dimList = new JList(dimListModel);
     dimList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     dimList.addListSelectionListener(new DimensionSelectionListener(parent));
     QueryPanel.dimensionsPane.getViewport().add(dimList);
     String query = QueryPanel.getSDMXQuery();
     QueryPanel.sdmxQuery.setText(query);
     // initSelections(QueryPanel.selectedDataflow,dims);
   } catch (Exception ex) {
     logger.severe(
         "Exception. Class: " + ex.getClass().getName() + " .Message: " + ex.getMessage());
     logger.log(Level.FINER, "", ex);
   } finally {
     progress.setVisible(false);
   }
   return null;
 }