java: implement stack in gui (JFrame, Applet)

Publicado em: 16 Outubro 2020
no canal de: CODE ZERO
2,946
69

#java #stack #gui #stack_in_gui #netbeans//

we'll be creating a stack in graphical user interface or you may say stack using gui.
we will implement some core functionalities of the stack gui which may include pop , push and reset. the code for stack class is provided below which you have to copy inside the project as shown in tutorial. stack gui using netbeans and java will work as normall.
gui Stack : It is Last-In-First-Out (LIFO) DS
The name "stack" for this type of structure comes from the analogy to a set of physical items stacked on top of each other, which makes it easy to take an item off the top of the stack,
while getting to an item deeper in the stack may require taking off multiple other items first
We can perform 2 operation on it :
PUSH : which adds an element to the collection, and
POP : which removes the most recently added element that was not yet removed
STACK CODE:

class Stack
{

int top=-1;
int size=0;
int[] arr;

public Stack(int size)
{
arr= new int[size];
this.size=size;
}
public void push (int value)
{
arr[++top] = value;
}
public int pop()
{
return arr[top--];
}
public int peek()
{
return arr[top];
}
public void reset()
{
top=-1;
}

}


Nesta página do site você pode assistir ao vídeo on-line java: implement stack in gui (JFrame, Applet) duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário CODE ZERO 16 Outubro 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 2,946 vezes e gostou 69 espectadores. Boa visualização!