Showing posts with label GUI. Show all posts
Showing posts with label GUI. Show all posts

Tuesday, May 28, 2013

JPanel


"How to Use Panels (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)" ( http://bit.ly/ZaWraM )

"JPanel (Java Platform SE 6)" ( http://bit.ly/Rn8WMx )

Tuesday, August 7, 2012

FlowLayout


"FlowLayout (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)" ( http://bit.ly/MZHggI )

Monday, May 7, 2012

Layout Managers

"A Visual Guide to Layout Managers (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)" ( http://bit.ly/LpAHle )

Monday, April 23, 2012

JFrame

From Swing, JFrame is a top-level GUI container component.

"How to Make Frames (Main Windows) (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)" ( http://bit.ly/1eWsG71 )

http://docs.oracle.com/javase/7/docs/api/javax/swing/JFrame.html

JOptionPane

From Swing, a JOptionPane is a dialog window.

http://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html

The showInputDialog function returns a String:

String thisString = JOptionPane.showInputDialog("Please input a value");

If you need to use the return value as an int, you may use the following function:

int returnValue = Integer.parseInt(thisString);

(But if the string contains anything other than numbers !!! Your program will CRASH)

If the user presses the Cancel button, showInputDialog will return null.

The following snippet checks if the return is (not) equal to null:

if ((thisString != null) {
// Statements....
}

Swing

javax.swing

GUI Components

http://docs.oracle.com/javase/7/docs/api/javax/swing/package-summary.html

often used in conjunction with java.awt UI classes

http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/package-summary.html