Click here to Skip to main content
12,998,423 members (117,009 online)


AnswerRe: java Pin
Richard MacCutchan4-Mar-13 23:19
mvpRichard MacCutchan4-Mar-13 23:19 
QuestionJava Server read txt file and compare to data in Excel file. Pin
EuphorialXTC4-Mar-13 8:49
memberEuphorialXTC4-Mar-13 8:49 
AnswerRe: Java Server read txt file and compare to data in Excel file. Pin
Richard MacCutchan4-Mar-13 23:18
mvpRichard MacCutchan4-Mar-13 23:18 
GeneralRe: Java Server read txt file and compare to data in Excel file. Pin
EuphorialXTC4-Mar-13 23:22
memberEuphorialXTC4-Mar-13 23:22 
Questionandroid app Pin
StudentGirl3-Mar-13 19:36
memberStudentGirl3-Mar-13 19:36 
AnswerRe: android app Pin
Sandeep Mewara3-Mar-13 20:13
mvpSandeep Mewara3-Mar-13 20:13 
GeneralRe: android app Pin
StudentGirl5-Mar-13 4:03
memberStudentGirl5-Mar-13 4:03 
QuestionHow to manipulate a combo box? Pin
Member 98295361-Mar-13 23:28
memberMember 98295361-Mar-13 23:28 
Would someone please give me an example of a program that increments and decrements values with just the use of combo box and buttons, no other stuffs like a JDialog or even JTable. I'm having a hard time trying to understand complicated programs after all I'm just a newbie in java, so I need a very simple one that is easy to understand.

the code is this:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
    public class EditStack {
    private JComboBox comboBox = new JComboBox();
    private JButton button = new JButton("Add Order");
    private JButton button_1 = new JButton("Decrease Order");
    JComboBox combo;
    private static String z  = "";
    private static String w  = "";
    private static String x  = "";
    private static String a  = "";
    private int numClick = 0;
public EditStack() {
    String mgaPagkainTo[] = {"PM1 (Paa/ Spicy Paa with Thigh part)","PM2 (Pecho)","PM3 (Pork Barbeque 4 pcs.)","PM4 (Bangus Sisig)","PM5 (Pork Sisig)","PM6 (Bangus Inihaw)","SM1 (Paa)","SM2 (Pork Barbeque 2 pcs.)","Pancit Bihon","Dinuguan at Puto","Puto","Ensaladang Talong","Softdrinks","Iced Tea","Halo-Halo","Leche Flan","Turon Split"};
    JFrame frame = new JFrame("Mang Inasal Ordering System");
    JPanel panel = new JPanel();
    combo = new JComboBox(mgaPagkainTo);
    combo.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
        String str = (String)combo.getSelectedItem();
        a = str;
        EditLang messageOrder1 = new EditLang();
    button.addActionListener(new ActionListener() { //this is the part I'm stuck with
        public void actionPerformed(ActionEvent e) {
            String selectedItem = (String) comboBox.getSelectedItem(); // I want here to display the selected item in the combo box
            numClick++ // and then increment it whenever I clicked on the add button
  public static void main(String[] args) {
  Scanner inp = new Scanner(;
  boolean ulitinMoPows = true;
  boolean tryAgain = true;
    System.out.print("\nInput Customer Name: ");
    String customerName = inp.nextLine();
    w = customerName;
    System.out.print("\nInput Cashier Name: ");
    String user = inp.nextLine();
    z = user;
    System.out.print("\nInput either Dine In or Take Out: ");
    String dInDOut = inp.nextLine();
    x = dInDOut;
        if (x.equals("Dine In") || x.equals("Take Out")){
         ulitinMoPows = false;
         JOptionPane.showMessageDialog(null, "Try again! Please input Dine In or Take Out only!","Error", JOptionPane.ERROR_MESSAGE);
             ulitinMoPows = true;
             System.out.print ("\f");
    System.out.print("\nInput password: ");
    String pass = inp.nextLine();
        EditLang messageShowMenu = new EditLang();
        tryAgain = false;
        JOptionPane.showMessageDialog(null, "Try again! Invalid password!","Error Logging-In", JOptionPane.ERROR_MESSAGE);
    tryAgain = true;
     System.out.print ("\f");
EditStack j = new EditStack();
  public static String kuhaOrder()
  return a;
  public static String kuhaUserName()
  return z;
  public static String kuhaCustomerName()
  return w;
  public static String kuhaSanKainPagkain()
  return x;
//Class of EditLang:
public class EditLang {
public void ShowMo(){
    String user = EditStack.kuhaUserName();
    System.out.print("\n\n\t\tCashier: " +user);
    String dInDOut = EditStack.kuhaSanKainPagkain();
    System.out.print("                          "+dInDOut);
    String customerName = EditStack.kuhaCustomerName();
    System.out.print("\n\t\tCustomer Name: " +customerName);
public void ShowOrderPo() {
    String order = EditStack.kuhaOrder();
    System.out.print("\t\t\t\t\n " +order);
//I want to do something like that. Any help will be appreciated thanks!

AnswerRe: How to manipulate a combo box? Pin
Richard MacCutchan1-Mar-13 23:59
mvpRichard MacCutchan1-Mar-13 23:59 
QuestionImage Mosaicing Pin
rachit1328-Feb-13 19:03
memberrachit1328-Feb-13 19:03 
QuestionCan we have Scala added to the list? Pin
dusty_dex26-Feb-13 6:48
memberdusty_dex26-Feb-13 6:48 
AnswerRe: Can we have Scala added to the list? Pin
jschell26-Feb-13 9:04
memberjschell26-Feb-13 9:04 
GeneralRe: Can we have Scala added to the list? Pin
dusty_dex26-Feb-13 9:42
memberdusty_dex26-Feb-13 9:42 
Questionchoise of framework for end of study Pin
simontifo25-Feb-13 2:33
membersimontifo25-Feb-13 2:33 
AnswerRe: choise of framework for end of study Pin
Prasad Khandekar2-May-13 20:15
professionalPrasad Khandekar2-May-13 20:15 
Questioncompiler Pin
Olfat Ameen23-Feb-13 17:56
memberOlfat Ameen23-Feb-13 17:56 
AnswerRe: compiler Pin
Richard MacCutchan23-Feb-13 21:18
mvpRichard MacCutchan23-Feb-13 21:18 
QuestionJava Pin
thevivek.pro21-Feb-13 19:42
memberthevivek.pro21-Feb-13 19:42 
AnswerRe: Java Pin
Marco Bertschi21-Feb-13 22:08
memberMarco Bertschi21-Feb-13 22:08 
Questionproblem with looping Pin
Member 982953620-Feb-13 22:20
memberMember 982953620-Feb-13 22:20 
AnswerRe: problem with looping Pin
Richard MacCutchan20-Feb-13 22:56
mvpRichard MacCutchan20-Feb-13 22:56 
AnswerRe: problem with looping Pin
ameymh21-Feb-13 18:59
memberameymh21-Feb-13 18:59 
GeneralRe: problem with looping Pin
Richard MacCutchan21-Feb-13 22:35
mvpRichard MacCutchan21-Feb-13 22:35 
SuggestionRe: problem with looping Pin
SENTHILKANTH26-Feb-13 1:44
memberSENTHILKANTH26-Feb-13 1:44 
QuestionCalendar Recommendations Pin
FyreWyrm16-Feb-13 5:45
memberFyreWyrm16-Feb-13 5:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 19 Jun 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid