java.awt.List Java Examples
The following examples show how to use
java.awt.List.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClassMemberTest.java From netbeans with Apache License 2.0 | 6 votes |
private MethodTree m(TreeMaker make) { // create method modifiers ModifiersTree parMods = make.Modifiers(Collections.<Modifier>emptySet(), Collections.<AnnotationTree>emptyList()); // create parameters VariableTree par1 = make.Variable(parMods, "a", make.PrimitiveType(TypeKind.INT), null); VariableTree par2 = make.Variable(parMods, "b", make.PrimitiveType(TypeKind.FLOAT), null); List<VariableTree> parList = new ArrayList<VariableTree>(2); parList.add(par1); parList.add(par2); // create method MethodTree newMethod = make.Method( make.Modifiers( Collections.singleton(Modifier.PUBLIC), // modifiers Collections.<AnnotationTree>emptyList() // annotations ), // modifiers and annotations "newlyCreatedMethod", // name make.PrimitiveType(TypeKind.VOID), // return type Collections.<TypeParameterTree>emptyList(), // type parameters for parameters parList, // parameters Collections.singletonList(make.Identifier("java.io.IOException")), // throws make.Block(Collections.<StatementTree>emptyList(), false), // empty statement block null // default value - not applicable here, used by annotations ); return newMethod; }
Example #2
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean checkComponent(Component comp) { if (comp instanceof List) { if (label == null) { return true; } if (((List) comp).getItemCount() > itemIndex) { int ii = itemIndex; if (ii == -1) { ii = ((List) comp).getSelectedIndex(); if (ii == -1) { return false; } } return (comparator.equals(((List) comp).getItem(ii), label)); } } return false; }
Example #3
Source File: ItemEventTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public ItemEventTest() { try { robot = new Robot(); } catch(AWTException e) { throw new RuntimeException(e.getMessage()); } expectedSelectionOrder = "01230123"; list = new List(4, true); list.add("0"); list.add("1"); list.add("2"); list.add("3"); add(list); setSize(400,400); setLayout(new FlowLayout()); pack(); setVisible(true); robot.waitForIdle(); }
Example #4
Source File: JTextAreaBinding.java From magarena with GNU General Public License v3.0 | 6 votes |
public void get(IValidatable bean) { try { String text = _textArea.getText(); if (!text.equals("")) { String[] items = text.split("\n"); List list = new ArrayList(); for (int i = 0; i < items.length; i++) { list.add(items[i]); } PropertyUtils.setProperty(bean, _property, list); } else { PropertyUtils.setProperty(bean, _property, null); } } catch (Exception e) { throw new BindingException(e); } }
Example #5
Source File: RangeMarkerTest.java From consulo with Apache License 2.0 | 6 votes |
public void testRangeHighlighterLinesInRangeForLongLinePerformance() throws Exception { final int N = 50000; Document document = EditorFactory.getInstance().createDocument(StringUtil.repeatSymbol('x', 2 * N)); final MarkupModelEx markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, ourProject, true); for (int i=0; i<N-1;i++) { markupModel.addRangeHighlighter(2*i, 2*i+1, 0, null, HighlighterTargetArea.EXACT_RANGE); } markupModel.addRangeHighlighter(N / 2, N / 2 + 1, 0, null, HighlighterTargetArea.LINES_IN_RANGE); PlatformTestUtil.startPerformanceTest("slow highlighters lookup", (int)(N*Math.log(N)/1000), new ThrowableRunnable() { @Override public void run() { List<RangeHighlighterEx> list = new ArrayList<RangeHighlighterEx>(); CommonProcessors.CollectProcessor<RangeHighlighterEx> coll = new CommonProcessors.CollectProcessor<RangeHighlighterEx>(list); for (int i=0; i<N-1;i++) { list.clear(); markupModel.processRangeHighlightersOverlappingWith(2*i, 2*i+1, coll); assertEquals(2, list.size()); // 1 line plus one exact range marker } } }).assertTiming(); }
Example #6
Source File: R2303044ListSelection.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws HeadlessException { final Frame frame = new Frame("Test Frame"); final List list = new List(); frame.setSize(300, 200); list.add(ITEM_NAME); list.select(0); frame.add(list); frame.validate(); frame.setVisible(true); sleep(); if (!ITEM_NAME.equals(list.getSelectedItem())) { throw new RuntimeException("List item not selected item."); } list.removeAll(); frame.dispose(); }
Example #7
Source File: OptJTextAreaBinding.java From magarena with GNU General Public License v3.0 | 6 votes |
public void put(IValidatable bean) { try { boolean selected = "true".equals(BeanUtils.getProperty(bean, _stateProperty)); _button.setSelected(selected); _textArea.setEnabled(selected); List list = (List) PropertyUtils.getProperty(bean, _property); StringBuffer sb = new StringBuffer(); if (list != null) { for (int i = 0; i < list.size(); i++) { sb.append(list.get(i)); if (i < list.size() - 1) { sb.append("\n"); } } } _textArea.setText(sb.toString()); } catch (Exception e) { throw new BindingException(e); } }
Example #8
Source File: R2303044ListSelection.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws HeadlessException { final Frame frame = new Frame("Test Frame"); final List list = new List(); frame.setSize(300, 200); list.add(ITEM_NAME); list.select(0); frame.add(list); frame.validate(); frame.setVisible(true); sleep(); if (!ITEM_NAME.equals(list.getSelectedItem())) { throw new RuntimeException("List item not selected item."); } list.removeAll(); frame.dispose(); }
Example #9
Source File: R2303044ListSelection.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws HeadlessException { final Frame frame = new Frame("Test Frame"); final List list = new List(); frame.setSize(300, 200); list.add(ITEM_NAME); list.select(0); frame.add(list); frame.validate(); frame.setVisible(true); sleep(); if (!ITEM_NAME.equals(list.getSelectedItem())) { throw new RuntimeException("List item not selected item."); } list.removeAll(); frame.dispose(); }
Example #10
Source File: R2303044ListSelection.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws HeadlessException { final Frame frame = new Frame("Test Frame"); final List list = new List(); frame.setSize(300, 200); list.add(ITEM_NAME); list.select(0); frame.add(list); frame.validate(); frame.setVisible(true); sleep(); if (!ITEM_NAME.equals(list.getSelectedItem())) { throw new RuntimeException("List item not selected item."); } list.removeAll(); frame.dispose(); }
Example #11
Source File: R2303044ListSelection.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws HeadlessException { final Frame frame = new Frame("Test Frame"); final List list = new List(); frame.setSize(300, 200); list.add(ITEM_NAME); list.select(0); frame.add(list); frame.validate(); frame.setVisible(true); sleep(); if (!ITEM_NAME.equals(list.getSelectedItem())) { throw new RuntimeException("List item not selected item."); } list.removeAll(); frame.dispose(); }
Example #12
Source File: R2303044ListSelection.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(final String[] args) throws HeadlessException { final Frame frame = new Frame("Test Frame"); final List list = new List(); frame.setSize(300, 200); list.add(ITEM_NAME); list.select(0); frame.add(list); frame.validate(); frame.setVisible(true); sleep(); if (!ITEM_NAME.equals(list.getSelectedItem())) { throw new RuntimeException("List item not selected item."); } list.removeAll(); frame.dispose(); }
Example #13
Source File: Test4750368.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws IntrospectionException { if (getLength(com.foo.test.Component.class) == getLength(Component.class)) { throw new Error("test failed for Component"); } if (getLength(java.util.List.class) == getLength(List.class)) { throw new Error("test failed for List"); } }
Example #14
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.getMinimumSize(int)} through queue */ public Dimension getMinimumSize(final int i) { return (runMapping(new MapAction<Dimension>("getMinimumSize") { @Override public Dimension map() { return ((List) getSource()).getMinimumSize(i); } })); }
Example #15
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.select(int)} through queue */ public void select(final int i) { runMapping(new MapVoidAction("select") { @Override public void map() { ((List) getSource()).select(i); } }); }
Example #16
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.removeActionListener(ActionListener)} through queue */ public void removeActionListener(final ActionListener actionListener) { runMapping(new MapVoidAction("removeActionListener") { @Override public void map() { ((List) getSource()).removeActionListener(actionListener); } }); }
Example #17
Source File: Test4520754.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { // ensure that 4168475 does not regress test4168475(Component.class); // AWT classes (com.sun.beans.infos.ComponentBeanInfo) test(null, Button.class, Component.class, List.class, Menu.class, Panel.class); // Swing classes (dt.jar) test(null, JApplet.class, JButton.class, JCheckBox.class); // user defined classes test(Boolean.TRUE, Wombat.class, Foo.class, FooBar.class); }
Example #18
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.removeItemListener(ItemListener)} through queue */ public void removeItemListener(final ItemListener itemListener) { runMapping(new MapVoidAction("removeItemListener") { @Override public void map() { ((List) getSource()).removeItemListener(itemListener); } }); }
Example #19
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.replaceItem(String, int)} through queue */ public void replaceItem(final String string, final int i) { runMapping(new MapVoidAction("replaceItem") { @Override public void map() { ((List) getSource()).replaceItem(string, i); } }); }
Example #20
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.getSelectedObjects()} through queue */ public Object[] getSelectedObjects() { return ((Object[]) runMapping(new MapAction<Object>("getSelectedObjects") { @Override public Object map() { return ((List) getSource()).getSelectedObjects(); } })); }
Example #21
Source File: RangeMarkerTest.java From consulo with Apache License 2.0 | 5 votes |
public void testE16() { DocumentEx document = (DocumentEx)EditorFactory.getInstance().createDocument(StringUtil.repeatSymbol(' ', 100)); List<RangeMarker> mm = add(document, 29,63, 47,52, 72,86, 19,86, 13,55, 18,57, 92,95, 83,99, 41,80, 53,85, 10,30, 28,44, 23,32, 70,95, 14,28 ); edit(document, 67,5,0, 1,0,4); delete(mm, 11); }
Example #22
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.getItemCount()} through queue */ public int getItemCount() { return (runMapping(new MapIntegerAction("getItemCount") { @Override public int map() { return ((List) getSource()).getItemCount(); } })); }
Example #23
Source File: JListBinding.java From magarena with GNU General Public License v3.0 | 5 votes |
public void get(IValidatable bean) { try { DefaultListModel model = (DefaultListModel) _list.getModel(); final int size = model.getSize(); List list = new ArrayList(size); for (int i = 0; i < size; i++) { list.add(model.get(i)); } PropertyUtils.setProperty(bean, _property, list); } catch (Exception e) { throw new BindingException(e); } }
Example #24
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.deselect(int)} through queue */ public void deselect(final int i) { runMapping(new MapVoidAction("deselect") { @Override public void map() { ((List) getSource()).deselect(i); } }); }
Example #25
Source File: RangeMarkerTest.java From consulo with Apache License 2.0 | 5 votes |
public void testE11() { DocumentEx document = (DocumentEx)EditorFactory.getInstance().createDocument(StringUtil.repeatSymbol(' ', 10)); List<RangeMarker> mm = add(document, 9,9, 7,7, 1,6, 3,7 ); //edit(document, 0,0,0); delete(mm, 1); }
Example #26
Source File: ListOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code List.addActionListener(ActionListener)} through queue */ public void addActionListener(final ActionListener actionListener) { runMapping(new MapVoidAction("addActionListener") { @Override public void map() { ((List) getSource()).addActionListener(actionListener); } }); }
Example #27
Source File: LWToolkit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@Override public final ListPeer createList(List target) { PlatformComponent platformComponent = createPlatformComponent(); LWListPeer peer = new LWListPeer(target, platformComponent); targetCreatedPeer(target, peer); peer.initialize(); return peer; }
Example #28
Source File: ParmScreen.java From jmg with GNU General Public License v2.0 | 5 votes |
private void initializeTempoList() { tempoList = new List(); for (double x = 36.0; x <143.0; x+= 2.0) { tempoList.add( (new Double(x)).toString() ); } for (double y = 144.0; y <250.0; y+= 4.0) { tempoList.add( (new Double(y)).toString() ); } for (double z = 256.0; z < 404.0; z+= 8.0) { tempoList.add( (new Double(z)).toString() ); } }
Example #29
Source File: RangeMarkerTest.java From consulo with Apache License 2.0 | 5 votes |
public void testE5() { DocumentEx document = (DocumentEx)EditorFactory.getInstance().createDocument(StringUtil.repeatSymbol(' ', 10)); List<RangeMarker> mm = add(document, 9,9, 4,4, 1,7, 7,7, 4,7 ); edit(document, 1,5,0); delete(mm, 3); }
Example #30
Source File: ParmScreen.java From jmg with GNU General Public License v2.0 | 5 votes |
private void initializeVolumeList() { volumeList = new List(); int minVolume = 7; int maxVolume = 256; int volumeStep = 6; for ( int i = minVolume; i <= maxVolume; i += volumeStep) { volumeList.add( (new Integer(i)).toString() ); } }