ISYS 303 - GUI Flashcards

1
Q

how to set things visible/invisible

A

.setVisible(boolean: true or false);

EX: GreenPanel.setVisible(true);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

set cursor in specific place (i.e textbox)

A

nameoftextbox.requestFocus();

EX: txtYourName.requestFocus();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

convert double to a string

or anything to string

A

String.valueOf(NameofVariable.getSelectedItem());

String.valueOf(cmbIS100.getSelectedItem()),

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

convert string to a double
(or anything to double)
or integer

A

Double.parseDouble(NameofVariable.getText())
Integer.parseInt(NameofVariable.getText())

Double.parseDouble(txtIS100.getText())

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

DecimalFormat

A
DecimalFormat oDF = new DecimalFormat(#.00);
String sToHoldDecimal = oDF.format(whatyouwanttoformat)

GPALabel.setText(oDF.format(dFinGPA))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

set Textbox/Label

A

NameOfTxtBox/Lbl.setText(“anythinghere”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

set combo box

A

NameOfCmb.setSelectedIndex(#);

**the # starts with 0, and ends with as many options as your put

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

set jDialog form Visible/Not Visible

A

private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
}

This statement tells the form that when the Close button is clicked it then the form object will change its visibility to false (thus hiding it)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

String sSQL

A

This variable will hold the SQL statement. It is not really needed but I am showing that you could dynamically build a SQL statement and store it to a variable and then use that variable within your program to access the data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

try{

A

All of the source code to access the database is protected within a try statement. That way if something goes wrong, Java can try to recover as needed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

String driver = “net.ucanaccess.jdbc.UcanaccessDriver”;

Class.forName(driver);

A

The Class.forName(driver) statement specifies a specific driver that Java will use within the program. This statement indicates that Java will be using the UcanaccessDriver within the source code that follows

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Connection con = DriverManager.getConnection(“jdbc:ucanaccess://C:/Test/GoldStarHR.accdb”);

A

The Connection object informs Java which database file to use and how to access it. The jdbc (which stands for Java database connectivity) uses the ucanaccess driver

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Statement stmt = con.createStatement();

A

The Statement object connects the Connection object with a statement that will be executed and
specified later. It will be the actual SQL statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

sSQL = “Select SSN, Last_Name, First_Name, Hire_Date FROM Employee”;

A

This is the string variable set up earlier to hold the SQL statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

ResultSet rs = stmt.executeQuery(sSQL);

A

The ResultSet object contains the data returned from the Statement object attached to the Connection object using the SQL statement in the sSQL variable. So in essence, this runs the SQL statement and returns all of the records from the Employee table showing the SSN, Last_Name, First_Name, and Hire_Date columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

DefaultTableModel model = (DefaultTableModel)tblEmployee.getModel();

A

The DefaultTableModel object indicates the storage space for the data to be used. Remember that the model represents the data. This statements says to create a model object and base it up on the tblEmployee JTable object on the form

17
Q

model.setRowCount(0);

A

This statement says to highlight the first row of data

18
Q
if (rs != null)
while ( rs.next() ){
model.addRow(new Object[]{
rs.getString("SSN"), 
rs.getString("Last_Name"),
rs.getString("First_Name"),
rs.getString("Hire_Date")
}); 
}
A

These statements says If there is a row in the result set called rs While there is a row of data Add a new row of data to the new model object using the columns specified IOW, this will check to see if there is data and as long as there IS data, extract the SSN, Last_Name,First_Name, and Hire_Date from the table and add it to the model for the JTable object.

19
Q

stmt. close();

con. close();

A

Then we close the resources we created

20
Q

char charAt

A
char charAt = sNameTogether.charAt(iCount);
//finds the letter in the names from the counter
String valueOf = String.valueOf(charAt);
//converts the found letter to a string
21
Q

Combo boxes

A
cmbIS100.setSelectedIndex(0); 
//resets the combo box to "A"

cmbIS100.getSelectedItem())

22
Q

Text boxes

A

txtIS100.getText()

23
Q

Checkboxes

A

cbHTAdv.setSelected(false);

cbHTAdv.isSelected()

24
Q

ListBoxes

A

confTeamList.getModel().getSize()

confTeamList.getModel().getElementAt(iCounter).toString()