Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Class Console, DoubleField, SimpleWindow - Assignment | CSAS 1111, Assignments of Computer Science

Material Type: Assignment; Class: Intro to Comp Science I; Subject: Computer Science; University: Seton Hall University; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 08/08/2009

koofers-user-sh9
koofers-user-sh9 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Please download the following classes from our web site. Make sure to ‘right-click’ and ‘save as
…’ to put the files into the current BlueJ project directory.
Class Console
This class facilitates reading input from “standard in”, i.e. the keyboard, in simple text programs.
Methods provided are:
public static double readDouble()
when the user presses RETURN or ENTER, the method returns a double as entered if
possible. If the user enters a non-double number, the program quits.
public static int readInt()
when the user presses RETURN or ENTER, the method returns an int as entered if
possible. If the user enters a non-int number, the program quits.
public static String readString()
when the user presses RETURN or ENTER, the method returns a String as entered.
Class DoubleField
This class provides a GUI input field to hold and return a double number. Methods provided are:
public double getDouble()
returns the number entered into the GUI field as a double if possible, or returns 0.0 and
shows “ERROR”.
public void setDouble(double x)
puts the double number x into the GUI field, properly formatted.
Class SimpleWindow
This class helps to create a simple window, containing GUI elements in one row. Methods
provided are:
public void addLabel(String msg)
Adds a String as label to the current line
public void addField(JTextField field)
Adds an input field such as a DoubleField to the current line
public void addButton(JButton button)
Adds a button to the current line
public void setWindowTitle(String title)
Sets the title displayed in the window’s title bar

Partial preview of the text

Download Class Console, DoubleField, SimpleWindow - Assignment | CSAS 1111 and more Assignments Computer Science in PDF only on Docsity!

Please download the following classes from our web site. Make sure to ‘right-click’ and ‘save as …’ to put the files into the current BlueJ project directory.

Class Console

This class facilitates reading input from “standard in”, i.e. the keyboard, in simple text programs. Methods provided are: public static double readDouble() when the user presses RETURN or ENTER, the method returns a double as entered if possible. If the user enters a non-double number, the program quits. public static int readInt() when the user presses RETURN or ENTER, the method returns an int as entered if possible. If the user enters a non-int number, the program quits. public static String readString() when the user presses RETURN or ENTER, the method returns a String as entered.

Class DoubleField

This class provides a GUI input field to hold and return a double number. Methods provided are: public double getDouble() returns the number entered into the GUI field as a double if possible, or returns 0.0 and shows “ERROR”. public void setDouble(double x) puts the double number x into the GUI field, properly formatted.

Class SimpleWindow

This class helps to create a simple window, containing GUI elements in one row. Methods provided are: public void addLabel(String msg) Adds a String as label to the current line public void addField(JTextField field) Adds an input field such as a DoubleField to the current line public void addButton(JButton button) Adds a button to the current line public void setWindowTitle(String title) Sets the title displayed in the window’s title bar