5 Replies - 270 Views - Last Post: 15 November 2012 - 03:13 PM Rate Topic: -----

#1 jonnykratz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 02-November 12

Reduce item list when item is sold in POS

Posted 13 November 2012 - 02:13 AM

I have a Point Of Sales and i want when items are sold, the items sold are deleted from database and show number of remaining items in a jlabel or jtextfield. I have tried the code but i cant make it. I appreciate your help.
Is This A Good Question/Topic? 0
  • +

Replies To: Reduce item list when item is sold in POS

#2 MattDelly  Icon User is offline

  • New D.I.C Head

Reputation: 9
  • View blog
  • Posts: 43
  • Joined: 08-November 12

Re: Reduce item list when item is sold in POS

Posted 13 November 2012 - 02:23 AM

The first thing your going to need to do is learn swing so you can setup a basic window.
Your going to need to import a bunch of things:
import javax.swing.*; // For swing library components
import java.awt.*;
import java.awt.event.*;// For Action listener



Here is a swing example at the most basic level:
/*
	The program demonstrates the use of JFrame
	It sets the title to Hello World

*
*/

import javax.swing.*; // Needed for the swing class

public class HelloWorld extends JFrame
{
	public HelloWorld()
	{ 
		// Sets the size of the window

		setSize(300, 200);

		// Sets the title of the window

		setTitle("This is a Hello World Frame");

		// Sets the action when the user clicks on the X of the window

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// Sets the window to be visible

		setVisible(true);

	}

	public static void main(String[] args)
	{
		new HelloWorld();
	}
}



How to write an action listener: http://docs.oracle.c...onlistener.html

Video: http://www.youtube.c...h?v=jEXxaPQ_fQo

How to make a JTextField: http://www.roseindia...textfield.shtml

If you run into any problems, post them on here!

This post has been edited by MattDelly: 13 November 2012 - 02:24 AM

Was This Post Helpful? 0
  • +
  • -

#3 jonnykratz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 02-November 12

Re: Reduce item list when item is sold in POS

Posted 13 November 2012 - 03:35 AM

Thanks but am not getting how i can reduce the stock when an item is sold.
Was This Post Helpful? 0
  • +
  • -

#4 MattDelly  Icon User is offline

  • New D.I.C Head

Reputation: 9
  • View blog
  • Posts: 43
  • Joined: 08-November 12

Re: Reduce item list when item is sold in POS

Posted 13 November 2012 - 03:38 AM

Create a variable containing the stock and use a counter
int cheese = 2;
if(cheese == sold)
cheese--;


Was This Post Helpful? 0
  • +
  • -

#5 jonnykratz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 02-November 12

Re: Reduce item list when item is sold in POS

Posted 15 November 2012 - 02:04 PM

And how about using Sir.A need the help because my project have stopped because i got no idea on how to tackle the problem.
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8346
  • View blog
  • Posts: 31,908
  • Joined: 06-March 08

Re: Reduce item list when item is sold in POS

Posted 15 November 2012 - 03:13 PM

This is ridiculous... talking in the clouds
Open a topic, post your code and we'll see
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1