Home > Back-end >  AddItemListener how the internal variable returns to the outer class?
AddItemListener how the internal variable returns to the outer class?

Time:09-17

Public double JSFS (JPanel p) {
JComboBox JSFS=new JComboBox<> (a);
JSFS. SetPreferredSize (new Dimension (20), 100);
JSFS. AddItem (" ");
JSFS. AddItem (" according to the area, the unit price calculation ");
JSFS. AddItem (" calculate according to the total loans ");
JSFS. SetBounds (10,30,100,20);
P.a dd (JSFS);
SetVisible (true);

Double DKZE=0;

JSFS. AddItemListener (new ItemListener ()
{
Public void itemStateChanged (ItemEvent e) {
Double DKZE;
If (JSFS getSelectedIndex ()==1) {
JTextArea DJ1=new JTextArea ();
DJ1. SetText (" price: ");
DJ1. SetOpaque (false);
DJ1. SetBounds (10,60,40,20);
P.a dd (DJ1);

JTextField DJI=new JTextField ();
Average. SetBounds (50,60,100,20);
P.a dd (average);

JTextArea DJ2=new JTextArea ();
DJ2. SetText (" yuan/square meters ");
DJ2. SetOpaque (false);
DJ2. SetBounds (160,60,50,20);
P.a dd (DJ2);

JTextArea MJ1=new JTextArea ();
MJ1. SetText (" area: ");
MJ1. SetOpaque (false);
,90,40,20 MJ1. SetBounds (10);
P.a dd (MJ1);

JTextField MJI=new JTextField ();
MJI. SetBounds (50,90,100,20);
P.a dd (MJI);

JTextArea MJ2=new JTextArea ();
MJ2. SetText (" square ");
MJ2. SetOpaque (false);
MJ2. SetBounds (160,90,50,20);
P.a dd (MJ2);

SetVisible (true);

Double DJ=double. The valueOf (average. The getText (), toString ());
Double MJ=double. The valueOf (MJI. GetText (), toString ());
DKZE=DJ * Jackson;
}
}
}
);

Return DKZE;
}

How to put the inner class DKZE returns to the outside? Or in the external to internal DKZE assignment?

CodePudding user response:

Don't know what you said what relationship in external, you first find out two classes who call who, by calling the transfer value,

CodePudding user response:

reference 1st floor qq_39936465 response:
unclear external internal what you said, you first find out two classes who call who, by calling the transfer value,

AddItemListener obtain the JTextField input have been DKZE=DJ * MJ, how can this value is returned to the outside?

CodePudding user response:

refer to the second floor jiang Ye Zhou response:
Quote: refer to 1st floor qq_39936465 response:
unclear external internal what you said, you first find out two classes who call who, by calling the transfer value,

AddItemListener obtain the JTextField input have been DKZE=DJ * MJ, how can this value is returned to the outside?


You first take a look at the internal and external calls, to explain what you said what exactly is outside,
https://www.cnblogs.com/rgever/p/8902758.html
  • Related