0

我有两个带有 java 类的包

  • PKStrings
  • PKJ表格

public class classWork {
    public String[] titleMenu={
        "A","B","C","D"
    };

    public int intOption;
}

我有JFrame菜单

  • A点击去jframe A,

    B 点击 go jframe B,

    C 点击 go jframe C,

    D 点击 go jframe D

和同一个包装中的其他框架 JFram01,包含JLabel.

如果您单击“A”并显示该位置标签,如何识别?

4

2 回答 2

0
I dont understand your need. "A click A go jframe A" doesnot make sense.
if you want to go to another jFrame when clicking a label
Try this

    private void yourlabelMouseClicked(java.awt.event.MouseEvent evt) {
          //  either you can hide the current jFrame by setting 
            jFrame.setVisible(false);
            newjFrame.setVisible(True);
                    or
            make these jFrames in 2 different classes that make simple invocations
        }
于 2013-03-17T05:06:05.017 回答
0

据我了解,您可以在包中使用公共变量并使用 A、B、C 上的单击事件在其中存储值.....

然后从您想要的 jfaram 访问该信息

例如

public String pos ="";

A onclick event(){
   pos="A";
}


finally

if(pos.compareto("A")==0){
   jlabel.settext("A");
}
于 2013-03-17T05:09:12.180 回答