Android游戏设计

我正在设计一个具有多个级别的游戏,并且想知道我是否以正确的方式进行游戏。 我有一个菜单屏幕,可以选择级别,每个级别(按钮)都会启动一个专门针对该级别的新活动。 这是一个好的做法还是非常低效?

在Jackson中将JsonNode序列化为非常特定的JSON格式

我有JsonNode结果,我想要打印出来。 到目前为止,我正在使用: ObjectMapper mapper = new ObjectMapper(); mapper.enable(SerializationFeature.INDENT_OUTPUT); File outputFile = new File( getCurOutputDir(), String.format(“out.json”, getClass().getSimpleName()) ); mapper.writeValue(new FileOutputStream(outputFile), resultNode); 输出如下: { “A” : [ { “Ai” : { “Ai1” : 42, “Ai2” : 55 } } ], “B” : [ 86 ] } 但我需要它采用这种特定的格式: { “A” : [ { “Ai” : { “Ai1” : […]

如何使用JFormattedTextField只允许字母和数字

我有这个代码,无法正确使用MaskFormatter MaskFormatter之外 MaskFormatter formatter = null; try { formatter = new MaskFormatter(“HHHHHHH”); } catch (ParseException e) { e.printStackTrace(); } txtTroll = new JFormattedTextField(formatter); 我需要任何hex字符(0-9,az或AZ)和“H”应该 只给我(0-9,az或AZ),但我错了。 当我输入文字时,只输入大写字母并且输入速度很慢 当我点击txtTroll所有字母都会消失

SWT – 表/combobox

如何将combobox添加到表格中的特定列? 我希望我的最后一个专栏有一个包含3个选项的combobox(是,否,两者)。 我将包含我的表格代码,这样您就可以更好地告诉我新代码是如何进行的。 ////////////////////////////////////////////////////////////////////////// // createTableViewer() // ////////////////////////////////////////////////////////////////////////// private TableViewer createTableViewer(Composite parent) { viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); createColumns(parent, viewer); Table table = viewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); // Layout the viewer GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); viewer.setContentProvider(new ArrayContentProvider()); viewer.setInput(AplotDataModel.getInstance().getArrayData()); viewer.getControl().setLayoutData(gridData); return viewer; } ////////////////////////////////////////////////////////////////////////// // […]

在java中流关闭exception

请看看我做了什么 private InputSource getContent(String fName) throws SAXException, IOException, ServiceException { // Some code here if(currentNodeRef != null) { ContentReader reader = contentService.getReader(currentNodeRef,ContentModel.PROP_CONTENT); InputStream inputStream = null; try { inputStream = new BufferedInputStream(reader.getContentInputStream(),16384); return new InputSource(inputStream); } finally { if(inputStream!=null) try { inputStream.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } […]

Java Selenium WebDriver无法找到表单字段

我正在测试一个注册页面,我尝试了名称,xpath,id,类,似乎没有任何工作。 这是我的selenium代码 driver.findElement(By.id(“pushMenu”)).click(); Thread.sleep(2000); driver.findElement(By.linkText(“Register”)).click(); Thread.sleep(2000); WebElement l = driver.findElement(By.name(“name”)); 这是我正在尝试访问的表单标记 显式等待尝试代码: WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait.until(ExpectedConditions.elementToBeClickable(By.name(“name”))); driver.findElement(By.name(“name”)).sendKeys(“Testing100”);

GWT-Platform一个全局演示者中的几个嵌套演示者

我正在使用GWT-Platform MVP模型构建Web应用程序(Java)。 我有一个全球主持人,有“标题”,“主要内容”和“页脚”。 “主要内容” – 呈现不同的主持人 – 登录页面,退出页面,主页……“标题” – 是一个小部件。 我想将Header从widget转换为View-Presenter我应该怎么做? 换句话说,我的“全球主持人”将如何包含两位不同的主持人? 我尝试了下面的回答,但似乎没有什么对我有用 :1。 使用GWTP 2的嵌套演示者.http : //toolongdidntread.com/gwt/using-nested-presenters-with-gwtp/ 我是网络编程的新手,尤其是使用GWT进行编程的新手,所以也许我需要一些更清晰的例子,或者一些深层指南。 在此先感谢您的帮助!

反序列化会话数据时出现InvalidClassException错误

这是调用代码: Object attribute = session.getAttribute(name, scope); 这会引发以下错误: Could not deserialize session data. java.io.InvalidClassException: org.apache.commons.lang.time.FastDateFormat; local class incompatible: stream classdesc serialVersionUID = 1, local class serialVersionUID = -7186497712641044641 环境是Weblogic。 Web应用程序是一个spring portlet。 我正在努力了解如何解决这个问题。

ArrayAdapter <HashMap > with commonsguy EndlessAdapter类

如何使用ArrayAdapter-HashMap-与EndlessAdapter类? class DemoAdapter extends EndlessAdapter { private RotateAnimation rotate=null; @SuppressWarnings(“unchecked”) ArrayAdapter<HashMap> a=(ArrayAdapter<HashMap>)getWrappedAdapter(); DemoAdapter(ArrayList<HashMap> items) { super(new ArrayAdapter<HashMap>(Base.this, R.layout.row, android.R.id.text1, <—— ???? items)); <—— ???? 我的行R.layout.text1和R.layout.text2中有两列。 我看到PROJECTION_COLUMNS和VIEW_MAPPINGS几个例子,但不知道如何正确使用它。 这是完整的代码,它正在工作,但我在Listview(text1)中得到类似{test2 = dasdasd,test1 = asdasd}的内容: import com.commonsware.cwac.endless.EndlessAdapter; import java.util.ArrayList; import java.util.HashMap; public class Read extends ListActivity { EndlessAdapter x; SQLiteDatabase Db; public Cursor c; Integer cx; String Hash; @Override […]

Android:FragmentPagerAdapter不保存Fragment的状态?

我有FragmentPagerAdapter的问题。 我无法保存Fragment的状态,然后在Fragment中有视图。 每当我使用向左和向右滑动时,通过覆盖扩展FragmentPagerAdapter的静态类中的方法getItem(int position)来重新创建Fragment。 public static class GraphicsCollectionPagerAdapter extends FragmentPagerAdapter { final int NUM_ITEMS = 3; // number of tabs public GraphicsCollectionPagerAdapter(FragmentManager fm) { super(fm); fragmentList = new AnalyzeFragmentPageListWithDate(); fragment1 = new AnalyzeFragmentPage1(); fragment2 = new AnalyzeFragmentPage2(); } @Override public Fragment getItem(int position) { //Log.i(TAG, “getItem() -> New fragment at position ” + position); switch […]