Esempio n. 1
3
  /**
   * 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);
  }
  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();
  }
Esempio n. 3
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;
 }
  // -------------------------------------------------------------------------------------- //
  // ---------------------------------- 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);
  }
  /** 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);
      }
    }
  }
 private void createUI() {
   setHelpText("Importing an ontology from a repository", HELP_TEXT);
   list = new JList();
   list.addListSelectionListener(
       new ListSelectionListener() {
         public void valueChanged(ListSelectionEvent e) {
           setPageComplete(validateData());
           updateNextPage();
         }
       });
   refreshList();
   LabeledComponent lc =
       new LabeledComponent("Select an ontology to import", new JScrollPane(list));
   JPanel holder = new JPanel(new BorderLayout(3, 3));
   holder.add(lc, BorderLayout.NORTH);
   addRepositoryAction =
       new AbstractAction("Add repository...") {
         public void actionPerformed(ActionEvent e) {
           addRepository();
         }
       };
   JPanel buttonHolder = new JPanel(new FlowLayout(FlowLayout.RIGHT));
   buttonHolder.add(new JButton(addRepositoryAction), BorderLayout.SOUTH);
   holder.add(buttonHolder, BorderLayout.SOUTH);
   getContentComponent().add(holder, BorderLayout.NORTH);
   setPageComplete(validateData());
 }
Esempio n. 7
0
 private JList<String> tubList() {
   if (tubList == null) {
     tubList = ui.createList(new String[] {});
     tubList.addListSelectionListener(this);
   }
   return tubList;
 }
Esempio n. 8
0
 private JList<String> boxList() {
   if (boxList == null) {
     boxList = ui.createList(boxes().toArray(new String[0]));
     boxList.addListSelectionListener(this);
   }
   return boxList;
 }
Esempio n. 9
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);
  }
Esempio n. 10
0
  /** Register any event listeners. */
  private void setupActions() {
    list.addListSelectionListener(
        new ListSelectionListener() {

          @Override
          public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
              Example example = (Example) list.getSelectedValue();
              display(example);
            }
          }
        });

    runButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            Example example = (Example) list.getSelectedValue();
            example.run();
          }
        });

    exitButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });
  }
Esempio n. 11
0
  private void addControls() {
    setLayout(new BorderLayout());

    model = new AlertsTableModel(alerts);
    add(new JScrollPane(table = new JTable(model)), BorderLayout.CENTER);
    add(editor = new AlertEditor(main), BorderLayout.SOUTH);

    editor.setBorder(BorderFactory.createTitledBorder("Selected Alert:"));

    list = new JList(model);
    list.setLayoutOrientation(JList.VERTICAL_WRAP);
    list.setPrototypeCellValue("  255.255.255.255  ");
    list.setVisibleRowCount(4);

    AlertCellRendererSorter renderer = new AlertCellRendererSorter(table, model);
    TableColumnModel cModel = table.getColumnModel();
    for (int i = 0; i < cModel.getColumnCount(); i++) {
      cModel.getColumn(i).setCellRenderer(renderer);
    }
    table.getTableHeader().addMouseListener(renderer);
    table.getSelectionModel().addListSelectionListener(this);

    list.addListSelectionListener(this);
    list.addMouseListener(this);
  }
Esempio n. 12
0
  private void createAlist(boolean refresh) {
    avtaler = eal.getAvtaler(bruker);

    alist = new JList(avtaler);
    JScrollPane listScroller = new JScrollPane(alist);
    listScroller.setPreferredSize(new Dimension(300, 100));
    avtaleliste.add(listScroller);
    alist.addListSelectionListener(
        new ListSelectionListener() {

          @Override
          public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
              String id = alist.getSelectedValue().toString().substring(3, 7);
              ArrayList<String> info = new ArrayList<String>();
              info = eal.getInfo(id);
              textField1.setText(info.get(0));
              textField2.setText(info.get(1));
              textField3.setText(info.get(2));
              textField4.setText(info.get(3));
              textField5.setText(info.get(4));
              textField6.setText(info.get(5));
              textField7.setText(info.get(6) + ", ");
            }
          }
        });
  }
Esempio n. 13
0
  @Override
  protected void addFields() {
    name = new JTextField(30);
    isMulti = new JCheckBox();
    type = createPropertyTypeList();
    type.addListSelectionListener(this);
    value = new JTextField(30);
    errorValueFormat = new JTextArea(); // JTextField(60);

    valueCardPanel = new ValueCardPanel();

    LabeledGrid grid1 = new LabeledGrid(getLabels());
    grid1.addNLabeledComponent("name", name);
    grid1.addNLabeledComponent("type", new JScrollPane(type));
    //		grid1.addNLabeledComponent("type", createPropertyTypePanel());
    grid1.addNLabeledComponent("value", valueCardPanel);
    grid1.addNLabeledComponent("multi", isMulti);
    // getContentPane().add(grid1, BorderLayout.NORTH);

    // LabeledGrid grid2 = new LabeledGrid(getLabels());
    // grid2.addNLabeledComponent("error", errorValueFormat);
    // getContentPane().add(grid2, BorderLayout.CENTER);

    // getContentPane().add(new JScrollPane(type), BorderLayout.WEST);
    JPanel leftJustify = new JPanel(new FlowLayout(FlowLayout.LEFT));
    leftJustify.add(grid1);
    JSplitPane splitPane = createSplitPane(leftJustify, errorValueFormat);
    getContentPane().add(splitPane, BorderLayout.CENTER);
  }
Esempio n. 14
0
  // Add JButton and JList components to the panel.
  public ScribblePane3() {
    // Implicit super() call here invokes the superclass constructor

    // Add a "Clear" button to the panel.
    // Handle button events with an action listener
    JButton clear = new JButton("Clear");
    clear.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clear();
          }
        });
    this.add(clear);

    // Add a JList to allow color choices.
    // Handle list selection events with a ListSelectionListener.
    final JList colorList = new JList(colorNames);
    colorList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            setColor(colors[colorList.getSelectedIndex()]);
          }
        });
    this.add(colorList);
  }
Esempio n. 15
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());
 }
Esempio n. 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()]);
  }
Esempio n. 17
0
  /** @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);
            }
          }
        });
  }
Esempio n. 18
0
  public void initFenster() {
    // SplitPane
    JSplitPane splitPane = new JSplitPane();
    getContentPane().add(splitPane, BorderLayout.CENTER);
    JScrollPane scrollPane = new JScrollPane();
    splitPane.setLeftComponent(scrollPane);

    // Weinpanel
    weinpanel = new Weinpanel(this, betrieb);
    splitPane.setRightComponent(weinpanel);

    // Weinliste
    weinlist = new JList<Weine>(weinModel);
    weinlist.setFont(new Font("Tahoma", Font.PLAIN, 15));
    weinlist.setBorder(new EmptyBorder(0, 0, 0, 100));
    scrollPane.setViewportView(weinlist);
    weinlist.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent arg0) {
            doWeineValueChanged(arg0);
          }
        });

    // Label Header
    JLabel lblHeader = new JLabel("alle Weine");
    lblHeader.setFont(new Font("Tahoma", Font.BOLD, 15));
    scrollPane.setColumnHeaderView(lblHeader);
  }
Esempio n. 19
0
 private JList<String> machineList() {
   if (machineList == null) {
     machineList = ui.createList(boxes().toArray(new String[0]));
     machineList.addListSelectionListener(this);
   }
   return machineList;
 }
Esempio n. 20
0
  public static void main(String args[]) {
    String labels[] = {"A", "B", "C", "D", "E", "F", "G", "H"};
    JFrame frame = new JFrame("Selecting JList");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JList jlist = new JList(labels);
    JScrollPane scrollPane1 = new JScrollPane(jlist);
    frame.add(scrollPane1, BorderLayout.CENTER);

    ListSelectionListener listSelectionListener =
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent listSelectionEvent) {
            System.out.println("First index: " + listSelectionEvent.getFirstIndex());
            System.out.println(", Last index: " + listSelectionEvent.getLastIndex());
            boolean adjust = listSelectionEvent.getValueIsAdjusting();
            System.out.println(", Adjusting? " + adjust);
            if (!adjust) {
              JList list = (JList) listSelectionEvent.getSource();
              int selections[] = list.getSelectedIndices();
              Object selectionValues[] = list.getSelectedValues();
              for (int i = 0, n = selections.length; i < n; i++) {
                if (i == 0) {
                  System.out.println(" Selections: ");
                }
                System.out.println(selections[i] + "/" + selectionValues[i] + " ");
              }
            }
          }
        };
    jlist.addListSelectionListener(listSelectionListener);

    frame.setSize(350, 200);
    frame.setVisible(true);
  }
  AccountInfoPanel() {
    m_lastUpdated.setHorizontalAlignment(SwingConstants.RIGHT);

    m_accounts.setPreferredSize(new Dimension(10000, 100));
    JScrollPane acctScroll = new JScrollPane(m_accounts);
    acctScroll.setBorder(new TitledBorder("Select Account"));

    JScrollPane marginScroll = new JScrollPane(m_marginTable);
    JScrollPane mvScroll = new JScrollPane(m_mktValTable);
    JScrollPane portScroll = new JScrollPane(m_portfolioTable);

    NewTabbedPanel tabbedPanel = new NewTabbedPanel();
    tabbedPanel.addTab("Balances and Margin", marginScroll);
    tabbedPanel.addTab("Market Value", mvScroll);
    tabbedPanel.addTab("Portfolio", portScroll);
    tabbedPanel.addTab("Account Summary", new AccountSummaryPanel());
    tabbedPanel.addTab("Market Value Summary", new MarketValueSummaryPanel());
    tabbedPanel.addTab("Positions (all accounts)", new PositionsPanel());

    setLayout(new BorderLayout());
    add(acctScroll, BorderLayout.NORTH);
    add(tabbedPanel);
    add(m_lastUpdated, BorderLayout.SOUTH);

    m_accounts.addListSelectionListener(
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            onChanged();
          }
        });
  }
Esempio n. 22
0
 public ListDialog(JFrame parent, String title, String label, String[] values) {
   super(parent, title, true, cx, cy, cw, ch, xw, yw, cf);
   setSize(width, height);
   container = getContentPane();
   container.setLayout(new GridBagLayout());
   constraints = new GridBagConstraints();
   addWithConstraints(0, new JLabel(label));
   display = new JList<String>(values);
   addWithConstraints(1, new JScrollPane(display));
   display.addListSelectionListener(this);
   selected = new List();
   addWithConstraints(2, selected);
   selected.setFont(display.getFont());
   okBouton = new JButton("OK");
   addWithConstraints(3, okBouton);
   okBouton.addActionListener(this);
   cancelBouton = new JButton("Cancel");
   addWithConstraints(4, cancelBouton);
   cancelBouton.addActionListener(this);
   addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           dispose();
         }
       });
 }
Esempio n. 23
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);
  }
  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));
  }
Esempio n. 25
0
 public void valueChanged(ListSelectionEvent e) {
   if (!e.getValueIsAdjusting()) {
     if (userInputListener.isModified()) {
       // the user has modified the config, but not stored it
       int decision =
           JOptionPane.showConfirmDialog(
               this,
               "The configuration for project '"
                   + selectedProjectName
                   + "' has unsaved changes. Do you wish to save them?",
               "Save Changes?",
               JOptionPane.YES_NO_CANCEL_OPTION);
       if (decision == JOptionPane.YES_OPTION) { // store
         try {
           storeConfig(false);
         } catch (Exception ex) {
           Main.fatalError(ex);
         }
       }
       if (decision == JOptionPane.CANCEL_OPTION) {
         selection.removeListSelectionListener(this);
         selection.setSelectedValue(selectedProjectName, true);
         selection.addListSelectionListener(this);
         return;
       }
     }
     selectedProjectName = (String) selection.getSelectedValue();
     generateGUIGonfiguration(selectedProjectName);
     generateGUIDescription(selectedProjectName);
   }
 }
  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));
  }
Esempio n. 27
0
  public JComponent CreateOpTab(
      String operatorName, Map<String, Object> parameterMap, AppContext appContext) {

    initializeOperatorUI(operatorName, parameterMap);
    final JComponent panel = createPanel();

    bandList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(final ListSelectionEvent e) {
            setNumberOfEigenvalues();
          }
        });

    showEigenvalues.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            showEigenvaluesFlag = (e.getStateChange() == ItemEvent.SELECTED);
          }
        });

    subtractMeanImage.addItemListener(
        new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
            subtractMeanImageFlag = (e.getStateChange() == ItemEvent.SELECTED);
          }
        });

    initParameters();

    return panel;
  }
Esempio n. 28
0
 public JComponent getJComponent() {
   if (jp == null) {
     jp = new JPanel();
     jp.setLayout(new BorderLayout());
     jp.add(new JLabel(getDescription()), BorderLayout.WEST);
     jlist = new JList(descnames);
     if (numrows > 0) {
       try {
         jlist.setLayoutOrientation(JList.VERTICAL_WRAP);
       } catch (NoSuchMethodError e) {
       }
       jlist.setVisibleRowCount(numrows);
     }
     jlist.setBorder(new LineBorder(Color.black, 2));
     updateGUI();
     jlist.addListSelectionListener(
         new ListSelectionListener() {
           public void valueChanged(ListSelectionEvent e) {
             int flags = 0;
             for (int curindex = 0; curindex < size; curindex++) {
               JList list = (JList) e.getSource();
               if (list.isSelectedIndex(curindex)) {
                 flags |= (1 << curindex);
               }
             }
             enabled = flags;
             if (J2DBench.verbose.isEnabled()) {
               System.out.println(getOptionString());
             }
           }
         });
     jp.add(jlist, BorderLayout.EAST);
   }
   return jp;
 }
 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);
 }
  private void addListeners() {
    myListener =
        new SdkModel.Listener() {
          @Override
          public void sdkAdded(Sdk sdk) {}

          @Override
          public void beforeSdkRemove(Sdk sdk) {}

          @Override
          public void sdkChanged(Sdk sdk, String previousName) {
            refreshSdkList();
          }

          @Override
          public void sdkHomeSelected(Sdk sdk, String newSdkHome) {}
        };
    myProjectSdksModel.addListener(myListener);
    mySdkList.addListSelectionListener(
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent event) {
            updateOkButton();
          }
        });
  }