Solved

Java GUI to show Boolean Truth Tables

Posted on 2003-11-18
9
823 Views
Last Modified: 2011-10-03
I am a java novice and am trying to prove my worth to my so-called Java 'expert' friends. As a result of this i stupidly took up a bet with one of these friends. The bet was that i would not be able to create a java application that consists of a GUI that will enable a user to enter a Boolean term and the the application will then display a truth table for the that term. To prove that i could do this is told my friend that this would be easy. This was another studip mistake as he then added more stuff to it. The application should also be able to clear any previously entered terms and give the user the option to be able to request that the term be displayed with or without the appropriate brackets. The application should also be able to report an informative error-message if the term that has been entered is not well-formed.

To be total honest i have bitten off more than i can chew here. i do not know where to begin and have no chance off winning this bet. As a result i have know code to show you.

If i can pull it off i will be shown more respect and become more excepted into the circle of 'experts'. No one will help me as they all know about the bet and do not want to get involved.

i know that this question has a background that may be a bit out of the ordinary but any help that can be provided would be greatly appreciated.

Thanks,

garyjohno

ps. i know that this is alot to ask for only 65 points but it is all that i have available. Please help!
0
Comment
Question by:garyjohno
  • 4
9 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 70 total points
ID: 9770146
See previous question asked - it might parse logical expressions too
0
 

Author Comment

by:garyjohno
ID: 9770865
CEHJ your advice was not very good at all.<part of the comment removed from AnnieMod as insult to another member> have u seen how many solved questions there are. there is no way im searchin g through all of those.

can someone else please help me with this.
0
 

Author Comment

by:garyjohno
ID: 9777341

AnnieMod,

I am sorry for using such language. I was frustrated. Sorry and it will not happen in the future.

garyjohno
0
 

Author Comment

by:garyjohno
ID: 9779941
AnnieMod,

yes wel dun. u r on to me cu lata alligator :)

0
 

Author Comment

by:garyjohno
ID: 9780025
only playing with u AnnieMod,

the other question like mine is from a friend of mine. he has taken up the bet 2. the reason he has posted it is because he had more available points than me and he also knows about truth tables, hence the diagram in his question.

i wud not expect an expert to do my homework for me because i have tried that before and was told what you are telling me now. That was before i had read through the EE rules, sorry. I can understand why you are suspicious. This IS a genuine bet and i do need genuine help to win it.

This is the code that i have so far:

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;

class FirstFrame extends JFrame
{
    FirstFrame()
    {
        super("Truth Table Constructor");
       
        buildGUI();

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
        setVisible(true);
    }
   
    private void buildGUI() {
        JPanel top = new JPanel();
        top.setLayout(new BorderLayout());
        top.add(new JTextField(25), BorderLayout.CENTER);
        top.add(new JButton("OK"), BorderLayout.EAST);
       
        top.setBorder(new TitledBorder(new EtchedBorder(), "Enter a Statement"));
       
        add(new JButton("Quit"), BorderLayout.SOUTH);
    }
   
    public static void main(String[] args)
    {
        FirstFrame f = new FirstFrame();
    }
}

This code will not execute correctly. Any help will be appreciated

garyjohno
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now