English 中文(简体)
向主线(java/swing)提供数据
原标题:Parsing data back to mainPanel (java/swing)
  • 时间:2011-10-17 13:10:49
  •  标签:
  • java
  • swing

Set up: I have a mainPanel with a tabbedPane on it, i have a separate JPanel extra , extra creates an objects and i wish to pass that object back through to the mainPanel where i can actually use it/add it to the data structure.

Frame > Panel > TabbedPane > Panel (Separate category, Immediateiated as new Object)

我试图在主线上增加一名听众,以检查小组外派变迁的毛豆,然后采用某种方法等,但还是打工。

我将在主角采取接受该物体的方法,但我不知道如何回去。 (cotPane(cgetRootPane)没有回过任何东西。)

同样不能肯定的是,如果使用正确的术语,如果在指挥线“团结”环境下对 Java进行教育,那么对我来说,Swaing是非常新的。

我审判了名单上的人、观察员,目前正在考虑一个根植的物体,并通过所有物体通过DOWN。 (作为参考的java通行证,可以按需要将信息退回) 如果说这不是一种完全 st的思想,那么,让我知道,我们大家都能够过上我们的生活。 如果能够做得更好,那是巨大的。

(摘要)

[programApp]>[programView>tabbedPane]>[panel] Panel is created using new, and exists in a separate class. I want to pass data back from Panel to programView (projectNameView as it is in netbeans)

我将尽力补充尽可能多的信息。

最佳回答

您可使用MVC-pattern

Actually there are couple of variants depending on your preferences or exact task. For very simple case you can just use class with static fields to pass objects. Another way is to define your own listeners like:

private myPanel extends JPanel implements Notification {

... and where you create that panel:

myPanel.addNotificationReciever(mainPanel);

稍后,你只打电话<条码>,表示火线,或以任何其他方式执行类似的听众<条码>。

问题回答

SirVaulterScoff gave the best answer in my opinion, but I thought I d add some more (can t add comments yet, so I m creating a new answer).

您还应读到观察员-值得注意的模式(Wikipedia article,该模式与移动式中心模式一起使用。 在把我们的微型、小型和轻型武器分类联系起来时,确保一切尽可能松散。

作为附带评论:MVC确实是一种模式,如果你要与用户接口一起开发应用,那么你就应当把重点放在上。 它将拯救你们的许多头痛,使你的申请更容易维持和扩大。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签