Re: Content of the same cell
Hello,
Well you make sure that your stack is declared statically in one of your classes. Otherwise you can always call a class method that will have to treat him in passing as parameter the stack in question. I think this should be easy for you, just read it and the concept will be clear for you. If you have any other problem regrading this topic then please do post back and we will try to solve it.
Re: Content of the same cell
Hello,
Guys this is my part of the code. If I have made a mistake, then guide me with it.
Code:
private JButton getJButton() {
if (jButton == null) {
Icon ig = new ImageIcon("lion.jpg");
jButton = new JButton(ig);
jButton.setBounds(new Rectangle(29, 58, 94, 54));
jButton.setText("");
jButton.addActionListener(new java.awt.event.ActionListener() {
Public void actionPerformed(java.awt.event.ActionEvent e) {
/ / System.out.println (analyselex.lion) / / TODO Auto-generated Event stub actionPerformed ()
stack.push(1);
}
});
}
return jButton;
}
private JButton getJButton1() {
if (jButton1 == null) {
Icon = ig new ImageIcon("Leopard.jpg");
jButton1 = new JButton(ig);
jButton1.setBounds(new Rectangle(30, 3, 93, 50));
jButton1.setText("");
jButton1.addActionListener(new java.awt.event.ActionListener() {
Public void actionPerformed(java.awt.event.ActionEvent e) {
/ / System.out.println (elements.leopard) / / TODO Auto-generated Event stub actionPerformed ()
stack.push(2);
}
});
}
return jButton1;
}
Re: Content of the same cell
Hello,
Even I had a similar kind of a problem and I did the following. I had no idea about it, but it worked for me, but the working behind the code was unknown by me. This is the part that I included in my code
Code:
import java.util.Stack;
Public class test extends Window {
void definition (Stack Stack){
}
}
Any information on this topic will be helpful to me. Thanks in advance.
Re: Content of the same cell
Hello,
Guys this is my updated or modified code. Check it and if you can suggest me something different alternative for it then it will be great
Code:
Public class test extends Window {
void definition (Stack Stack){
Integer a = (Integer)stack.pop(); / / L has integer value retrieves the first available stack
if (a == 1){
Subject("The Lion"); / / If equal to 1 c is a subject
}
else if(a == 2){
Subject("The Leopard");
}
else if(a == 9){
Word("eats"); / / If equal to 9 c is a verb
}
else if(a == 10){
Word("drinks");
}
else if(a == 11){
Word("sleeps");
}
else if(a == 12){
Complement("Meat"); / / If equal to 12 C is a complement
}
else if(a == 13){
Complement("turf");
}
else if(a == 14){
Complement("Water");
}
else{
return;
}
}
static void Complement(String string) {
}
static void Word(String string) {
}
static void Subject(String string) {
}
}
Re: Content of the same cell
Hello,
Say if you do a test on the whole digital, using a switch / case is more elegant. After you have to see if a functional point of view the statement satiate is better or not. The advantage of using your cell as a parameter to your method of analysis is that you build this little piece of code to analyze other batteries. I think if you go with this then your code will be easy and more stable.