EnQueue DeQueue With Gui?

Mar 29, 2015

I am doing a project from my book, basically you type into the textfield and what you type gets added to the queue and displayed in the text area...if you click the dequeue, it takes it out of the queue. It has to be in a gui(which is where I am stuck.)... Here is my classes and code:

Driver:

public class QueueGui {
public static void main(String[] args) {
JFrame frame = new JFrame("Queue Gui");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

[Code]....

Basically everything is done, but making the buttons work with the queue. I have a majority of the logic done but cannot get the information to list in the text area and take away...so that is where I am stuck; I am not sure how I would do that with a gui.

View Replies


ADVERTISEMENT

Dequeue Of Queue Implemented Using Circular Singly Linked List With No Tail Reference

Oct 27, 2014

So I'm trying to build a queue, first in first out, (so add to the head remove from the end) using a linked list for use in another program, I'm having a problem dequeueing where the program seems to run indefinitely without giving an answer, so my suspicion is its caught in a while loop but how and why I can't figure out.

public class CircularQueuelist {
private Node head = null;
private int size = 0;
private class Node
{
int data;
Node next;
 
[Code] ....

My logic seems sound, I basically look for when the second node over from the current one I'm on is a reference to the head, and then skip the one in front of it using setting currents. next link to current.next = head, severing the link to the last node.

This is what my driver looks like, I enqueue items 1-10 and then use the iterator to make sure it worked out fine and check size, its when I dequeue that I run into a problem, the program runs indefinitely.

public class Queuetest {
public static void main(String[]args)
{
CircularQueuelist test = new CircularQueuelist();
for (int count = 0; count < 10; count ++)

[Code] ....

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved