private void init() { model.addViewerModelListener(this); list = new JList(); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (list.getSelectedValue() != null) { model.selectNode((Node) list.getSelectedValue(), EvaluationResultsPanel.this); } } }); add(new JScrollPane(list), BorderLayout.CENTER); }
public JList<?> getFontSizeList() { if (fontSizeList == null) { fontSizeList = new JList<Object>(this.fontSizeStrings); fontSizeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fontSizeList.addListSelectionListener(new ListSelectionHandler(getFontSizeTextField())); fontSizeList.setSelectedIndex(0); fontSizeList.setFont(DEFAULT_FONT); fontSizeList.setFocusable(false); } return fontSizeList; }
list.setTransferHandler(new TreeTransferHandler()); matchedParts = Generics.newHashMap(); list.addListSelectionListener(this); MouseInputAdapter mouseListener = new MouseInputAdapter() { private boolean dragNDrop = false; listeners = new ArrayList<>(); this.setLayout(new BorderLayout()); this.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(),"Matches: ")); JScrollPane scroller = new JScrollPane(list); this.add(scroller, BorderLayout.CENTER);
factoryList.add(iter.next()); list = new JList(factoryList.toArray()); ListCellRenderer cellRenderer = new DefaultListCellRenderer() { list.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { JScrollPane scroll = new JScrollPane(list); scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scroll.setPreferredSize(new Dimension(300, 100));
public static void main(String[] args) { JFrame jFrame = createMainFrame(); Container contentPane = jFrame.getContentPane(); contentPane.setLayout(new BorderLayout()); ListModel<String> listModel = createListModel(); ListSelectionDocument listSelectionDocument = new ListSelectionDocument(); JList<String> list = new JList<String>(); list.setCellRenderer(new CheckboxListCellRenderer<String>()); list.setModel(listModel); list.addListSelectionListener(listSelectionDocument); JTextArea listSelectionTextArea = new JTextArea(listSelectionDocument); Border loweredBevelBorder = BorderFactory.createLoweredBevelBorder(); listSelectionTextArea.setBorder(loweredBevelBorder); contentPane.add(list, BorderLayout.CENTER); contentPane.add(listSelectionTextArea, BorderLayout.SOUTH); jFrame.setVisible(true); }
public DescriptionPanel(JList filterEditorList) { filterEditorList.addListSelectionListener(this); descriptionField = new JTextArea(); descriptionField.setLineWrap(true); descriptionField.setWrapStyleWord(true); descriptionField.setBackground(getBackground()); setLayout(new BorderLayout()); add(descriptionField, BorderLayout.CENTER); setBorder(new TitledBorder("Filter Type Description")); setPreferredSize(new Dimension(200, 150)); }
ExercisePanel() { JScrollPane acctsScroll = new JScrollPane( m_accounts); acctsScroll.setBorder( new TitledBorder( "Select account")); JScrollPane portScroll = new JScrollPane( m_portTable); portScroll.setBorder( new TitledBorder( "Select long option position")); setLayout( new BoxLayout( this, BoxLayout.X_AXIS) ); add( acctsScroll); add( portScroll); add( new ExPanel() ); m_accounts.addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { onAcctChanged(); } }); }
final JLabel label = new JLabel("Update"); String[] data = { "one", "two", "three", "four" }; final JList dataList = new JList(data); dataList.addListSelectionListener(new ListSelectionListener() {
private void initServerList() { serverList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); serverList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { boolean enabled = !serverList.isSelectionEmpty(); firePropertyChange(OK_ENABLED, !enabled, enabled); } } ); serverList.setCellRenderer(new ServersRenderer()); }
private JComponent createQuickOpenPanel(JList<QuickOpenAction> listPanel, String title, List<File> fileList) { listPanel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listPanel.addListSelectionListener(event -> { if (event.getValueIsAdjusting()) { return; } int selectedIndex = listPanel.getSelectedIndex(); if (selectedIndex < 0) { return; } QuickOpenAction action = listPanel.getModel().getElementAt(selectedIndex); action.actionPerformed(new ActionEvent(listPanel, -1, null)); }); refreshQuickOpenPanel(listPanel, fileList); JScrollPane scrollPane = new JScrollPane(listPanel); scrollPane.getVerticalScrollBar().setUnitIncrement(25); scrollPane.setMinimumSize(new Dimension(100, 80)); // Size fits into screen resolution 1024*768 scrollPane.setPreferredSize(new Dimension(180, 200)); JPanel titlePanel = new JPanel(new BorderLayout()); titlePanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); JLabel titleLabel = new JLabel(title); titleLabel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titlePanel.add(titleLabel, BorderLayout.NORTH); titlePanel.add(scrollPane, BorderLayout.CENTER); return titlePanel; }
private JScrollPane createAxeList(final String[] _itAxes) { lsAxes_= new JList(_itAxes); lsAxes_.setSelectedIndex(0); lsAxes_.addListSelectionListener(this); final JScrollPane spAxes= new JScrollPane(lsAxes_); return spAxes; } private String[] createAxes() {
public void initialiseOWLView() throws Exception { setLayout(new BorderLayout()); final JList list = new JList(entities.toArray()); list.setCellRenderer(getOWLEditorKit().getWorkspace().createOWLCellRenderer()); add(ComponentFactory.createScrollPane(list)); list.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { OWLEntity selEntity = (OWLEntity) list.getSelectedValue(); getOWLWorkspace().getOWLSelectionModel().setSelectedEntity(selEntity); } } }); } }
public JList<?> getFontStyleList() { if (fontStyleList == null) { fontStyleList = new JList<Object>(getFontStyleNames()); fontStyleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fontStyleList.addListSelectionListener(new ListSelectionHandler(getFontStyleTextField())); fontStyleList.setSelectedIndex(0); fontStyleList.setFocusable(false); fontStyleList.setCellRenderer(new DefaultListCellRenderer() { /** * */ private static final long serialVersionUID = -3904668242514776943L; public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value instanceof String) { renderer.setText((String) value); renderer.setFont( new Font(DEFAULT_FONT.getName(), FONT_STYLE_CODES[index], DEFAULT_FONT.getSize() + 2)); } else { renderer.setText(""); } return renderer; } }); } return fontStyleList; }
protected void createUI(JComponent parent) { setInstructions("Please select an existing (pre-loaded) ontology that you want to import."); ontologyList = new OWLObjectList(getOWLEditorKit()); ontologyList.setCellRenderer(new OWLOntologyCellRenderer(getOWLEditorKit())); ontologyList.addListSelectionListener(e -> { if (!e.getValueIsAdjusting()) { updateState(); } }); parent.setLayout(new BorderLayout()); parent.add(ComponentFactory.createScrollPane(ontologyList), BorderLayout.CENTER); parent.add(createCustomizedImportsComponent(), BorderLayout.SOUTH); }
public ListInput(String title, int numCols) { setLayout(null); setBorder(new EmptyBorder(5, 5, 5, 5)); label = new ListInputLabel(title, JLabel.LEFT); add(label); textfield = new ListInputText(numCols); textfield.addActionListener(this); label.setLabelFor(textfield); // NEW add(textfield); list = new ListInputList(); list.setVisibleRowCount(4); list.addListSelectionListener(this); scrollPane = new JScrollPane(list); add(scrollPane); }
protected void createAvailableSensitivityExports() { $objectMap.put("availableSensitivityExports", availableSensitivityExports = new JList()); availableSensitivityExports.setName("availableSensitivityExports"); availableSensitivityExports.addListSelectionListener(JAXXUtil.getEventListener(ListSelectionListener.class, "valueChanged", this, "doValueChanged__on__availableSensitivityExports")); }
JList list; DefaultListModel listModel; listModel = new DefaultListModel(); listModel.addElement("word1"); listModel.addElement("word2"); listModel.addElement("word3"); //Create the list and put it in a scroll pane. list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0); list.addListSelectionListener(this); list.setVisibleRowCount(5); JScrollPane listScrollPane = new JScrollPane(list);
public OptionsFontPanel(){ JPanel jp = this; jp.setLayout(new BorderLayout()); JPanel jp_north = new JPanel(); jp_north.setLayout(new FlowLayout(FlowLayout.LEFT)); JLabel jl = new JLabel("Font for Request Body & Response Body"); JPanel jp_center = new JPanel(); jp_center.setLayout(new GridLayout(1, 2)); String[] fontFamilyNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); jl_font = new JList<String>(fontFamilyNames); jl_font.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jl_font.addListSelectionListener(previewListner); JScrollPane jsp_font = new JScrollPane(jl_font); jsp_font.setPreferredSize(d); jp_center.add(jsp_font); String fontSizes[] = { "8", "10", "11", "12", "14", "16", "18", "20", "24", "30", "36", "40", "48", "60", "72" }; jl_fontSize = new JList<String>(fontSizes); jl_fontSize.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jl_fontSize.addListSelectionListener(previewListner); JScrollPane jsp_fontSize = new JScrollPane(jl_fontSize); jsp_fontSize.setPreferredSize(d); jp_center.add(jsp_fontSize); JPanel jp_south = new JPanel(); jp_south.setLayout(new FlowLayout(FlowLayout.CENTER)); jp_south.add(jl_preview);
private JScrollPane createListCourbes(final String[] _itCourbes) { lsCourbes_= new JList(_itCourbes); lsCourbes_.setSelectedIndex(0); lsCourbes_.addListSelectionListener(this); final JScrollPane spCourbes= new JScrollPane(lsCourbes_); spCourbes.setPreferredSize(new Dimension(100, 200)); return spCourbes; } private String[] createCourbes() {
public void initialiseOWLView() throws Exception { setLayout(new BorderLayout()); final JList list = new JList(entities.toArray()); list.setCellRenderer(getOWLEditorKit().getWorkspace().createOWLCellRenderer()); add(ComponentFactory.createScrollPane(list)); list.addListSelectionListener(e -> { if (!e.getValueIsAdjusting()) { OWLEntity selEntity = (OWLEntity) list.getSelectedValue(); getOWLWorkspace().getOWLSelectionModel().setSelectedEntity(selEntity); } }); } }