感知代码中所做的更改
我使用 netbeans 6.9 创建了一个独立的 java 应用程序。在我的应用程序中,如果用户选择一些选项(某些特定字段的值),那么我的应用程序会自动生成其相应的代码。该代码显示在我的应用程序本身的文本区域中。
例如:在我的应用程序中,我有一个用于新变量的按钮。如果用户单击它,我的应用程序会询问变量名称。输入名称后,我的应用程序会自动生成相应的代码。
但我希望用户可以选择编辑该代码。
假设用户自己在文本区域输入该变量声明代码,那么我的应用程序应该检测到该代码的存在。
我的意思是在我的应用程序中我还有一个组合框,其中显示了声明的所有变量。因此,如果用户输入该代码并保存它,那么在我的应用程序中,应该存在用户为其编写代码的新变量。
谁能帮我解决这个问题。
-提前致谢
I've created a standalone java app using netbeans 6.9. In my app if a user selects some options(values for some specific fields) then my app automatically generates its corresponding code.That code is displayed in the text area in my app itself.
For example: In my app I've a button for a new variable. If the user clicks on it,my app asks for the variable name. After the name has been entered my app automatically generates the corresponding code for that.
But I want an option for the user to edit that code.
Suppose the user enters that variable declaration code himself on the text area then my app should sense the presence of that code.
I mean in my app I also have a combobox which shows all the variables declared. So if the user enters that code and saves it then in my app that new variable for which the user has written code for, should be present.
Can anyone help me with this.
-Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然您可以用 Java 完成您所要求的任务,但在某种程度上,Java 可能不是最适合此任务的语言。动态语言可能会更好。 JVM 有多种动态语言。也许 Groovy 是一个不错的选择,因为它具有类似 Java 的语法。
除了免责声明之外,要执行您在 Java 中所做的操作,您需要:
While you can do what you're asking in Java, up to a point, Java probably isn't the language best suited to this task. A dynamic language would probably be better. There are a number of Dynamic languages for the JVM. Perhaps Groovy would be a good fit, since it has a Java-like syntax.
Disclaimers aside, to do what you're doing in Java you'd want to: