Java Reference
In-Depth Information
tbp
.
addTab
(
"Aliases"
,
alb
=
new
new
AliasBean
());
tbp
.
addTab
(
"List sending"
,
new
new
JLabel
(
"Under construction"
,
JLabel
.
CENTER
));
add
(
BorderLayout
.
SOUTH
,
quitButton
=
new
new
JButton
(
"Exit"
));
// System.out.println("Leaving Constructor");
}
/** "main program" method - run the program */
public
public static
static
void
void
main
(
String
[]
av
)
throws
throws
Exception
{
final
final
JFrame f
=
new
new
JFrame
(
"MailClient"
);
// Start by checking that the javax.mail package is installed!
try
try
{
Class
.
forName
(
"javax.mail.Session"
);
}
catch
catch
(
ClassNotFoundException cnfe
) {
JOptionPane
.
showMessageDialog
(
f
,
"Sorry, the javax.mail package was not found\n("
+
cnfe
+
")"
,
"Error"
,
JOptionPane
.
ERROR_MESSAGE
);
return
return
;
}
// create a MailClient object
MailClient comp
;
iif
(
av
.
length
==
0
)
comp
=
new
new
MailClient
();
else
else
comp
=
new
new
MailClient
(
av
[
0
]);
f
.
getContentPane
().
add
(
comp
);
// Set up action handling for GUI
comp
.
quitButton
.
addActionListener
(
new
new
ActionListener
() {
public
public
void
void
actionPerformed
(
ActionEvent e
) {
f
.
setVisible
(
false
false
);
f
.
dispose
();
System
.
exit
(
0
);
}
});
f
.
addWindowListener
(
new
new
WindowAdapter
() {
public
public
void
void
windowClosing
(
WindowEvent e
) {
f
.
setVisible
(
false
false
);
f
.
dispose
();
System
.
exit
(
0
);
}
});