Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

Screen

How do you create a graphical user interface?

designScreen()

The designScreen() method first creates a button object with this statement Button emailButton = new Button("Send Mail");. A new object is created by declaring the object name and then using the "new" statement to create an instance of the object. The object parameter list supplies data specific to the object. In this case the "Send Mail" text string is used to define the emailButton label.

The listLabel object is created with this statement, Label listLabel = new Label("Directory");.

A panel called listPanel is created with Panel listPanel = new Panel(); and listPanel.setLayout(new BorderLayout()); The setLayout method of the Panel class specifies the type of layout manger to use for the listPanel. There are five standard layout managers. The default layout manager is called FlowLayout which arranges components in a panel from left to right in a row. However, we wanted to arrange our components differently so we defined listPanel to use the BorderLayout manager. The BorderLayout manager allows components to be placed in the regions North, South, East, West and Center. The other layout managers provide additional flexibility to allow the programmer to provide more specific suggestions in order to layout the components. Yes I said, suggestions because the programmer doesn't actually place components at certain pixels on the screen he/she only provides suggestions to encourage the placement of components relative to other components in approximate locations on the panel.

The following statements specify formatting characteristics of the panel components.
listLabel.setAlignment(Label.CENTER); Center the label text.
listPanel.setBackground(Color.lightGray); Set the color of the listPanel to light gray.
itemList.setBackground(Color.yellow); Set the color of the itemList to yellow.
setBackground(Color.white); Set the color of the entire applet panel to white.

The add method of the Panel class adds the components to the listPanel as follows:
listPanel.add("North",listLabel);
listPanel.add("Center",itemList);
listPanel.add("South",sendButton);

The add(listPanel); statement adds the listPanel to the Applet panel, which puts it in our HTML document.

For simplicity, the foreground color and font of the text have assumed the default values. A good enhancement to this program would be to read in the color and font as parameters and set the foreground text color and font.

Previous Next



Up to => Home / Authoring / Java / Intro




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers