Java Code Examples for javax.swing.JList

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/binding/internal/.

Source file: MultiSelectionEditor.java

  22 
vote

@Override public JComponent createEditorComponent(PropertyDescriptor propertyDescriptor,BindingContext bindingContext){
  final JList list=new JList();
  ComponentAdapter adapter=new ListSelectionAdapter(list);
  bindingContext.bind(propertyDescriptor.getName(),adapter);
  return new JScrollPane(list);
}
 

Example 2

From project Clotho-Core, under directory /ClothoFabApps/FabDash/src/org/clothocore/widget/fabdash/browser/.

Source file: SearchBar.java

  22 
vote

public void createTabs(final Collection outcoll){
  for (  ObjType myObj : ObjType.values()) {
    ArrayList result=outcoll.getAll(myObj);
    if (!result.isEmpty()) {
      JScrollPane dynScroller=new JScrollPane();
      final JList dynLister=new JList();
      dynScroller.setViewportView(dynLister);
      setResults(outcoll,myObj,dynLister);
      mainPane.addTab(myObj.toString(),dynScroller);
    }
  }
}
 

Example 3

From project Enterprise-Application-Samples, under directory /CCA/PushApp/src/eclserver/panels/.

Source file: BesListPanel.java

  22 
vote

private void addressListValueChanged(javax.swing.event.ListSelectionEvent evt){
  if (evt.getValueIsAdjusting()) {
    return;
  }
  JList entryList=(JList)evt.getSource();
  selectedEntry=entryList.getSelectedIndex();
  this.txtServerPort.setText("");
}
 

Example 4

From project imageflow, under directory /src/de/danielsenff/imageflow/.

Source file: ImageFlowView.java

  22 
vote

private void showSimpleListOfUnits(UnitList unitList){
  final JDialog dialog=new JDialog();
  final DefaultListModel lm=new DefaultListModel();
  for (  final Node node : unitList) {
    lm.addElement(node);
  }
  final JList list=new JList(lm);
  dialog.add(new ScrollPane().add(list));
  dialog.pack();
  dialog.setVisible(true);
}
 

Example 5

From project joshua, under directory /src/joshua/ui/hypergraph_visualizer/.

Source file: HyperEdgeListSelectionListener.java

  22 
vote

public void valueChanged(ListSelectionEvent e){
  JList list=(JList)e.getSource();
  viewer.graph.replaceSubtrees(list.getSelectedValues());
  viewer.setGraphLayout(new StaticLayout<Vertex,Edge>(viewer.graph,new HyperGraphTransformer(viewer.graph)));
  viewer.graph.addNonTreeEdges();
  return;
}
 

Example 6

From project LanguageSpecCreator, under directory /src/SpecificationCreation/look/.

Source file: TreeTransferHandler.java

  22 
vote

/** 
 * Transfers the string value of the property.
 * @param c Tree component
 * @return Transferabe
 * @see TransferHandler#createTransferable(JComponent)
 */
public Transferable createTransferable(JComponent c){
  if (c instanceof JTree) {
    JTree tree=(JTree)c;
    TreePath path=tree.getSelectionPath();
    ClassTreeNode node=(ClassTreeNode)path.getLastPathComponent();
    if (node.isCardinal() || node.isMenu() || node.isShaded())     return null;
    return new StringSelection(node.toString());
  }
  JList list=(JList)c;
  return new StringSelection(list.getSelectedValue().toString());
}
 

Example 7

From project LateralGM, under directory /org/lateralgm/components/.

Source file: ActionList.java

  22 
vote

public void mouseClicked(MouseEvent e){
  if (e.getClickCount() != 2 || !(e.getSource() instanceof JList))   return;
  JList l=(JList)e.getSource();
  Object o=l.getSelectedValue();
  if (o == null && l.getModel().getSize() == 0) {
    o=new Action(LibManager.codeAction);
    ((ActionListModel)l.getModel()).add((Action)o);
    l.setSelectedValue(o,true);
  }
  if (o == null || !(o instanceof Action))   return;
  openActionFrame(parent.get(),(Action)o);
}
 

Example 8

From project Maimonides, under directory /src/com/codeko/apps/maimonides/.

Source file: MaimonidesUtil.java

  22 
vote

@SuppressWarnings("unchecked") public static void mostrarVentanaListaDatos(String titulo,Collection datos){
  if (datos.size() > 0) {
    if (datos.size() > 1) {
      JList l=new JList(datos.toArray());
      JScrollPane scroll=new JScrollPane(l);
      JOptionPane.showMessageDialog(MaimonidesApp.getApplication().getMainFrame(),scroll,titulo,JOptionPane.PLAIN_MESSAGE);
    }
 else {
      JOptionPane.showMessageDialog(MaimonidesApp.getApplication().getMainFrame(),datos.toArray()[0],titulo,JOptionPane.PLAIN_MESSAGE);
    }
  }
}
 

Example 9

From project Project-2, under directory /.

Source file: ExpandableList.java

  22 
vote

@Override public void mouseClicked(MouseEvent me){
  if (me.getClickCount() == 2) {
    JList source=(JList)me.getSource();
    Object selected=source.getSelectedValue();
    fireActionPerformed(selected);
  }
}
 

Example 10

From project Project2, under directory /src/.

Source file: ExpandableList.java

  22 
vote

@Override public void mouseClicked(MouseEvent me){
  if (me.getClickCount() == 2) {
    JList source=(JList)me.getSource();
    Object selected=source.getSelectedValue();
    fireActionPerformed(selected);
  }
}
 

Example 11

From project addis, under directory /application/src/main/java/org/drugis/addis/gui/builder/.

Source file: AddVariableView.java

  21 
vote

public AddVariableView(JDialog dialog,PresentationModel<Variable> model,JButton okButton){
  d_dialog=dialog;
  d_model=(VariablePresentation)model;
  d_categories=new JList(d_model.getCategoricalModel().getBean().getCategories());
  d_enoughCategories=new TwoCategoriesModel(d_categories.getModel());
  Bindings.bind(okButton,"enabled",d_validator);
}
 

Example 12

From project codjo-segmentation, under directory /codjo-segmentation-gui/src/main/java/net/codjo/segmentation/gui/editor/.

Source file: EditorMainPanelLogic.java

  21 
vote

ExpressionJPopupMenu(int posX,int posY,boolean isFunction){
  JScrollPane scrollPane;
  JList workingJList=new JList();
  if (isFunction) {
    workingJList.setListData(fieldsDataList);
    workingJList.setBackground(new Color(204,255,255));
  }
 else {
    workingJList.setListData(functionDataList);
    workingJList.setBackground(new Color(204,255,204));
  }
  workingJList.setSelectedIndex(0);
  workingJList.setVisibleRowCount(5);
  scrollPane=new JScrollPane(workingJList);
  scrollPane.setBorder(null);
  workingJList.addMouseListener(jListMouseListener);
  workingJList.addKeyListener(jListKeyListener);
  this.setModal(true);
  this.setLocationRelativeTo(editorMainPanelGui);
  this.setResizable(false);
  this.addKeyListener(new MyKeyAdapter(this));
  this.getContentPane().add(scrollPane);
  this.pack();
  this.setLocation(posX,posY);
  this.setVisible(true);
}
 

Example 13

From project empire-db, under directory /empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/.

Source file: ClientGUI.java

  21 
vote

/** 
 * This method initializes _searchResult
 * @return javax.swing.JList
 */
private JList get_searchResult(){
  if (_searchResult == null) {
    _employeeListModel=new EmployeeListModel();
    _searchResult=new JList(_employeeListModel);
    _searchResult.setSize(new Dimension(500,180));
    _searchResult.setLocation(new Point(10,10));
  }
  return _searchResult;
}
 

Example 14

From project flyingsaucer, under directory /flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/extend/form/.

Source file: SelectField.java

  21 
vote

public JComponent create(){
  List optionList=createList();
  if (shouldRenderAsList()) {
    JList select=new JList(optionList.toArray());
    applyComponentStyle(select);
    select.setCellRenderer(new CellRenderer());
    select.addListSelectionListener(new HeadingItemListener());
    if (hasAttribute("multiple") && getAttribute("multiple").equalsIgnoreCase("true")) {
      select.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    }
 else {
      select.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }
    int size=0;
    if (hasAttribute("size")) {
      size=GeneralUtil.parseIntRelaxed(getAttribute("size"));
    }
    if (size == 0) {
      select.setVisibleRowCount(Math.min(select.getModel().getSize(),20));
    }
 else {
      select.setVisibleRowCount(size);
    }
    return new JScrollPane(select);
  }
 else {
    JComboBox select=new JComboBox(optionList.toArray());
    applyComponentStyle(select);
    select.setEditable(false);
    select.setRenderer(new CellRenderer());
    select.addItemListener(new HeadingItemListener());
    return select;
  }
}
 

Example 15

From project freemind, under directory /freemind/accessories/plugins/.

Source file: AutomaticLayout.java

  21 
vote

public StylePatternListProperty(String description,String label,TextTranslator pTranslator,MindMapController pController){
  super();
  this.description=description;
  this.label=label;
  mTranslator=pTranslator;
  mindMapController=pController;
  mList=new JList();
  mList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  mDefaultListModel=new DefaultListModel();
  mList.setModel(mDefaultListModel);
  mList.addListSelectionListener(this);
  patterns=null;
}
 

Example 16

From project FScape, under directory /src/main/java/de/sciss/fscape/session/.

Source file: DocumentFrame.java

  21 
vote

public void actionPerformed(ActionEvent e){
  if (threadRunning)   return;
  final List presetNames=getPresets().presetNames();
  presetNames.remove(Presets.DEFAULT);
  final JList list=new JList(presetNames.toArray());
  final JScrollPane scroll=new JScrollPane(list);
  final JOptionPane op=new JOptionPane(scroll,JOptionPane.QUESTION_MESSAGE,JOptionPane.OK_CANCEL_OPTION);
  final int result=BasicWindowHandler.showDialog(op,getComponent(),app.getResourceString("procWinChooseDelPreset"));
  if (result == JOptionPane.OK_OPTION) {
    final Object[] selNames=list.getSelectedValues();
    for (int i=0; i < selNames.length; i++) {
      deletePreset(selNames[i].toString());
    }
  }
}
 

Example 17

From project Gmote, under directory /gmoteserver/src/org/gmote/server/.

Source file: MediaPathChooserUi.java

  21 
vote

/** 
 * This method initializes lstPaths	
 * @return javax.swing.JList	
 */
private JList getLstPaths(){
  if (lstPaths == null) {
    lstPaths=new JList(basePaths);
    lstPaths.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lstPaths.setSelectedIndex(0);
  }
  return lstPaths;
}
 

Example 18

From project JaamSim, under directory /com/sandwell/JavaSimulation3D/.

Source file: EditBox.java

  21 
vote

public void setListData(ArrayList<String> aList){
  if (list == null) {
    listModel=new DefaultListModel();
    list=new JList(listModel);
    list.setCellRenderer(new ListRenderer());
    checkBoxMouseAdapter=new CheckBoxMouseAdapter();
    list.addMouseListener(checkBoxMouseAdapter);
  }
  listModel.clear();
  for (  String each : aList) {
    JCheckBox checkBox=new JCheckBox(each);
    listModel.addElement(checkBox);
  }
}
 

Example 19

From project jSite, under directory /src/main/java/de/todesbaum/jsite/gui/.

Source file: NodeManagerPage.java

  21 
vote

/** 
 * {@inheritDoc}
 */
@Override @SuppressWarnings("null") public void valueChanged(ListSelectionEvent e){
  Object source=e.getSource();
  if (source instanceof JList) {
    JList sourceList=(JList)source;
    if ("node-list".equals(sourceList.getName())) {
      Node node=(Node)sourceList.getSelectedValue();
      boolean enabled=(node != null);
      nodeNameTextField.setEnabled(enabled);
      nodeHostnameTextField.setEnabled(enabled);
      nodePortSpinner.setEnabled(enabled);
      deleteNodeAction.setEnabled(enabled && (nodeListModel.size() > 1));
      if (enabled) {
        nodeNameTextField.setText(node.getName());
        nodeHostnameTextField.setText(node.getHostname());
        nodePortSpinner.setValue(node.getPort());
      }
 else {
        nodeNameTextField.setText("");
        nodeHostnameTextField.setText("localhost");
        nodePortSpinner.setValue(9481);
      }
    }
  }
}
 

Example 20

From project sgl-Editor, under directory /src/de/moonshade/osbe/gui/.

Source file: DefaultGUI.java

  21 
vote

private JList getObjectMethodList(){
  if (objectMethodList == null) {
    objectMethodListModel=new DefaultListModel();
    objectMethodListModel.addElement("Jane Doe");
    objectMethodListModel.addElement("John Smith");
    objectMethodListModel.addElement("Kathy Green");
    objectMethodList=new JList(objectMethodListModel);
  }
  return objectMethodList;
}
 

Example 21

From project sikuli, under directory /sikuli-ide/src/main/java/org/sikuli/ide/sikuli_test/.

Source file: DefaultFailureDetailView.java

  21 
vote

/** 
 * Returns the component used to present the trace
 */
public Component getComponent(){
  if (fList == null) {
    fList=new JList(new StackTraceListModel());
    fList.setFont(new Font("Dialog",Font.PLAIN,12));
    fList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    fList.setVisibleRowCount(5);
    fList.setCellRenderer(new StackEntryRenderer());
  }
  return fList;
}
 

Example 22

From project srec, under directory /core/src/main/java/com/github/srec/command/jemmy/.

Source file: AssertListContentCommand.java

  21 
vote

@SuppressWarnings("rawtypes") @Override protected void runJemmy(ExecutionContext ctx,Map<String,Value> params) throws JemmyException {
  String locator=coerceToString(params.get(LOCATOR),ctx);
  Window window=JemmyDSL.currentWindow();
  Component object=JemmyDSL.findComponent(locator,window.getComponent().getSource());
  ListModel lstModel=null;
  if (object instanceof JList) {
    JList jl=(JList)object;
    lstModel=jl.getModel();
  }
 else   if (object instanceof JComboBox) {
    JComboBox jbc=(JComboBox)object;
    lstModel=jbc.getModel();
  }
 else {
    throw new AssertionFailedException("Component [" + locator + "] is a "+ object.getClass().getName()+ ", and not a JList or JComboBox");
  }
  String[] expected=coerceToArray(params.get("content"),ctx);
  int size=lstModel.getSize();
  if (expected.length != size)   throw new AssertionFailedException("Different size, expected " + expected.length + " but was "+ size);
  for (int i=0; i < size; i++) {
    Object o=lstModel.getElementAt(i);
    String actual=(o instanceof String) ? (String)o : o.toString();
    if (!expected[i].equals(actual))     throw new AssertionFailedException("Difference found at " + i + "th element , expected "+ expected[i]+ " but was "+ lstModel.getElementAt(i));
  }
}
 

Example 23

From project codjo-standalone-common, under directory /src/main/java/net/codjo/utils/sql/.

Source file: SqlRequetor.java

  20 
vote

/** 
 * Rempli la liste des op?ateurs de comparaison.
 */
private void buildListOpeartors(){
  List oper=new ArrayList();
  oper.add("Egal");
  oper.add("Sup?ieur");
  oper.add("Sup?ieur ou ?al");
  oper.add("Inf?ieur");
  oper.add("Inf?ieur ou ?al");
  oper.add("Diff?ent");
  oper.add("Commence par");
  oper.add("Finit par");
  oper.add("Contient");
  oper.add("Ne contient pas");
  oper.add("Est null");
  oper.add("Est pas null");
  listOperators=new JList(oper.toArray());
}
 

Example 24

From project encog-java-workbench, under directory /src/main/java/org/encog/workbench/tabs/visualize/grid/.

Source file: VisualizeGridTab.java

  20 
vote

public VisualizeGridTab(BufferedMLDataSet data){
  super(null);
  this.data=data;
  setLayout(new BorderLayout());
  this.list=new JList(this.model=new TrainingListModel(data));
  this.scroll=new JScrollPane(this.list);
  this.scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  this.add(this.scroll,BorderLayout.WEST);
  this.list.addListSelectionListener(this);
  JPanel rightPanel=new JPanel();
  this.add(rightPanel,BorderLayout.CENTER);
  rightPanel.setLayout(new BorderLayout());
  JPanel upperPanel=new JPanel();
  upperPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
  rightPanel.add(upperPanel,BorderLayout.NORTH);
  upperPanel.add(new JLabel("Grid Dimensions(h x w):"));
  upperPanel.add(this.fieldHeight=new JTextField(5));
  upperPanel.add(new JLabel(" x "));
  upperPanel.add(this.fieldWidth=new JTextField(5));
  upperPanel.add(this.btnUpdate=new JButton("Update"));
  rightPanel.add(this.grid=new GridPanel(),BorderLayout.CENTER);
  int width=(int)Math.sqrt(this.data.getInputSize());
  int height=width;
  while ((width * height) < this.data.getInputSize()) {
    height++;
  }
  this.fieldHeight.setText("" + height);
  this.fieldWidth.setText("" + width);
  this.btnUpdate.addActionListener(this);
}
 

Example 25

From project GenericKnimeNodes, under directory /com.genericworkflownodes.knime.base_plugin/src/com/genericworkflownodes/knime/generic_node/dialogs/param_dialog/itemlist/.

Source file: ChoiceDialog.java

  20 
vote

private void init(){
  list=new JList(values);
  list.setFixedCellWidth(200);
  JScrollPane listScrollPane=new JScrollPane(list);
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  addButton=new JButton("Pick");
  addButton.addActionListener(this);
  Box box=Box.createVerticalBox();
  box.add(listScrollPane);
  box.add(addButton);
  box.add(Box.createVerticalGlue());
  this.setContentPane(box);
  setDefaultCloseOperation(DISPOSE_ON_CLOSE);
  setModalityType(ModalityType.APPLICATION_MODAL);
  setSize(300,200);
  pack();
}
 

Example 26

From project glg2d, under directory /src/test/java/glg2d/.

Source file: UIDemo.java

  20 
vote

JComponent createListComponent(){
  DefaultListModel model=new DefaultListModel();
  model.addElement("alpha");
  model.addElement("bravo");
  model.addElement("charlie");
  model.addElement("delta");
  model.addElement("echo");
  model.addElement("foxtrot");
  model.addElement("golf");
  model.addElement("hotel");
  model.addElement("india");
  model.addElement("juliet");
  model.addElement("kilo");
  model.addElement("limo");
  model.addElement("mike");
  model.addElement("november");
  return new JList(model);
}
 

Example 27

From project hudsontrayapp-plugin, under directory /client-common/src/main/java/org/hudson/trayapp/gui/.

Source file: ConfigurationPanel.java

  20 
vote

/** 
 * This method initializes serverList	
 * @return javax.swing.JList	
 */
private JList getServerList(){
  if (serverList == null) {
    serverList=new JList();
    serverList.setPreferredSize(new Dimension(120,120));
    serverList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    serverList.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    serverList.addMouseListener(new MouseAdapter(){
      public void mouseClicked(      MouseEvent e){
        int index=serverList.locationToIndex(e.getPoint());
        if (index != -1 && index < model.getServerModelSize()) {
          Server server=model.getServerAt(index);
          if (server == null) {
            serverLocationField.setText("");
            serverNameField.setText("");
            serverLocationField.setEnabled(false);
            serverNameField.setEnabled(false);
          }
 else {
            serverLocationField.setText(server.getURL());
            serverNameField.setText(server.getName());
            serverLocationField.setEnabled(true);
            serverNameField.setEnabled(true);
          }
        }
      }
    }
);
  }
  return serverList;
}
 

Example 28

From project Java3DTest, under directory /Java3D/src/.

Source file: CurrentShapesPanel.java

  20 
vote

public CurrentShapesPanel(JPanel panel){
  panel.setLayout(new BorderLayout());
  JLabel resize_title=new JLabel("S H A P E S");
  resize_title.setOpaque(true);
  resize_title.setBackground(Color.lightGray);
  panel.add(resize_title,BorderLayout.PAGE_START);
  JPanel currentShapesPanel=new JPanel();
  panel.add(currentShapesPanel);
  listModel=new DefaultListModel();
  list=new JList(listModel);
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  list.addListSelectionListener(this);
  list.addKeyListener(this);
  list.addListSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent evt){
      Enumeration e=GUI_3D.getSwingTest().getSceneBranchGroup().getAllChildren();
      int index=0;
      while (e.hasMoreElements() != false) {
        Object sgObject=((SceneGraphObject)(e.nextElement()));
        if (((String)((Group)((Group)(((Group)sgObject).getChild(0))).getChild(0)).getChild(0).getUserData()).equalsIgnoreCase((String)list.getSelectedValue())) {
          GUI_3D.getSwingTest().setShapeClicked(((Group)((Group)(((Group)sgObject).getChild(0))).getChild(0)).getChild(0));
          System.out.println(GUI_3D.getSwingTest().getShapeClicked());
        }
      }
    }
  }
);
  JScrollPane listScroll=new JScrollPane(list);
  listScroll.setBorder(BorderFactory.createMatteBorder(0,0,0,0,Color.GRAY));
  listScroll.setPreferredSize(new Dimension(147,143));
  currentShapesPanel.add(listScroll);
  currentShapesPanel.add(Box.createVerticalGlue());
  list.setFixedCellHeight(27);
}
 

Example 29

From project JavaChat, under directory /ChatClient/src/UI/.

Source file: RoomChatUI.java

  20 
vote

public RoomChatUI(Room r,String accountTitle){
  this.r=r;
  setTitle(r.getRoomName());
  setLayout(null);
  model=new DefaultListModel();
  memberList=new JList(model);
  txtOutput=new JTextArea();
  txtInput=new JTextArea();
  paneMemberList=new JScrollPane(memberList,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  paneOutput=new JScrollPane(txtOutput,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  paneInput=new JScrollPane(txtInput,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  add(paneMemberList);
  add(paneOutput);
  add(paneInput);
  paneMemberList.setBounds(10,10,150,405);
  paneOutput.setBounds(165,10,350,300);
  paneInput.setBounds(165,315,350,100);
  txtOutput.setEditable(false);
  setSize(535,450);
  setResizable(false);
  setLocationRelativeTo(null);
  setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  setVisible(true);
  addWindowListener(winListener);
  txtInput.addKeyListener(keyListener);
}
 

Example 30

From project jCAE, under directory /jcae/mesh-algos/src/org/jcae/netbeans/viewer3d/.

Source file: ViewCameraList.java

  20 
vote

private JPanel createlist(){
  JPanel toReturn=new JPanel();
  model=new AbstractListModel(){
    public int getSize(){
      return mgr.getNumberOfCameras();
    }
    public Object getElementAt(    int index){
      return mgr.getScreenshotCamera(index);
    }
  }
;
  viewList=new JList(model);
  viewList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  viewList.setCellRenderer(new ViewRenderer());
  viewList.setVisibleRowCount(5);
  if (mgr.getNumberOfCameras() > 0)   viewList.setSelectedIndex(0);
  JScrollPane scroll=new JScrollPane(viewList);
  toReturn.add(scroll);
  return toReturn;
}
 

Example 31

From project JoshEdit, under directory /org/lateralgm/joshedit/.

Source file: CompletionMenu.java

  20 
vote

public CompletionMenu(Frame owner,JoshText a,int y,int x1,int x2,int caret,Completion[] c){
  area=a;
  row=y;
  wordStart=x1;
  wordEnd=x2;
  this.caret=caret;
  completions=c;
  keyHandler=new KeyHandler();
  completionList=new JList();
  completionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  completionList.addKeyListener(keyHandler);
  completionList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (apply())       e.consume();
 else       dispose();
    }
  }
);
  scroll=new JScrollPane(completionList);
  scroll.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  ph=new PopupHandler(owner,scroll);
  ph.addHideListener(new PopupHandler.HideListener(){
    @Override public void hidePerformed(    boolean wasVisible){
      dispose();
    }
  }
);
  reset();
}
 

Example 32

From project liquidfeedback-java-sdk, under directory /examples/src/main/java/lfapi/v2/services/example/.

Source file: ApiSampleAreaUnit.java

  20 
vote

/** 
 * Instantiates a new api sample area unit.
 */
public ApiSampleAreaUnit(){
  super(new GridLayout(1,0));
  f=LiquidFeedbackServiceFactory.newInstance(ApiSampleConstants.TEST_API_BASE_URL);
  service=f.createAreaUnitService();
  Unit u=new Unit();
  u.id=1;
  u.name="loading..";
  unitTreeRoot=new DefaultMutableTreeNode(new UnitInfo(u));
  unitTree=new JTree(unitTreeRoot);
  unitTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  unitTree.addTreeSelectionListener(this);
  JScrollPane unitTreeScroll=new JScrollPane(unitTree);
  areaListModel=new SortableListModel<AreaInfo>();
  areaList=new JList(areaListModel);
  areaList.addListSelectionListener(this);
  JScrollPane areaViewScroll=new JScrollPane(areaList);
  JSplitPane splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  splitPane.setTopComponent(unitTreeScroll);
  splitPane.setBottomComponent(areaViewScroll);
  areaViewScroll.setMinimumSize(new Dimension(300,200));
  unitTreeScroll.setMinimumSize(new Dimension(200,100));
  splitPane.setDividerLocation(200);
  splitPane.setPreferredSize(new Dimension(640,480));
  add(splitPane);
  (new AreaUnitLoader()).execute();
}
 

Example 33

From project packetsamurai, under directory /src/com/l2j/packetsamurai/gui/.

Source file: Main.java

  20 
vote

public void showInterfaceSelector(String[] interfaceNames){
  _selectInterfaceWindow=new JDialog(_frame);
  _selectInterfaceWindow.setTitle("Double-Click to Select the Interface");
  _selectInterfaceWindow.setLocationRelativeTo(_frame);
  _interfaceList=new JList(interfaceNames);
  _interfaceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  JScrollPane scrollPane=new JScrollPane(_interfaceList);
  MouseListener mouseListener=new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() == 2) {
        int index=_interfaceList.locationToIndex(e.getPoint());
        if (Captor.getInstance().getCurrentDeviceId() == index) {
          _selectInterfaceWindow.dispose();
          return;
        }
        Captor.getInstance().openDevice(index);
        PacketSamurai.setConfigProperty("NetworkInterface",Integer.toString(index));
        _selectInterfaceWindow.dispose();
      }
    }
  }
;
  _interfaceList.addMouseListener(mouseListener);
  _selectInterfaceWindow.add(scrollPane);
  _selectInterfaceWindow.setSize(400,350);
  _selectInterfaceWindow.setVisible(true);
}
 

Example 34

From project uniquery, under directory /src/org/uniquery/gui/query/editor/autocomplete/.

Source file: CompletionMenu.java

  20 
vote

public CompletionMenu(AutoCompletion completer,SqlEditorPane editor){
  this.completer=completer;
  this.editor=editor;
  editor.addCaretListener(this);
  editor.addKeyListener(this);
  list=new JList();
  list.setDoubleBuffered(true);
  list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  list.setLayoutOrientation(JList.VERTICAL);
  list.setCellRenderer(new ListIconRenderer());
  list.setAutoscrolls(true);
  list.addMouseListener(this);
  model=new DefaultListModel();
  list.setModel(model);
  JScrollPane sp=new JScrollPane(list);
  sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  setPreferredSize(new Dimension(400,200));
  add(sp);
  pack();
  resetLocation();
}
 

Example 35

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/filesearch/.

Source file: DateSearchFilter.java

  19 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  String str=(value == null) ? "" : value.toString();
  if (SEPARATOR.equals(str)) {
    return separator;
  }
  if (isSelected) {
    setBackground(list.getSelectionBackground());
    setForeground(list.getSelectionForeground());
  }
 else {
    setBackground(list.getBackground());
    setForeground(list.getForeground());
  }
  setFont(list.getFont());
  setText(str);
  return this;
}
 

Example 36

From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/ui/.

Source file: IcolForm.java

  19 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  final Component cellRendererComponent=super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  if (cellRendererComponent instanceof JLabel && value instanceof AeArea) {
    final JLabel label=(JLabel)cellRendererComponent;
    final AeArea aeArea=(AeArea)value;
    label.setText(aeArea.getLabel());
  }
  return cellRendererComponent;
}
 

Example 37

From project beanmill_1, under directory /src/main/java/de/cismet/beanmill/filter/.

Source file: ListView.java

  19 
vote

/** 
 * Creates new form ListView.
 * @param fs  DOCUMENT ME!
 */
public ListView(final FilterSet fs){
  initComponents();
  classIcon=new ImageIcon(getClass().getResource("/de/cismet/beanmill/res/class.png"));
  listModel=new DefaultListModel();
  listeners=new Vector<FilterListener>();
  filterSet=fs;
  active=true;
  lstClasses.setModel(listModel);
  lstClasses.setCellRenderer(new DefaultListCellRenderer(){
    @Override public Component getListCellRendererComponent(    final JList arg0,    final Object arg1,    final int arg2,    final boolean arg3,    final boolean arg4){
      final JLabel l=(JLabel)super.getListCellRendererComponent(arg0,arg1,arg2,arg3,arg4);
      l.setIcon(classIcon);
      return l;
    }
  }
);
}
 

Example 38

From project BMach, under directory /src/bmach/ui/gui/components/.

Source file: JByteContainerPanel.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  if (value instanceof IMemoryCell) {
    IMemoryCell cell=(IMemoryCell)value;
    addressPanel.setAddress(cell.getAddress().toHexString());
    valuePanel.setValue(cell.getContent().toHexString());
    if (isSelected) {
      this.setBackground(list.getSelectionBackground());
      this.setOpaque(true);
    }
 else {
      this.setBackground(transparentColor);
      this.setOpaque(false);
    }
  }
 else   if (value instanceof IRegister) {
    IRegister register=(IRegister)value;
    addressPanel.setAddress(register.getAddress().toHexString());
    valuePanel.setValue(register.getContent().toHexString());
  }
  this.setToolTipText(getTooltipForHexValue(valuePanel.getValue()));
  return this;
}
 

Example 39

From project Cinch, under directory /src/com/palantir/ptoss/cinch/swing/.

Source file: JListWiringHarness.java

  19 
vote

private Binding bindJList(final Bound bound,final Mutator mutator,final JList list){
  final List<Object> ons=BindingContext.getOnObjects(bound.on(),mutator.getModel());
  Binding binding=new Binding(){
    public <T extends Enum<?> & ModelUpdate>void update(    T... changed){
      if (!BindingContext.isOn(ons,changed)) {
        return;
      }
      try {
        updateListModel(list,(List<?>)mutator.get());
      }
 catch (      Exception ex) {
        Wiring.logger.error("exception in JList binding",ex);
      }
    }
  }
;
  mutator.getModel().bind(binding);
  return binding;
}
 

Example 40

From project codjo-broadcast, under directory /codjo-broadcast-gui/src/main/java/net/codjo/broadcast/gui/.

Source file: BroadcastSectionsDetailWindow.java

  19 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int idx,boolean selected,boolean focus){
  JLabel label=(JLabel)super.getListCellRendererComponent(list,value,idx,selected,focus);
  if (value != null) {
    GuiPreference guiPreference=guiPrefManager.getPreferenceFor((String)value);
    String rendererLabel=guiPreference.getFamilyLabel();
    label.setText(rendererLabel);
  }
  return label;
}
 

Example 41

From project codjo-control, under directory /codjo-control-gui/src/main/java/net/codjo/control/gui/plugin/.

Source file: DefaultQuarantineWindow.java

  19 
vote

private void reloadFilter(RequestComboBox comboBox) throws RequestException {
  comboBox.getDataSource().load();
  Result loadResult=comboBox.getDataSource().getLoadResult();
  List<Row> rows=loadResult.getRows();
  if (rows == null) {
    rows=new ArrayList<Row>();
  }
  Row newRow=new Row();
  newRow.addField("value",FilterConstants.ALL);
  rows.add(0,newRow);
  loadResult.setRows(rows);
  comboBox.getDataSource().setLoadResult(loadResult);
  ListCellRenderer actualRenderer=comboBox.getRenderer();
  if (actualRenderer == null) {
    comboBox.setRenderer(new DefaultListCellRenderer(){
      @Override public Component getListCellRendererComponent(      JList list,      Object value,      int index,      boolean isSelected,      boolean cellHasFocus){
        if (FilterConstants.ALL.equals(value)) {
          value=translate("DefaultQuarantineWindow.filterComboBox.all",guiContext);
        }
        return super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
      }
    }
);
  }
 else {
    comboBox.setRenderer(new TranslationRenderer(actualRenderer));
  }
}
 

Example 42

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/configuration/.

Source file: ConfigurationDialog.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  JLabel label=(JLabel)renderer.getListCellRendererComponent(list,getRendererValue(value),index,isSelected,cellHasFocus);
  UserTreatment usrTrt=(UserTreatment)value;
  try {
    TreatmentModel trtMod=getTreatmentModel(usrTrt.getId());
    if (trtMod.isConfigurable(exclude)) {
      label.setFont(label.getFont().deriveFont(Font.BOLD));
    }
  }
 catch (  RequestException e) {
    ;
  }
  return label;
}
 

Example 43

From project codjo-imports, under directory /codjo-imports-gui/src/main/java/net/codjo/imports/gui/.

Source file: FieldImportDetailWindow.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  setText("");
  if (null != value) {
    char charValue=(Character)value;
switch (charValue) {
case FieldType.BOOLEAN_FIELD:
      setText(InternationalizationUtil.translate("FieldImportDetailWindow#FieldTypeRenderer.boolean",dataSource.getGuiContext()));
    break;
case FieldType.CLASS_FIELD:
  setText(InternationalizationUtil.translate("FieldImportDetailWindow#FieldTypeRenderer.class",dataSource.getGuiContext()));
break;
case FieldType.DATE_FIELD:
setText(InternationalizationUtil.translate("FieldImportDetailWindow#FieldTypeRenderer.date",dataSource.getGuiContext()));
break;
case FieldType.NUMERIC_FIELD:
setText(InternationalizationUtil.translate("FieldImportDetailWindow#FieldTypeRenderer.numeric",dataSource.getGuiContext()));
break;
case FieldType.STRING_FIELD:
setText(InternationalizationUtil.translate("FieldImportDetailWindow#FieldTypeRenderer.string",dataSource.getGuiContext()));
break;
default :
setText(InternationalizationUtil.translate("FieldImportDetailWindow#FieldTypeRenderer.unknown",dataSource.getGuiContext()));
}
}
return this;
}
 

Example 44

From project Cours-3eme-ann-e, under directory /Java/FerryInpres/src/mail_client/.

Source file: MainForm.java

  19 
vote

/** 
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked") private void initComponents(){
  jLabel1=new javax.swing.JLabel();
  jScrollPane1=new javax.swing.JScrollPane();
  messagesList=new javax.swing.JList();
  nouveauMessageButton=new javax.swing.JButton();
  actualiserButton=new javax.swing.JButton();
  setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  setTitle("Messagerie");
  jLabel1.setText("Liste des messages");
  messagesList.setModel(new DefaultListModel());
  messagesList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
  messagesList.addMouseListener(new java.awt.event.MouseAdapter(){
    public void mouseClicked(    java.awt.event.MouseEvent evt){
      messagesListMouseClicked(evt);
    }
  }
);
  jScrollPane1.setViewportView(messagesList);
  nouveauMessageButton.setText("Nouveau message");
  nouveauMessageButton.addActionListener(new java.awt.event.ActionListener(){
    public void actionPerformed(    java.awt.event.ActionEvent evt){
      nouveauMessageButtonActionPerformed(evt);
    }
  }
);
  actualiserButton.setText("Rechercher de nouveaux messages");
  actualiserButton.addActionListener(new java.awt.event.ActionListener(){
    public void actionPerformed(    java.awt.event.ActionEvent evt){
      actualiserButtonActionPerformed(evt);
    }
  }
);
  javax.swing.GroupLayout layout=new javax.swing.GroupLayout(getContentPane());
  getContentPane().setLayout(layout);
  layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1,javax.swing.GroupLayout.DEFAULT_SIZE,846,Short.MAX_VALUE).addComponent(jLabel1).addGroup(layout.createSequentialGroup().addComponent(nouveauMessageButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(actualiserButton))).addContainerGap()));
  layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jLabel1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1,javax.swing.GroupLayout.PREFERRED_SIZE,238,javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(nouveauMessageButton).addComponent(actualiserButton)).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)));
  pack();
}
 

Example 45

From project des, under directory /daemon/lib/apache-log4j-1.2.16/contribs/SvenReimers/gui/.

Source file: JListView.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  if (value instanceof LoggingEvent) {
    LoggingEvent event=(LoggingEvent)value;
    String str=layout.format(event);
    String t=event.getThrowableInformation();
    if (t != null) {
      setText(str + Layout.LINE_SEP + t);
    }
 else {
      setText(str);
    }
  }
 else {
    setText(value.toString());
  }
  return this;
}
 

Example 46

From project gitblit, under directory /src/com/gitblit/client/.

Source file: BranchRenderer.java

  19 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  setText(value == null ? "" : value.toString());
  if (isSelected) {
    setBackground(list.getSelectionBackground());
    setForeground(list.getSelectionForeground());
  }
 else {
    setBackground(list.getBackground());
  }
  return this;
}
 

Example 47

From project GraphWalker, under directory /src/main/java/org/graphwalker/GUI/.

Source file: App.java

  19 
vote

@SuppressWarnings("serial") private void addButtons(JToolBar toolBar){
  loadButton=makeNavigationButton("open",LOAD,"Load a model (graphml file)","Load",true);
  toolBar.add(loadButton);
  reloadButton=makeNavigationButton("reload",RELOAD,"Reload/Restart already loaded Model","Reload",false);
  toolBar.add(reloadButton);
  firstButton=makeNavigationButton("first",FIRST,"Start at the beginning","First",false);
  toolBar.add(firstButton);
  backButton=makeNavigationButton("back",BACK,"Backs a step","Back",false);
  toolBar.add(backButton);
  runButton=makeNavigationButton("run",RUN,"Starts the execution/Take a step forward in the log","Run",false);
  toolBar.add(runButton);
  pauseButton=makeNavigationButton("pause",PAUSE,"Pauses the execution","Pause",false);
  toolBar.add(pauseButton);
  nextButton=makeNavigationButton("next",NEXT,"Walk a step in the model/Go to the end of log","Next",false);
  toolBar.add(nextButton);
  soapButton=makeNavigationCheckBoxButton("soap",SOAP,"Run MBT in SOAP(Web Services) mode","Soap");
  soapButton.setSelected(Util.readSoapGuiStartupState());
  toolBar.add(soapButton);
  centerOnVertexButton=makeNavigationCheckBoxButton("centerOnVertex",CENTERONVERTEX,"Center the layout on the current vertex","Center on current vertex");
  toolBar.add(centerOnVertexButton);
  @SuppressWarnings("rawtypes") Class[] combos=getCombos();
  final JComboBox jcb=new JComboBox(combos);
  jcb.setRenderer(new DefaultListCellRenderer(){
    @Override public Component getListCellRendererComponent(    JList list,    Object value,    int index,    boolean isSelected,    boolean cellHasFocus){
      String valueString=value.toString();
      valueString=valueString.substring(valueString.lastIndexOf('.') + 1);
      return super.getListCellRendererComponent(list,valueString,index,isSelected,cellHasFocus);
    }
  }
);
  jcb.addActionListener(new LayoutChooser(jcb,getVv()));
  jcb.setSelectedItem(StaticLayout.class);
  toolBar.add(jcb);
}
 

Example 48

From project jftp, under directory /src/main/java/com/myjavaworld/gui/.

Source file: ImageCellRenderer.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean hasFocus){
  setText(value == null ? "null" : value.toString());
  if (icon != null) {
    setIcon(icon);
  }
  setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());
  setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
  setFont(list.getFont());
  return this;
}
 

Example 49

From project jMemorize, under directory /src/jmemorize/gui/swing/widgets/.

Source file: CategoryComboBox.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Category cat=(Category)value;
  JLabel label=(JLabel)super.getListCellRendererComponent(list,cat.getName(),index,isSelected,cellHasFocus);
  label.setIcon(FOLDER_ICON);
  int leftSpace=index >= 0 ? 20 * cat.getDepth() : 0;
  label.setBorder(new EmptyBorder(2,leftSpace,2,2));
  if (index < 0)   label.setText(cat.getPath());
  return label;
}
 

Example 50

From project log4j, under directory /contribs/SvenReimers/gui/.

Source file: JListView.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  if (value instanceof LoggingEvent) {
    LoggingEvent event=(LoggingEvent)value;
    String str=layout.format(event);
    String t=event.getThrowableInformation();
    if (t != null) {
      setText(str + Layout.LINE_SEP + t);
    }
 else {
      setText(str);
    }
  }
 else {
    setText(value.toString());
  }
  return this;
}
 

Example 51

From project log4jna, under directory /thirdparty/log4j/contribs/SvenReimers/gui/.

Source file: JListView.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  if (value instanceof LoggingEvent) {
    LoggingEvent event=(LoggingEvent)value;
    String str=layout.format(event);
    String t=event.getThrowableInformation();
    if (t != null) {
      setText(str + Layout.LINE_SEP + t);
    }
 else {
      setText(str);
    }
  }
 else {
    setText(value.toString());
  }
  return this;
}
 

Example 52

From project maple-ide, under directory /build/windows/launcher/launch4j/src/net/sf/launch4j/binding/.

Source file: JListBinding.java

  19 
vote

public JListBinding(String property,JList list){
  if (property == null || list == null) {
    throw new NullPointerException();
  }
  if (property.equals("")) {
    throw new IllegalArgumentException();
  }
  _property=property;
  _list=list;
  _validColor=_list.getBackground();
}
 

Example 53

From project mdk, under directory /ui/src/main/java/uk/ac/ebi/mdk/ui/render/list/.

Source file: ClassBasedListCellDDR.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean hasFocus){
  ListCellRenderer cr=null;
  if (value != null) {
    Class<? extends Object> valueClass=value.getClass();
    cr=renderersCache.get(valueClass);
    if (cr == null) {
      cr=getExplicitRenderer(valueClass);
      renderersCache.put(valueClass,cr);
    }
  }
  if (cr == null) {
    cr=explicitRenderers.get(Object.class);
  }
  Component component=cr.getListCellRendererComponent(list,value,index,isSelected,hasFocus);
  return component;
}
 

Example 54

From project milton, under directory /milton/milton-client-app/src/main/java/bradswebdavclient/.

Source file: FolderPanel2.java

  19 
vote

/** 
 * Creates new form FolderPanel 
 */
public FolderPanel2(final Folder folder){
  initComponents();
  model=new FolderModel(folder);
  table.setCellRenderer(new IconRenderer());
  table.setLayoutOrientation(JList.VERTICAL_WRAP);
  new FileDrop(this,new FileDrop.Listener(){
    public void filesDropped(    java.io.File[] files){
      for (      java.io.File f : files) {
        System.out.println(f.getName());
        try {
          folder.upload(f);
        }
 catch (        Exception ex) {
          throw new RuntimeException(ex);
        }
      }
    }
  }
);
}
 

Example 55

From project milton2, under directory /milton-client-app/src/main/java/bradswebdavclient/.

Source file: FolderPanel2.java

  19 
vote

/** 
 * Creates new form FolderPanel 
 */
public FolderPanel2(final Folder folder){
  initComponents();
  model=new FolderModel(folder);
  table.setCellRenderer(new IconRenderer());
  table.setLayoutOrientation(JList.VERTICAL_WRAP);
  new FileDrop(this,new FileDrop.Listener(){
    public void filesDropped(    java.io.File[] files){
      for (      java.io.File f : files) {
        System.out.println(f.getName());
        try {
          folder.upload(f);
        }
 catch (        Exception ex) {
          throw new RuntimeException(ex);
        }
      }
    }
  }
);
}
 

Example 56

From project multibit, under directory /src/main/java/org/multibit/viewsystem/swing/.

Source file: MultiBitFrame.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  int selectedIndex=0;
  if (value != null) {
    selectedIndex=(Integer)value;
  }
  if (isSelected) {
    setBackground(list.getSelectionBackground());
    setForeground(list.getSelectionForeground());
  }
 else {
    setBackground(list.getBackground());
    setForeground(list.getForeground());
  }
  int loopIndex=0;
  java.util.List<PerWalletModelData> perWalletModelDataList=controller.getModel().getPerWalletModelDataList();
  if (perWalletModelDataList != null) {
    for (    PerWalletModelData loopModelData : perWalletModelDataList) {
      if (selectedIndex == loopIndex) {
        if (loopModelData.getWalletFilename() != null) {
          File walletFile=new File(loopModelData.getWalletFilename());
          if (walletFile != null) {
            String walletFilenameFull=walletFile.getName();
            String walletFilenameShort=walletFilenameFull.replaceAll("\\.wallet","");
            this.setText(walletFilenameShort);
            setActiveWalletTooltip(walletFile,loopModelData.getWalletDescription());
          }
        }
        break;
      }
      loopIndex++;
    }
  }
  setFont(list.getFont());
  return this;
}
 

Example 57

From project OMS3, under directory /src/main/java/ngmfconsole/.

Source file: Console.java

  19 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  if (isSelected && (-1 < index)) {
    list.setToolTipText(((File)list.getModel().getElementAt(index)).getPath());
  }
  return delegate.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
}
 

Example 58

From project Openbravo-POS-iPhone-App, under directory /UnicentaPOS/src-pos/com/openbravo/pos/ticket/.

Source file: FindTicketsRenderer.java

  19 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  super.getListCellRendererComponent(list,null,index,isSelected,cellHasFocus);
  int ticketType=((FindTicketsInfo)value).getTicketType();
  setText("<html><table>" + value.toString() + "</table></html>");
  if (ticketType == RECEIPT_NORMAL) {
    setIcon(icoTicketNormal);
  }
 else {
    setIcon(icoTicketRefund);
  }
  return this;
}
 

Example 59

From project OWASP-WebScarab, under directory /src/org/owasp/webscarab/plugin/fragments/swing/.

Source file: FragmentsPanel.java

  19 
vote

/** 
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
 */
private void initComponents(){
  jSplitPane1=new javax.swing.JSplitPane();
  jPanel1=new javax.swing.JPanel();
  jScrollPane1=new javax.swing.JScrollPane();
  fragmentList=new javax.swing.JList();
  typeComboBox=new javax.swing.JComboBox();
  jScrollPane2=new javax.swing.JScrollPane();
  conversationTable=new javax.swing.JTable();
  setLayout(new java.awt.BorderLayout());
  setPreferredSize(new java.awt.Dimension(602,570));
  jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
  jSplitPane1.setResizeWeight(0.65);
  jSplitPane1.setOneTouchExpandable(true);
  jPanel1.setLayout(new java.awt.BorderLayout());
  jPanel1.setMinimumSize(new java.awt.Dimension(400,300));
  jPanel1.setPreferredSize(new java.awt.Dimension(400,300));
  jScrollPane1.setViewportView(fragmentList);
  jPanel1.add(jScrollPane1,java.awt.BorderLayout.CENTER);
  jPanel1.add(typeComboBox,java.awt.BorderLayout.NORTH);
  jSplitPane1.setLeftComponent(jPanel1);
  jScrollPane2.setPreferredSize(new java.awt.Dimension(200,200));
  conversationTable.setModel(new javax.swing.table.DefaultTableModel(new Object[][]{{null,null,null,null},{null,null,null,null},{null,null,null,null},{null,null,null,null}},new String[]{"Title 1","Title 2","Title 3","Title 4"}));
  conversationTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
  jScrollPane2.setViewportView(conversationTable);
  jSplitPane1.setRightComponent(jScrollPane2);
  add(jSplitPane1,java.awt.BorderLayout.CENTER);
}
 

Example 60

From project pegadi, under directory /storysketch/src/main/java/org/pegadi/storysketch/views/.

Source file: RDFList.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  if (value instanceof RDFItem) {
    RDFItem item=(RDFItem)value;
    titleLabel.setText("<html>" + item.getTitle() + "</html>");
    descriptionLabel.setText("<html>" + item.getDescription() + "</html>");
    dateLabel.setText(item.getDate());
    if (isSelected) {
      setBackground(list.getSelectionBackground());
      setForeground(list.getSelectionForeground());
    }
 else {
      setBackground(list.getBackground());
      setForeground(list.getForeground());
    }
    setEnabled(list.isEnabled());
    setFont(list.getFont());
    setOpaque(true);
  }
  return this;
}
 

Example 61

From project pos_1, under directory /src-pos/com/openbravo/pos/ticket/.

Source file: FindTicketsRenderer.java

  19 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  super.getListCellRendererComponent(list,null,index,isSelected,cellHasFocus);
  int ticketType=((FindTicketsInfo)value).getTicketType();
  setText("<html><table>" + value.toString() + "</table></html>");
  if (ticketType == RECEIPT_NORMAL) {
    setIcon(icoTicketNormal);
  }
 else {
    setIcon(icoTicketRefund);
  }
  return this;
}
 

Example 62

From project RegexTagForMusic, under directory /src/org/essembeh/rtfm/ui/renderers/.

Source file: WorkflowRenderer.java

  19 
vote

@Override public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  Component out;
  if (value != null && value instanceof IWorkflowIdentifier) {
    final IWorkflowIdentifier workflowIdentifier=(IWorkflowIdentifier)value;
    out=new JMenuItem(new DefaultRtfmAction(workflowIdentifier.getDescription(),Image.WORKFLOW));
  }
 else {
    out=new JMenuItem(new DefaultRtfmAction(value.toString(),Image.DIALOG_QUESTION));
  }
  return out;
}
 

Example 63

From project RomRaider, under directory /3rdparty/launch4j/src/net/sf/launch4j/binding/.

Source file: JListBinding.java

  19 
vote

public JListBinding(String property,JList list){
  if (property == null || list == null) {
    throw new NullPointerException();
  }
  if (property.equals("")) {
    throw new IllegalArgumentException();
  }
  _property=property;
  _list=list;
  _validColor=_list.getBackground();
}
 

Example 64

From project rpiplanner, under directory /src/rpiplanner/view/.

Source file: CourseTransferHandler.java

  19 
vote

@Override protected Transferable createTransferable(JComponent c){
  if (c instanceof JList) {
    Course toExport=(Course)((JList)c).getSelectedValue();
    return new CourseTransfer(toExport);
  }
 else   if (c instanceof CourseDisplay) {
    CourseDisplay cd=(CourseDisplay)c;
    Course toExport=cd.getCourse();
    return new CourseTransfer(toExport,cd);
  }
  return super.createTransferable(c);
}
 

Example 65

From project skmclauncher, under directory /src/main/java/com/sk89q/mclauncher/.

Source file: ConfigurationCellRenderer.java

  19 
vote

@Override public Component getListCellRendererComponent(final JList list,final Object value,int index,final boolean isSelected,boolean cellHasFocus){
  final Configuration configuration=(Configuration)value;
  JIconPanel panel=new JIconPanel(configuration.getIcon());
  panel.setLayout(new GridLayout(2,1,0,1));
  panel.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground());
  panel.setBorder(BorderFactory.createEmptyBorder(PAD,PAD * 2 + 32,PAD,PAD));
  JLabel titleLabel=new JLabel();
  titleLabel.setText(configuration.getName());
  titleLabel.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground());
  Font font=titleLabel.getFont();
  font=font.deriveFont((float)(font.getSize() * 1.3)).deriveFont(Font.BOLD);
  titleLabel.setFont(font);
  panel.add(titleLabel);
  String infoText;
  if (configuration.isUsingDefaultPath()) {
    infoText="Default Minecraft installation";
  }
 else   if (configuration.getUpdateUrl() != null) {
    infoText="via " + configuration.getUpdateUrl().getHost();
  }
 else {
    infoText="Custom installation";
  }
  JLabel infoLabel=new JLabel();
  infoLabel.setText(infoText);
  Color color=isSelected ? list.getSelectionForeground() : list.getForeground();
  infoLabel.setForeground(color);
  panel.add(infoLabel);
  return panel;
}
 

Example 66

From project SPREAD, under directory /release/tools/launch4j/src/net/sf/launch4j/binding/.

Source file: JListBinding.java

  19 
vote

public JListBinding(String property,JList list){
  if (property == null || list == null) {
    throw new NullPointerException();
  }
  if (property.equals("")) {
    throw new IllegalArgumentException();
  }
  _property=property;
  _list=list;
  _validColor=_list.getBackground();
}
 

Example 67

From project tiled-java, under directory /src/tiled/mapeditor/util/.

Source file: ImageCellRenderer.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  Image img=(Image)value;
  if (img != null) {
    setIcon(new ImageIcon(img));
  }
 else {
    setIcon(null);
  }
  setText(null);
  return this;
}
 

Example 68

From project treeGenerator, under directory /arbaro_1_9_8/src/net/sourceforge/arbaro/gui/.

Source file: ParamValueTable.java

  19 
vote

public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  int myIndex=Integer.parseInt(value.toString());
  if (isSelected) {
    setBackground(list.getSelectionBackground());
    setForeground(list.getSelectionForeground());
  }
 else {
    setBackground(list.getBackground());
    setForeground(list.getForeground());
  }
  ImageIcon icon;
  icon=shapeIcons[myIndex];
  setIcon(icon);
  setText(icon.getDescription());
  return this;
}