Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

joey whitewolfe

Greenhorn
+ Follow
since Sep 07, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by joey whitewolfe

I've never had operating systems, I don't know how to compile a java file that is in a dfferent directory and have another file call upon it and use it. Basically what I'm getting at is - I need my source file created in the root dir and when compiled the class will be directed to respective package. then the program will be compiled and run from the root dir. OK! I can compile java files but not in this way. Setting up dir and then extending out from that dir .I set it up but it doesn't follow out right.mainly it can't read it.javascript: x()
Eek!
19 years ago
it was a weekend project and is due monday
the exit the program button doesn't work I tried adding code to it but then it doesn't compile here is the second change which runs but like i said the exit button doesn't exit the program

(edited by Cindy to format code)
[ September 16, 2002: Message edited by: Cindy Glass ]
19 years ago
Help! I can't get it to work! do you have any suggestions? all I need it to do is save any information in a dat.file and if I haven't told you yet I'm only in High school, you guys helped me with the telephone program could you help me with this one
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ September 14, 2002: Message edited by: Dirk Schreckmann ]
19 years ago
thanks guys! I was able to get it running and just wanted you to see the finished code
/*
Name:
Date:September 4, 2002
Program Name:Telephone
Purpose:Web Phone
*/
import java.awt.*;
import java.awt.event.*;
public class Telephone extends Frame implements ActionListener
{
public Button keysArray[];
public Panel keyPad;
public TextField displayField;
public boolean foundKey;
public Label bottomLabel;
public Telephone()
{
displayField = new TextField(20);
keyPad = new Panel();
keysArray = new Button[12];
Label bottomLabel = new Label("Click each button above to dial your number");
displayField.setEditable(false);
setBackground(Color.magenta);

//Set Frame Layout
setLayout(new BorderLayout());
keyPad.setLayout(new GridLayout(4,3,10,10));
//Creating Buttons
for (int i = 0; i <= 9; i++)
keysArray[i] = new Button(String.valueOf(i));
keysArray[10] = new Button("*");
keysArray[11] = new Button("#");

//adding buttons
for (int i = 1; i <= 9; i++) //adds buttons 1-9 to Panel
keyPad.add(keysArray[i]);
keyPad.add(keysArray[10]);//adds * button to Panel
keyPad.add(keysArray[0]);//adds 0 button to Panel
keyPad.add(keysArray[11]);//adds # button to Panel

add(displayField, BorderLayout.NORTH); //adds text field to top of Frame
add(keyPad, BorderLayout.CENTER);//adds the keypad
add(bottomLabel, BorderLayout.SOUTH);//adds the display at the bottom
for(int i = 0; i < keysArray.length; i++)
keysArray[i].addActionListener(this);
addWindowListener(
new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
);
}//end of Telephone method
public void actionPerformed(ActionEvent e)
{
foundKey = false;
//Search fo the key pressed
for (int i = 0; i < keysArray.length && !foundKey; i++)
if(e.getSource() == keysArray[i])//key match found
{
displayField.setText(displayField.getText() + keysArray[i].getLabel());
}
}
public static void main(String args[])
{
//Create a new instance of the Telephone object
Telephone teleFrame = new Telephone();
//Set frame attributes
teleFrame.setBounds(50,100,260,300);
teleFrame.setTitle("Telephone");
teleFrame.setVisible(true);
}
}
19 years ago
thanks I got it now!
19 years ago
when i try and run in dos i get a main thread error- is there any reason it won't run in dos?i can compile it but when i type java Telephone i get the thread error
19 years ago
yes I'm new to arrays just confussing me on the concepts
19 years ago
totally lost
19 years ago
when i try and run it i get these errors in dos
java.lang.nullpointer
java.awt.container.addimpl(container.java;340
223
45
339
479
19 years ago
i want to know how do I make this work,a functional telephone keypad with the label at the bottom of the pad could you please look over my code and help me? I am using 1.3.1platform2 I just want to do it right and make it work it doesn't have to actually dial a real number, just be based on one. It is a class project and I need help it will compile but won't run. joey
19 years ago
how do I build a basic java application of a telephone keypad and add a label at the bottom saying what I want it to say? I've tried and this is what I've come up with so far but it doesn't work
my code
[ edited to preserve formatting using the [code] and [/code] UBB Tags -ds ]
[ September 07, 2002: Message edited by: Dirk Schreckmann ]
19 years ago