Académique Documents
Professionnel Documents
Culture Documents
1. ABSTRACT
2. INTRODUCTION
3. ABOUT ORGANISATION
4. SRS DOCUMENT
6. DESIGN DOCUMENT
9. TESTING
11. CONCLUSION
12. BIBLIOGRAPHY
1
Chat Express
2
Chat Express
Synopsis:
3
Chat Express
8. Copy & Paste: He can also perform operations like copying earlier
text into chat text. It is also possible to copy pictures and save them in
a file.
9. Chat Room control: He can manage the connection settings and
control the chat room settings.
10. Play sound when paged.
11. Manual: In case any help needed, the client can go through the in-
built manual available.
4
Chat Express
5
Chat Express
Existing System:
Proposed System:
6
Chat Express
Project Scope and Objectives:
7
Chat Express
The key to surviving--and thriving in--change is to change yourself. When we began in 1998, we
focused on IT staffing. Since then, we have continually adapted our business to stay one step
ahead of our clients' needs. Today we provide global contract and direct-hire recruiting services
to the world's leading companies in Singapore, Malaysia, Australia, Newzealand, UK and Ireland
in critical technology sectors such as Internet core technologies, software and hardware, intranets,
extranets, e-commerce, and Mobile multimedia.
OPERA TECHNOLOGIES scope of services includes the full range of IT Contract Services. We
have representatives in Singapore, Malaysia, UK, Australia, Newzeland and Ireland to support
the recruitment activities conducted in these countries. Our clients include Global 2000
corporations, government agencies, and healthcare institutions. Our core competency lies in
building deep personal relationships. Keeping people happy, helping clients meet their business
objectives, and facilitating our talent's growth--these are the hallmarks of Techmedia. Our
philosophy is to bring together people and resources, broaden horizons for international
businesses. Through our services, we help clients align operations with their business strategy,
implement new technology to enable their strategy, and continuously optimize existing
technology investments to meet their evolving business needs.
8
Chat Express
Consulting has become a necessity in our fast-paced technology- driven world. You might find it
hard to keep up with the changes and complexity of today's huge requirements. A comprehensive
collection of employment agencies, our domestic placement cell provides an essential point of
reference for employment resources. We are in the profession of placing the right person, in the
right place, at the right time and above all for the right price. Our long-term credibility, vitality
and viability evince our unswerving commitment.
We shall not compromise on quality even though speed will always be an important objective.
We shall respect and maintain confidentiality and ensure that the interests of our clients as well as
the candidates are always safeguarded.
We shall carefully select our own personnel and implement sound and progressive in-house
human resource policies.
We shall constantly endeavor to build long-term strategic business partnerships with our clients to
whom we are thankful for providing us the opportunities to excel.
For Employer : We collaborate with you to assist in building your people asset base by providing
candidate with high intellect.
For Candidate : We help you realize your career choices by providing you the right direction and
offering top-notch career opportunities
9
Chat Express
10
Chat Express
The Chat Express System is developed with the aim of facilitating the
effective communication channel and allows the user to send picture
images, graphical chatting through canvas management, automatic
logging of chatting transaction, segregating the users depending on
their interests. Sending a message provides a private communication
channel using the users can talk personally. A person, called admin,
maintains this system. He can monitor each and every transaction
entered by users of this system. He can also participate in the chatting
using administrative client option for sending and receiving the
messages.
1. Introduction
11
Chat Express
b. In chatroom management module also needs to interact
with the system whenever creating/updating/entering a
chatroom. This allows the user to be segregated as
different groups depending on their interests.
12
Chat Express
wasting by put on sending the mails, receiving it and
viewing it which doesn’t live communication. By this user
asked to enter all the details whatever he wants in the
future and can get them in a proper format and required
results whenever he wants easily just by few clicks only.
This system is developed in such a way that any one can
easily get the knowledge of how to use the system.
13
Chat Express
4. Contains external interface requirements, which includes
the user, hardware and software interfaces.
2. General Description
14
Chat Express
version also. The Chat Express in normally operated in GUI
mode.
3. Function Requirements
3.1 Inputs:
Modules:
15
Chat Express
User Management module: This module contains
add/delete the user in this application for which we need
to give user information as input. It also takes care of
connect/disconnecting the users from the application for
which you need to select the user and click on necessary
action. It helps the administrator to manage the chatroom
control panel for inviting/banning or allowing the users. It
also allows us to page the users and logging the user
chatting transaction.
3.2 Outputs:
16
Chat Express
user and banned list of users. It provides a facility to log
the user chatting transaction in to log files.
5. Performance Requirements
17
Chat Express
All the requirements relating to the performance characteristics of
the system must be clearly specified. There are two types of
performance requirements – static and dynamic.
Static Requirements are those that do not impose constraint on
the execution characteristics of the system. These include
requirements like the number of terminals to be supported, and
number simultaneous users to be supported, number of files, and
their sizes that the system has to process. These are also called
capacity of the system. Dynamic requirements specify constraints
on execution behaviour of the system. These typically include
response time and throughput constraints on the system.
6. Design constraints
18
Chat Express
VDU : VGA
Key Board : 101 Standard
7. Acceptance Criteria
CLIENT SERVER
OVER VIEW:
With the varied topic in existence in the fields of computers, Client Server is
one, which has generated more heat than light, and also more hype than
reality. This technology has acquired a certain critical mass attention with its
dedication conferences and magazines. Major computer vendors such as IBM
and DEC, have declared that Client Servers is their main future market. A
survey of DBMS magazine reveled that 76% of its readers were actively
looking at the client server solution. The growth in the client server
development tools from $200 million in 1992 to more than $1.2 billion in
1996.
19
Chat Express
configuration server may also act as client. A server may need to access
other server in order to process the original client request.
The key client server idea is that client as user is essentially insulated from
the physical location and formats of the data needs for their application. With
the proper middleware, a client input from or report can transparently access
and manipulate both local database on the client machine and remote
databases on one or more servers. An added bonus is the client server opens
the door to multi-vendor database access indulging heterogeneous table
joins.
Two prominent systems in existence are client server and file server systems.
It is essential to distinguish between client servers and file server systems.
Both provide shared network access to data but the comparison dens there!
The file server simply provides a remote disk drive that can be accessed by
LAN applications on a file by file basis. The client server offers full relational
database services such as SQL-Access, Record modifying, Insert, Delete with
full relational integrity backup/ restore performance for high volume of
transactions, etc. the client server middleware provides a flexible interface
between client and server, who does what, when and to whom.
Client server has evolved to solve a problem that has been around since the
earliest days of computing: how best to distribute your computing, data
generation and data storage resources in order to obtain efficient, cost
effective departmental an enterprise wide data processing. During mainframe
era choices were quite limited. A central machine housed both the CPU and
20
Chat Express
DATA (cards, tapes, drums and later disks). Access to these resources was
initially confined to batched runs that produced departmental reports at the
appropriate intervals. A strong central information service department ruled
the corporation. The role of the rest of the corporation limited to requesting
new or more frequent reports and to provide hand written forms from which
the central data banks were created and updated. The earliest client server
solutions therefore could best be characterized as “SLAVE-MASTER”.
Time-sharing changed the picture. Remote terminal could view and even
change the central data, subject to access permissions. And, as the central
data banks evolved in to sophisticated relational database with non-
programmer query languages, online users could formulate adhoc queries
and produce local
reports with out adding to the MIS applications software backlog. However
remote access was through dumb terminals, and the client server remained
subordinate to the Slave\Master.
Distributed Concept.
The browser specific components are designed by using the HTML standards, and
Server Pages.
21
Chat Express
COMMUNICATION OR DATABASE CONNECTIVITY TIER
the standards of higher cohesion and limited coupling for effectiveness of the
operations.
ABOUT JAVA
Initially the language was called as “oak” but it was renamed as “Java”
in 1995. The primary motivation of this language was the need for a
platform-independent (i.e., architecture neutral) language that could
be used to create software to be embedded in various consumer
electronic devices.
22
Chat Express
IMPORTANCE OF JAVA TO THE INTERNET
Java has had a profound effect on the Internet. This is because; Java
expands the Universe of objects that can move about freely in
Cyberspace. In a network, two categories of objects are transmitted
between the Server and the Personal computer. They are: Passive
information and Dynamic active programs. The Dynamic, Self-
executing programs cause serious problems in the areas of Security
and probability. But, Java addresses those concerns and by doing so,
has opened the door to an exciting new form of program called the
Applet.
FEATURES OF JAVA
Security
Every time you that you download a “normal” program, you are risking a viral
infection. Prior to Java, most users did not download executable programs
frequently, and those who did scanned them for viruses prior to execution. Most
users still worried about the possibility of infecting their systems with a virus. In
addition, another type of malicious program exists that must be guarded against.
This type of program can gather private information, such as credit card
numbers, bank account balances, and passwords. Java answers both these
concerns by providing a “firewall” between a network application and your
computer.
When you use a Java-compatible Web browser, you can safely download Java
applets without fear of virus infection or malicious intent.
23
Chat Express
Portability
The key that allows the Java to solve the security and portability problems is that
the output of Java compiler is Byte code. Byte code is a highly optimized set of
instructions designed to be executed by the Java run-time system, which is
called the Java Virtual Machine (JVM). That is, in its standard form, the JVM is an
interpreter for byte code.
Translating a Java program into byte code helps makes it much easier to run a
program in a wide variety of environments. The reason is, once the run-time
package exists for a given system, any Java program can run on it.
Although Java was designed for interpretation, there is technically nothing about
Java that prevents on-the-fly compilation of byte code into native code. Sun has
just completed its Just In Time (JIT) compiler for byte code. When the JIT
compiler is a part of JVM, it compiles byte code into executable code in real time,
on a piece-by-piece, demand basis. It is not possible to compile an entire Java
program into executable code all at once, because Java performs various run-
time checks that can be done only at run time. The JIT compiles code, as it is
needed, during execution.
Java, Virtual Machine (JVM)
Beyond the language, there is the Java virtual machine. The Java virtual
machine is an important element of the Java technology. The virtual machine
can be embedded within a web browser or an operating system. Once a piece of
Java code is loaded onto a machine, it is verified. As part of the loading process,
a class loader is invoked and does byte code verification makes sure that the
code that’s has been generated by the compiler will not corrupt the machine that
24
Chat Express
it’s loaded on. Byte code verification takes place at the end of the compilation
process to make sure that is all accurate and correct. So byte code verification is
integral to the compiling and executing of Java code.
Overall Description
J
J
Java byte av
ava
code aV
Source
M
Java .Class
Picture showing the development process of JAVA Program
Java programming uses to produce byte codes and executes them. The first box
indicates that the Java source code is located in a. Java file that is processed
with a Java compiler called javac. The Java compiler produces a file called a.
class file, which contains the byte code. The .Class file is then loaded across the
network or loaded locally on your machine into the execution environment is the
Java virtual machine, which interprets and executes the byte code.
Java Architecture
Compilation of code
When you compile the code, the Java compiler creates machine code (called byte
code) for a hypothetical machine called Java Virtual Machine (JVM). The JVM is
supposed to execute the byte code. The JVM is created for overcoming the issue
of portability. The code is written and compiled for one machine and interpreted
on all machines. This machine is called Java Virtual Machine.
25
Chat Express
Compiling and interpreting Java Source Code
P
C Java
Source Compil Interpreter
Code er (PC)
……….. Java
………..
Byte code
Macintosh
Compiler Java
……….. Interpreter
(Platform (Macintosh)
Java
indepen Interpreter
………… SPARC dent) (Sparc)
Com
piler
During run-time the Java interpreter tricks the bytecode file into
thinking that it is running on a Java Virtual Machine. In reality this
could be a Intel Pentium Windows 95 or SunSARC station running
Solaris or Apple Macintosh running system and all could receive code
from any computer through Internet and run the Applets.
Simple
Object-Oriented
26
Chat Express
approach to objects. The object model in Java is simple and easy to
extend, while simple types, such as integers, are kept as high-
performance non-objects.
Robust
27
Chat Express
JFC Overview
Sun Microsystems is leveraging the technology of Netscape
Communications, IBM, and Lighthouse Design (now owned by Sun)
to create a set of Graphical User Interface (GUI) classes that
integrate with JDK 1.1.5+, are standard with the Java ® 2 platform
and provide a more polished look and feel than the standard AWT
component set. The collection of APIs coming out of this effort,
called the Java Foundation Classes (JFC), allows developers to build
full-featured enterprise-ready applications.
JFC is composed of five APIs: AWT, Java 2D, Accessibility, Drag and
Drop, and Swing. The AWT components refer to the AWT as it
exists in JDK versions 1.1.2 and later. Java 2D is a graphics API
based on technology licensed from IBM/Taligent. It is currently
available with the Java® 2 Platform (and not usable with JDK 1.1).
The Accessibility API provides assistive technologies, like screen
magnifiers, for use with the various pieces of JFC. Drag and Drop
support is part of the next JavaBean generation, "Glasgow," and is
also available with the Java® 2 platform.
Though the Swing widgets were based heavily on IFC, the two APIs
bear little resemblance to one another from the perspective of a
developer. The look and feel of some Swing widgets and their
rendering is primarily what descended from IFC, although you may
notice some other commonalties.
The AWT 1.1 widgets and event model are still present for the
Swing widgets. However, the 1.0 event model does not work with
Swing widgets. The Swing widgets simply extend AWT by adding a
28
Chat Express
new set of components, the JComponents, and a group of related
support classes. As with AWT, Swing components are all JavaBeans
and participate in the JavaBeans event model.
29
Chat Express
javax.swing.table
The table package contains the support interfaces and classes
the Swing table component.
javax.swing.text
The text package contains the support classes for the Swing
document framework.
javax.swing.text.html.*
The text.html package contains the support classes for an HTML
version 3.2 renderer and parser.
javax.swing.text.rtf
The text.rtf package contains the support classes for a basic Rich
Text Format (RTF) renderer.
javax.swing.tree
The tree package contains the interfaces and classes which
support the Swing tree component.
javax.swing.undo
The undo package provides the support classes for implementing
undo/redo capabilities in a GUI.
javax.accessibility
The JFC Accessibility package is included with the Swing classes.
However, its usage is not discussed here.
Widgets, Widgets, Widgets
This section describes how to use the various Swing widgets. The
Swing component hierarchy is shown in two parts for comparison
with AWT. Part 1 of the component hierarchy is similar to that of
AWT. However, there are over twice as many components in Swing
as in AWT. Part 2 shows the expanded Swing component set. This
group of components appeals most to developers, as it provides a
much richer set of widgets to use.
30
Chat Express
31
Chat Express
COMPONENT HIERARCHY: PART 1--AWT SIMILAR
32
Chat Express
render the picture specified in the paintIcon() method in a
rectangle whose size cannot exceed a rectangle with an origin at
(x, y), a width of getIconWidth(), and a height of getIconHeight().
The Component parameter to paintIcon() is not usually used,
unless you need to specify additional information, such as a font or
color.
33
Chat Express
return 10;
}
}
JLabel
34
Chat Express
JButton
A JButton can be instantiated and used in a GUI just like a
java.awt.Button. It behaves like an AWT 1.1 Button, notifying
ActionListener list elements when pushed.
Magercises
6. Installing Swing and SwingSet Demonstration
7. Creating Your First JFC Application
8. Creating Buttons With Icons
AbstractButton
35
Chat Express
While the AbstractButton isn't a class you use directly, several of
the more common JComponent classes inherit much of their shared
behavior from this object. For instance, the icon usage methods
getIcon() and setIcon() come from AbstractButton. (The methods
are also available elsewhere.) Some of the other common features
are listed below:
o setMnemonic() - Add a keyboard accelerator to a text
label, use the VK_* constants from KeyEvent to specify the key
o doClick() - Programmatically, select the button
o setDisabledIcon(), setDisabledSelectedIcon(),
setPressedIcon(), setRolloverIcon(), setRolloverSelectedIcon(),
setSelectedIcon() - Change the displayed Icon, based on the
button state (in addition to setIcon())
o setVerticalAlignment(), setHorizontalAlignemnt() - Anchors
icon/text in different areas of button
o setVerticalTextPosition(), setHorizontalTextPosition() -
Positions text in different areas around icon. Both
setXXXAlignment() and setYYYTextPosition() rely on the
SwingConstants interface for the area placement settings.
Note: The upcoming Swing 1.1.1 release includes the ability to
specify label text in HTML by preceding the content with <html>.
This will allow you to have multi-line button labels without having
to customize the user interface.
JCheckBox
A JCheckBox is similar to an AWT Checkbox that is not in a
CheckboxGroup. Although Swing provides a default graphic to
signify JCheckBox selection, you also can specify your own Icon
objects for both the checked and unchecked state.
public CheckboxPanel() {
36
Chat Express
JRadioButton
37
Chat Express
In AWT, radio buttons are checkboxes that belong to the same
CheckboxGroup; which ensures that only one checkbox is selected
at a time. Swing has a separate widget called a JRadioButton. Each
JRadioButton is added to a ButtonGroup so the group behaves as a
set of radio buttons. Like CheckboxGroup, ButtonGroup is a
functional object that has no visual representation.
public RadioButtonPanel() {
// Set the layout to a GridLayout
setLayout(new GridLayout(4,1));
38
Chat Express
39
Chat Express
JTextComponents
JTextComponent is a generalized text class that contains all the
features you would expect from a simple editor. Some of its
methods include:
copy()
cut()
paste()
getSelectedText()
setSelectionStart()
setSelectionEnd()
selectAll()
replaceSelection()
getText()
setText()
setEditable()
setCaretPosition()
40
Chat Express
If you want your users to be able to see content that exceeds the
screen display area, you must place the component inside of a
JScrollPane to support scrolling to the extra content. JTextField &
JTextArea
41
Chat Express
add(textField, BorderLayout.NORTH);
add(new JScrollPane(textArea),
BorderLayout.CENTER);
add(new JScrollPane(textPane), BorderLayout.SOUTH);
}
}
JPasswordField
The JPasswordField is a JTextField that refuses to display its
contents openly. By default, the mask character is the asterisk
('*'). However, you can change this with the setEchoChar()
42
Chat Express
method. Unlike java.awt.TextField, an echo character of (char)0
does not unset the mask.
JEditorPane
The JEditorPane class is a specialized JTextComponent for
displaying and editing HTML 3.2 tags or some other format like RTF
(rich text format), as determined by the input. It is not meant to
provide a full-fledged browser, but a lightweight HTML viewer,
usually for the purpose of displaying help text. You either construct
the pane with a URL parameter (via a String or URL), or change
pages with the setPage() method. For HTML content, links within
the HTML page are traversable with the help of a HyperlinkListener.
43
Chat Express
44
Chat Express
public ScrollbarPanel() {
setLayout(new BorderLayout());
JScrollBar scrollBar1 = new JScrollBar (
JScrollBar.VERTICAL, 0, 5, 0, 100);
add(scrollBar1, BorderLayout.EAST);
JScrollBar scrollBar2 = new JScrollBar (
45
Chat Express
JScrollBar.HORIZONTAL, 0, 5, 0, 100);
add(scrollBar2, BorderLayout.SOUTH);
}
}
JComboBox
The JComboBox works like AWT's Choice component, but renames
some methods and offers an editable option. For times when a
fixed-list of choices isn't enough, you can offer a JComboBox with a
list of default choices, but still permit the entry of another value.
The nicest part about this control is that when the user presses the
key for the first letter of an entry, it changes the highlighted
selection. You can enhance this behavior by providing your own
KeySelectionManager, a public inner class of JComboBox.
46
Chat Express
add(combo1);
add(combo2);
}
}
There is one major difference between List and JList. JList doesn't
directly support scrolling. You need to place the JList within a
JScrollPane object, and let it deal with the scrolling.
47
Chat Express
}
}
Borders
The javax.swing.border package consists of several objects to draw
borders around components. They all implement the Border
interface, which consists of three methods:
o public Insets getBorderInsets(Component c)
Defines the drawable area necessary to draw the border
o public boolean isBorderOpaque()
Defines if the border area is opaque or transparent
o public void paintBorder (Component c, Graphics g, int x,
int y, int width, int height)
Defines how to draw the border within the specified area. The
routine should only draw into the area requested with
getBorderInsets().
The border behavior is defined for JComponent, so all subclasses
inherit the behavior.
Swing provides nine borders, and you can create your own if none
of them meets your needs:
o AbstractBorder - An abstract class that implements the
Border interface, but does nothing
o BevelBorder - A 3D border that may be raised or lowered
o CompoundBorder - A border that can nest multiple borders
o EmptyBorder - A border where you specify the reserved
space for an undrawn border
o EtchedBorder - A border that appears as a groove, instead
of raised or lowered
o LineBorder - A border for single color borders, with
arbitrary thickness
o MatteBorder - A border that permits tiling of an icon or
color
o SoftBevelBorder - A 3D border with softened corners
o TitledBorder - A border that permits title strings in
arbitrary locations
You can create a border object directly from the appropriate class
constructor or ask a BorderFactory to create the border for you,
with methods like createBevelBorder(type) and
48
Chat Express
createTitledBorder("TItle"). When using BorderFactory, multiple
requests to create the same border return the same object.
public BorderPanel() {
49
Chat Express
50
Chat Express
add(b);
You can change the border of any JComponent object with the
setBorder() method. Magercise
5. Using Borders
Menus
The menuing model used in Swing is nearly identical to that used in
AWT. There are three key exceptions:
o The menu classes (JMenuItem, JCheckBoxMenuItem,
JMenu, and JMenuBar) are all subclasses of JComponent. They
are not off in their own independent class hierarchy. As a result
of this, you can place a JMenuBar within any Container,
including Applet. [The JApplet class has a setJMenuBar()
method to add a JMenuBar.]
o There is a new menu class, JRadioButtonMenuItem, to
provide a set of mutually exclusive checkboxes on a menu,
when placed within a ButtonGroup.
o Also, you can associate an Icon object with any
JMenuItem.
51
Chat Express
public MenuTester() {
super ("Menu Example");
52
Chat Express
jmb.add (file);
jmb.add (choice);
setJMenuBar (jmb);
}
}
53
Chat Express
JSeparator
The JSeparator object is the menu separator control. The image
below shows the separator under the File menu from the example
above.
Because Swing menu objects are truly components, you can use
JSeparator outside of menus, too. However, normally you just add
them to a JMenu with addSeparator(). JPopupMenu
54
Chat Express
popup.addSeparator();
popup.add (item = new JMenuItem ("Select All"));
popup.setInvoker (this);
addMouseListener (new MouseAdapter() {
public void mousePressed (MouseEvent e) {
if (e.isPopupTrigger()) {
popup.show (e.getComponent(),
e.getX(), e.getY());
}
}
public void mouseReleased (MouseEvent e) {
if (e.isPopupTrigger()) {
popup.show (e.getComponent(),
e.getX(), e.getY());
}
}
});
}
}
The other difference of the JFrame class is shared with the JWindow
and JDialog classes. No longer do you just add() components to
each directly or setLayout() to change the LayoutManager. Now,
you must get what's called a content pane, then add components
to that or change its layout.
55
Chat Express
The reason you have to get a content pane is because the inside of
a window is now composed of a JRootPane, which no longer shields
you from the inner workings of the Window, as AWT did.
56
Chat Express
o DISPOSE_ON_CLOSE: When user tries to close window, it
will be disposed.
Both HIDE_ON_CLOSE and DISPOSE_ON_CLOSE perform their
operations last, in case an event listener needs to use the
information from the closing event. JRootPane
Container getContentPane();
setContentPane (Container);
Component getGlassPane();
setGlassPane (Component);
JLayeredPane getLayeredPane();
setLayeredPane (JLayeredPane);
JMenuBar getMenuBar();
setMenuBar (JMenuBar);
JLayeredPane
57
Chat Express
The JLayeredPane container keeps its children in layers to define an
order to paint its components. When you add a component to the
pane, you specify which layer you want it in:
layeredPane.add (component, new Integer(5));
The default layer is the value JLayeredPane.DEFAULT_LAYER. You
can add or subtract values from this value to have things appear
above or below, layerwise. The LayoutManager of the pane
determines what happens with the layers. Using FlowLayout or
GridLayout as the layout only reorders the components as they are
added; they will not be drawn on top of each other. For an example
of actually drawing overlaid components, see the examples
subdirectory that comes with the Swing release. Swing in Applets
58
Chat Express
JTabbedPane
The JTabbedPane component offers a tabbed control for quick
accessibility to multiple panels. If you ever tried to use CardLayout
in JDK 1.0/1.1, you'll appreciate this: JTabbedPane adds the
necessary support for changing from one card to the next. After
creating the control, you add cards to it with the addTab() method.
59
Chat Express
There are three forms for the addTab() method. One offers a quick
way to associate a JToolTip to a tab, while the others only permit
text, an Icon, or both. Any Component subclass can be the object
added to each card.
o addTab(String title, Component component) - Create new
tab with title as tab label and component shown within tab when
selected.
o addTab(String title, Icon icon, Component component) -
Adds an options icon to be associated with the title for the tab.
Either may be null.
o addTab(String title, Icon icon, Component component,
String tip) - Adds tip as the tooltip for the tab.
JSplitPane
The JSplitPane control offers user-controlled resizing of two
components within a container.
60
Chat Express
You can place a JSplitPane within a JSplitPane for control of more
then two components, and, you can control whether the splitting
happens vertically or horizontally.
Note that the splitter bar will not move past the minimumSize of
either component if it can avoid it. In many cases it is desirable to
call the following:
comp.setMinimumSize(new Dimension(0,0));
on each component to allow full movement of the splitter bar.
61
Chat Express
public JSplitPanel() {
setLayout(new BorderLayout());
JTree tree = new JTree();
String[] items = {"a", "two", "three",
"four", "five", "six", "seven"};
JList list = new JList(items);
JScrollPane left = new JScrollPane(tree);
JScrollPane right = new JScrollPane(list);
left.setMinimumSize(new Dimension(0,0));
right.setMinimumSize(new Dimension(0,0));
JSplitPane pane = new JSplitPane(
JSplitPane.HORIZONTAL_SPLIT, left, right);
pane.setDividerLocation(0.5);
pane.setOneTouchExpandable(true);
add(pane, BorderLayout.CENTER);
}
}
Swing Layouts
There are four primary Swing layout managers, two are built into
components (ScrollPaneLayout and ViewportLayout) and the
remaining two (BoxLayout and OverlayLayout) are used like the
ones from java.awt. The BoxLayout also happens to be built into
the Box component. BoxLayout
62
Chat Express
BoxLayout looks at its Y-alignment property or X-alignment
property to determine how to place it within the available space. By
default, JComponent objects inherit an alignment of 0.5 indicating
that they will be centered. You can override the getAlignmentX()
and getAlignmentY() methods of Container to specify a different
default alignment. JButton for instance specifies left alignment.
BoxLayoutTest() {
// Set the layout to a y-axis BoxLayout
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
63
Chat Express
add(new JLabel("Button:"));
add(button);
}}
Box
The Box class is a convenience container whose default layout
manager is a BoxLayout. Rather than subclassing JPanel as above,
the previous example could have subclassed the Box class. In
addition to being a BoxLayout container, Box has some very useful
static methods for arranging components in a BoxLayout. These
methods create non-visual components that act as fillers and
spacers.
Returns a fixed height component used
createVerticalStrut(int)
for spacing
Returns a fixed width component used
createHorizontalStrut(int)
for spacing
Returns a component whose height
createVerticalGlue() expands to absorb excess space
between components
Returns a component whose width
createHorizontalGlue() expands to absorb excess space
between components
Returns a component whose height will
createGlue() expand for a y-axis box and whose
width will expand for an x-axis Box
Returns a fixed height, fixed width
createRigidArea(Dimension)
component used for spacing
Now, rather than using labels to space components out as above,
you could use struts and glue:
64
Chat Express
The struts will appear as top and bottom margins and the glue will
expand to fill space when the Box is heightened. Magercise
7. Using BoxLayout
ScrollPaneLayout
The ScrollPaneLayout is the layout manager used by a JScrollPane.
You do not need to create one, nor associate it to the JScrollPane.
65
Chat Express
That is done for you automatically. The layout defines nine different
areas for the JScrollPane:
o one JViewport - in the center for the content
o two JScrollBar objects - one each for horizontal and
vertical scrolling
o two JViewport objects - one for a column headers, the
other row
o four Component objects - one for each of the corners
The JScrollPane constants to specify the corners are:
LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER,
UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER.
The center viewport portion of this layout is of primary interest for
simple layouts. A JViewport is itself a container object that can hold
components. This allows for some very flexible arrangements.
JViewport contains its own layout manager, ViewportLayout.
ViewportLayout
66
Chat Express
67
Chat Express
In the functional abstraction, the main modules to taking the
details and computing for further actions. In data abstraction it
provides some services.
Design Objectives
68
Chat Express
This construction turns out to be a powerful design feature. It
encourages reuse rather than redesign. Because your keyboard's keys
were designed that way, it's possible to reuse the button mechanism
design, and replace the key tops to create a new key rather than
designing each key from scratch substantial savings in design effort
and time.
That's all well and good, but you're probably wondering how this
relates to the Swing user interface components in the Java Foundation
Classes (JFC). Well, I'll tell you.
While the MVC design pattern is typically used for constructing entire
user interfaces, the designers of the JFC used it as the basis for each
individual Swing user interface component. Each user interface
component (whether a table, button, or scrollbar) has a model, a view,
and a controller. Furthermore, the model, view, and controller pieces
can change, even while the component is in use. The result is a user
interface toolkit of almost unmatched flexibility.
69
Chat Express
The model is the piece that represents the state and low-level behavior
of the component. It manages the state and conducts all
transformations on that state. The model has no specific knowledge of
either its controllers or its views. The system itself maintains links
between model and views and notifies the views when the model
changes state.
The view is the piece that manages the visual display of the state
represented by the model. A model can have more than one view, but
that is typically not the case in the Swing set.
The controller is the piece that manages user interaction with the
model. It provides the mechanism by which changes are made to the
state of the model.
Using the keyboard key example, the model corresponds to the key's
mechanism, and the view and controller correspond to the key's
façade.
70
Chat Express
71
Chat Express
Function specification
Desig
Behavioral specification n
Procedural design
Test
72
Chat Express
Modularity
Verification
Abstraction is used to construct solutions to problems without having
to take account of the intricate details of the various component sub-
programs. Abstraction allows system designer to make step-wise
refinements by which attach stage of the design unnecessary details
annunciate with representation or implementation may be hidden from
the surrounding environment.
73
Chat Express
A button in detail
To better understand how the MVC pattern relates to Swing user
interface components, let's delve deeper in the Swing set. Just as I did
last month, I'll use the ubiquitous button component as a reference.
The model
74
Chat Express
• Query internal state
• Fire events
The behavior of the view and controller in the button illustration above
are captured by the ButtonUI interface. Classes that implement this
interface are responsible for both creating a button's visual
representation and handling user input provided via the keyboard and
mouse. Its methods can be grouped into three categories -- those
that:
• Paint
The scaffolding
75
Chat Express
Because the component classes are subclasses of class Component, a
programmer can freely mix Swing components with regular AWT
components. However, because the Swing set contains components
that functionally mimic the regular AWT components, mixing the two is
usually not necessary.
A concrete example
The most obvious place to begin is with the code for the button
component itself, because this is the class that most programmers will
work with.
76
Chat Express
restrictions. The output design relays on input, which is used to the
output. Hence input design needs some special attention.
UML Diagrams:
77
Chat Express
78
Chat Express
79
Chat Express
During the testing process the software is worked with some particular
test cases and the output of the test cases are analyzed whether the
software is working according to the expectations or not.
80
Chat Express
Since the errors in the software can be
injured at any stage. So, we have to carry out the testing process at
different levels during the development. The basic levels of testing are
Unit, Integration, System and Acceptance Testing.
The Unit Testing is carried out on coding. Here different modules are
tested against the specifications produced during design for the
modules. In case of integration testing different tested modules are
combined into sub systems and tested in case of the system testing
the full software is tested and in the next level of testing the system is
tested with user requirement document prepared during SRS.
81
Chat Express
Although there is one test plan for entire
project test cases have to be specified separately for each test case.
Test case specification gives for each item to be tested. All test cases
and outputs expected for those test cases.
Each module was tested against required functionally and test cases
were developed to test the boundary values.
82
Chat Express
83
Chat Express
This project is developed using JAVA, JFC-Swing and AWT. By using this
application we can communicate with different people using different
of channels across different departments in our organization. It saves
our employees and company time and resources. By this lot of
workload will be reduced to the each employee to communicate with
other employee and get things early. This application is very useful for
Administrating efficient user friendly communication system. It
provides extendibility also. So you can add your modules to the system
whenever there is a change in business logic or new business units are
entered. This reduces the physical work, time as well as money saved.
The time for sending the problems and getting the solutions is
considerably reduced. All the features are implemented and developed
as per the requirements.
84
Chat Express
85
Chat Express
86