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;
}
java类java.awt.List的实例源码
ClassMemberTest.java 文件源码
项目:incubator-netbeans
阅读 23
收藏 0
点赞 0
评论 0
AuthorizationService.java 文件源码
项目:private-WeChat
阅读 29
收藏 0
点赞 0
评论 0
@SuppressWarnings({ "deprecation", "unchecked" })
public SNSUserInfo getUserInfo(String accessToken,String openId){
logger.info("getUserInfo accessToken : {} , openId : {} ", accessToken, openId);
SNSUserInfo user = null;
String requestUrl = userinfo_url.replace("OPENID", openId).replace("ACCESS_TOKEN", accessToken);
JSONObject jsonObject = CommonUtil.httpsRequest(requestUrl, "GET", null);
if(null != jsonObject){
// logger.info("授权返回JSONObject 数据 : " + com.meidusa.fastjson.JSONObject.toJSONString(jsonObject));
logger.info("授权返回JSONObject 数据 : Key : {}, values : {} " ,com.alibaba.fastjson.JSONObject.toJSONString(jsonObject.keySet()),
com.alibaba.fastjson.JSONObject.toJSONString(jsonObject.values()));
try{
user = new SNSUserInfo();
user.setOpenId(jsonObject.getString("openid"));
user.setNickname(jsonObject.getString("nickname"));
user.setSex(jsonObject.getInt("sex"));
user.setProvince(jsonObject.getString("province"));
user.setCity(jsonObject.getString("city"));
user.setCountry(jsonObject.getString("country"));
user.setHeadimgurl(jsonObject.getString("headimgurl"));
user.setPrivilegeList(JSONArray.toList(jsonObject.getJSONArray("privilege"), List.class));
}catch(Exception e){
logger.error("网页授权获取用户信息失败 " + e.getMessage());
user = null;
int errCode = jsonObject.getInt("errcode");
String errMsg = jsonObject.getString("errmsg");
logger.error("网页授权获取用户信息失败 errCode : {} , errmsg : {} ", errCode,errMsg);
}
}
logger.info("getUserInfo => 返回 : " + com.alibaba.fastjson.JSONObject.toJSONString(user));
return user;
}
UserDialogAWT.java 文件源码
项目:VASSAL-src
阅读 22
收藏 0
点赞 0
评论 0
private Panel layoutWhoPanel() {
Panel panel = new Panel();
panel.setLayout(new BorderLayout());
panel.add("North", new Label("Who's On:"));
panel.add("Center", zPeersList = new List(25, false));
zPeersList.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
String lineRest = e.getActionCommand();
int spaceAt = lineRest.indexOf(' ');
if (spaceAt != -1)
handlePrivateMessageWindowRequest(lineRest.substring(0, spaceAt));
zChatText.requestFocus();
}
}
);
return panel;
}
R2303044ListSelection.java 文件源码
项目:jdk8u-jdk
阅读 33
收藏 0
点赞 0
评论 0
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();
}
ActionEventTest.java 文件源码
项目:openjdk-jdk10
阅读 31
收藏 0
点赞 0
评论 0
public ActionEventTest() {
try {
robot = new Robot();
robot.setAutoDelay(100);
robot.setAutoWaitForIdle(true);
} catch(AWTException e) {
throw new RuntimeException(e.getMessage());
}
list = new List(1, false);
list.add("0");
add(list);
setSize(400,400);
setLayout(new FlowLayout());
pack();
setVisible(true);
}
ItemEventTest.java 文件源码
项目:openjdk-jdk10
阅读 28
收藏 0
点赞 0
评论 0
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();
}
R2303044ListSelection.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
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();
}
ListOperator.java 文件源码
项目:openjdk-jdk10
阅读 32
收藏 0
点赞 0
评论 0
@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;
}
ActionEventTest.java 文件源码
项目:openjdk9
阅读 23
收藏 0
点赞 0
评论 0
public ActionEventTest() {
try {
robot = new Robot();
} catch(AWTException e) {
throw new RuntimeException(e.getMessage());
}
list = new List(1, false);
list.add("0");
add(list);
setSize(400,400);
setLayout(new FlowLayout());
pack();
setVisible(true);
robot.waitForIdle();
}
ItemEventTest.java 文件源码
项目:openjdk9
阅读 24
收藏 0
点赞 0
评论 0
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();
}
R2303044ListSelection.java 文件源码
项目:openjdk9
阅读 20
收藏 0
点赞 0
评论 0
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();
}
ListOperator.java 文件源码
项目:openjdk9
阅读 25
收藏 0
点赞 0
评论 0
@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;
}
R2303044ListSelection.java 文件源码
项目:jdk8u_jdk
阅读 22
收藏 0
点赞 0
评论 0
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();
}
R2303044ListSelection.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 40
收藏 0
点赞 0
评论 0
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();
}
Demo.java 文件源码
项目:javify
阅读 23
收藏 0
点赞 0
评论 0
public void init ()
{
initted = true;
Panel p = new Panel ();
p.setLayout (new GridLayout (3, 1));
List l = new List (5, true);
for (int i = 0; i < 10; i++)
l.add ("List item " + i);
p.add (l);
add (p, "Center");
Button cb = new Button ("Close");
cb.addActionListener(new ActionListener () {
public void actionPerformed (ActionEvent e) {
dispose();
}
});
add (cb, "South");
setTitle ("List");
pack();
}
QtListPeer.java 文件源码
项目:javify
阅读 59
收藏 0
点赞 0
评论 0
protected void setup()
{
super.setup();
List o = (List)owner;
// Multiple selection
setMultipleMode(o.isMultipleMode());
// Add initial list items.
String[] items = o.getItems();
for (int i = 0; i < items.length; i++)
add(items[i], i);
// Initial selections.
int[] selected = o.getSelectedIndexes();
for (int i = 0; i < selected.length; i++)
select(selected[i]);
// If no initial selection, use 0.
if(selected.length == 0 && items.length > 0)
select( 0 );
}
QtListPeer.java 文件源码
项目:javify
阅读 24
收藏 0
点赞 0
评论 0
/**
* Called back when a row is selected. -1 if no row is selected.
*/
private void fireChoice( int index )
{
ignoreNextSelect = true;
if( index == -1)
((List)owner).deselect( ((List)owner).getSelectedIndex() );
else
{
((List)owner).select( index );
ItemEvent e = new ItemEvent((List)owner,
ItemEvent.ITEM_STATE_CHANGED,
""+index,
ItemEvent.SELECTED);
QtToolkit.eventQueue.postEvent(e);
}
}
RangeMarkerTest.java 文件源码
项目:intellij-ce-playground
阅读 18
收藏 0
点赞 0
评论 0
public void testDocSynchronizerPrefersLineBoundaryChanges() throws Exception {
String text = "import java.awt.List;\n" +
"[import java.util.ArrayList;\n]" +
"import java.util.HashMap;\n" +
"import java.util.Map;";
RangeMarker marker = createMarker(text);
synchronizer.startTransaction(getProject(), document, psiFile);
String newText = StringUtil.replaceSubstring(document.getText(), TextRange.create(marker), "");
synchronizer.replaceString(document, 0, document.getTextLength(), newText);
final List<DocumentEvent> events = new ArrayList<DocumentEvent>();
document.addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
events.add(e);
}
});
synchronizer.commitTransaction(document);
assertEquals(newText, document.getText());
DocumentEvent event = assertOneElement(events);
assertEquals("DocumentEventImpl[myOffset=22, myOldLength=28, myNewLength=0, myOldString='import java.util.ArrayList;\n', myNewString=''].", event.toString());
}
RangeMarkerTest.java 文件源码
项目:intellij-ce-playground
阅读 21
收藏 0
点赞 0
评论 0
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();
}
ListBeanInfo.java 文件源码
项目:incubator-netbeans
阅读 21
收藏 0
点赞 0
评论 0
/** @return Propertydescriptors */
@Override
protected PropertyDescriptor[] createPDs() throws IntrospectionException {
return new PropertyDescriptor[] {
new PropertyDescriptor("multipleMode", List.class), // NOI18N
};
}
LWToolkit.java 文件源码
项目:OpenJSharp
阅读 26
收藏 0
点赞 0
评论 0
@Override
public final ListPeer createList(List target) {
PlatformComponent platformComponent = createPlatformComponent();
LWListPeer peer = new LWListPeer(target, platformComponent);
targetCreatedPeer(target, peer);
peer.initialize();
return peer;
}
LWToolkit.java 文件源码
项目:jdk8u-jdk
阅读 23
收藏 0
点赞 0
评论 0
@Override
public final ListPeer createList(List target) {
PlatformComponent platformComponent = createPlatformComponent();
LWListPeer peer = new LWListPeer(target, platformComponent);
targetCreatedPeer(target, peer);
peer.initialize();
return peer;
}
Test4750368.java 文件源码
项目:jdk8u-jdk
阅读 18
收藏 0
点赞 0
评论 0
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");
}
}
Test4520754.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
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);
}
LWToolkit.java 文件源码
项目:openjdk-jdk10
阅读 23
收藏 0
点赞 0
评论 0
@Override
public final ListPeer createList(List target) {
PlatformComponent platformComponent = createPlatformComponent();
LWListPeer peer = new LWListPeer(target, platformComponent);
targetCreatedPeer(target, peer);
peer.initialize();
return peer;
}
ItemEventTest.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
@Override
public boolean handleEvent(Event e) {
if (e.target instanceof List) {
if (e.id == Event.LIST_DESELECT || e.id == Event.LIST_SELECT) {
actualSelectionOrder.append(e.arg);
}
}
return true;
}
Test4750368.java 文件源码
项目:openjdk-jdk10
阅读 17
收藏 0
点赞 0
评论 0
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");
}
}
Test4520754.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
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);
}
ListOperator.java 文件源码
项目:openjdk-jdk10
阅读 29
收藏 0
点赞 0
评论 0
@Override
public Hashtable<String, Object> getDump() {
Hashtable<String, Object> result = super.getDump();
addToDump(result, ITEM_PREFIX_DPROP, ((List) getSource()).getItems());
addToDump(result, SELECTED_ITEM_PREFIX_DPROP, ((List) getSource()).getSelectedItems());
return result;
}
ListOperator.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
/**
* 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);
}
});
}