i need help
Khalaf/.classpath
Khalaf/.project
Khalaf org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature
Khalaf/.settings/org.eclipse.jdt.core.prefs
eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.7
Khalaf/bin/StackDemo.KhalafStack1453995316712.html
Khalaf/bin/StackDemo.KhalafStack1453995269932.html
Khalaf/bin/java.policy.applet
/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ /* DO NOT EDIT */ grant { permission java.security.AllPermission; };
Khalaf/bin/StackModel/StackEdit.class
package StackModel; public abstract synchronized class StackEdit extends javax.swing.undo.AbstractUndoableEdit { protected ArrayStack model; public void StackEdit(); public abstract String excute(); }
Khalaf/bin/StackModel/StackADT.class
package StackModel; public abstract interface StackADT { public abstract void push(Object); public abstract Object pop(); public abstract Object peek(); public abstract boolean isEmpty(); public abstract int size(); public abstract String toString(); }
Khalaf/bin/StackModel/PushEdit.class
package StackModel; public synchronized class PushEdit extends StackEdit { private String input; public void PushEdit(ArrayStack, String); public String excute(); public void redo() throws javax.swing.undo.CannotRedoException; public void undo() throws javax.swing.undo.CannotUndoException; }
Khalaf/bin/StackModel/PopEdit.class
package StackModel; public synchronized class PopEdit extends StackEdit { String popped; public void PopEdit(ArrayStack); public String excute(); public void redo() throws javax.swing.undo.CannotRedoException; public void undo() throws javax.swing.undo.CannotUndoException; }
Khalaf/bin/StackModel/ArrayStack.class
package StackModel; public synchronized class ArrayStack implements StackADT { private final int DEFAULT_CAPACITY; private int top; private Object[] stack; public void ArrayStack(); public void ArrayStack(int); public void push(Object); public Object pop() throws exception.EmptyCollectionException; public Object peek() throws exception.EmptyCollectionException; public boolean isEmpty(); public int size(); public String toString(); private void expandCapacity(); void pop(String); void push(); }
Khalaf/bin/StackDemo/KhalafStack$15.class
package StackDemo; synchronized class KhalafStack$15 implements java.awt.event.ActionListener { void KhalafStack$15(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$2.class
package StackDemo; synchronized class KhalafStack$2 implements java.awt.event.ActionListener { void KhalafStack$2(KhalafStack, String); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$11.class
package StackDemo; synchronized class KhalafStack$11 implements java.awt.event.ActionListener { void KhalafStack$11(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$8.class
package StackDemo; synchronized class KhalafStack$8 implements java.awt.event.ActionListener { void KhalafStack$8(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$4.class
package StackDemo; synchronized class KhalafStack$4 implements java.awt.event.ActionListener { void KhalafStack$4(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$3.class
package StackDemo; synchronized class KhalafStack$3 extends java.awt.event.KeyAdapter { void KhalafStack$3(KhalafStack); public void keyTyped(java.awt.event.KeyEvent); }
Khalaf/bin/StackDemo/KhalafStack.class
package StackDemo; public synchronized class KhalafStack extends javax.swing.JApplet { private javax.swing.undo.UndoManager undoManager; private StackModel.ArrayStack myStack; private javax.swing.JMenuItem aboutMenu; private javax.swing.JLabel addLabel; private javax.swing.JCheckBoxMenuItem arabicMenu; private javax.swing.JCheckBoxMenuItem boldMenu; private javax.swing.JMenu changeLangMenu; private javax.swing.JTextArea contentTextArea; private javax.swing.JMenuItem decreaseMenu; private javax.swing.JMenu editMenu; private javax.swing.JButton emptyButton; private javax.swing.JRadioButtonMenuItem englishMenu; private javax.swing.JMenu fileMenu; private javax.swing.JMenu fontMenu; private javax.swing.JMenu fontSizeMenu; private javax.swing.JMenu fontStyleMenu; private javax.swing.JMenu helpMenu; private javax.swing.JMenuItem increaseMenu; private javax.swing.JTextField inputTextField; private javax.swing.JCheckBoxMenuItem italicMenu; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextArea logTextArea; private javax.swing.JMenuBar menuBar; private javax.swing.JButton peekButton; private javax.swing.JButton popButton; private javax.swing.JButton pushButton; private javax.swing.JMenuItem redoMenu; private javax.swing.JButton sizeButton; private javax.swing.JCheckBoxMenuItem spanishMenu; private javax.swing.JCheckBoxMenuItem swedishMenu; private javax.swing.JMenuItem tutorialMenu; private javax.swing.JMenuItem undoMenu; private String fontID; private int fontStyle; private int fontSize; private String language; public void KhalafStack(); public void init(); private void customeInit(); private void setBtnStatus(); private boolean canRedo(); public void setCurrentFont(String); private void initComponents(); private void pushButtonActionPerformed(java.awt.event.ActionEvent); private void popButtonActionPerformed(java.awt.event.ActionEvent); private void spanishMenuActionPerformed(java.awt.event.ActionEvent); private void undoMenuActionPerformed(java.awt.event.ActionEvent); private void redoMenuActionPerformed(java.awt.event.ActionEvent); private void boldMenuActionPerformed(java.awt.event.ActionEvent); private void italicMenuActionPerformed(java.awt.event.ActionEvent); private void increaseMenuActionPerformed(java.awt.event.ActionEvent); private void decreaseMenuActionPerformed(java.awt.event.ActionEvent); private void englishMenuActionPerformed(java.awt.event.ActionEvent); private void swedishMenuActionPerformed(java.awt.event.ActionEvent); private void arabicMenuActionPerformed(java.awt.event.ActionEvent); private void tutorialMenuActionPerformed(java.awt.event.ActionEvent); private void aboutMenuActionPerformed(java.awt.event.ActionEvent); private void peekButtonActionPerformed(java.awt.event.ActionEvent); private void sizeButtonActionPerformed(java.awt.event.ActionEvent); private void emptyButtonActionPerformed(java.awt.event.ActionEvent); private void KeyTyped(java.awt.event.KeyEvent); private void bindFont(); private void bindLanguage(); }
Khalaf/bin/StackDemo/KhalafStack$13.class
package StackDemo; synchronized class KhalafStack$13 implements java.awt.event.ActionListener { void KhalafStack$13(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$6.class
package StackDemo; synchronized class KhalafStack$6 implements java.awt.event.ActionListener { void KhalafStack$6(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$1.class
package StackDemo; synchronized class KhalafStack$1 implements Runnable { void KhalafStack$1(KhalafStack); public void run(); }
Khalaf/bin/StackDemo/KhalafStack$19.class
package StackDemo; synchronized class KhalafStack$19 implements java.awt.event.ActionListener { void KhalafStack$19(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$7.class
package StackDemo; synchronized class KhalafStack$7 implements java.awt.event.ActionListener { void KhalafStack$7(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$9.class
package StackDemo; synchronized class KhalafStack$9 implements java.awt.event.ActionListener { void KhalafStack$9(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$14.class
package StackDemo; synchronized class KhalafStack$14 implements java.awt.event.ActionListener { void KhalafStack$14(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$12.class
package StackDemo; synchronized class KhalafStack$12 implements java.awt.event.ActionListener { void KhalafStack$12(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$18.class
package StackDemo; synchronized class KhalafStack$18 implements java.awt.event.ActionListener { void KhalafStack$18(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$16.class
package StackDemo; synchronized class KhalafStack$16 implements java.awt.event.ActionListener { void KhalafStack$16(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$17.class
package StackDemo; synchronized class KhalafStack$17 implements java.awt.event.ActionListener { void KhalafStack$17(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$20.class
package StackDemo; synchronized class KhalafStack$20 implements java.awt.event.ActionListener { void KhalafStack$20(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$10.class
package StackDemo; synchronized class KhalafStack$10 implements java.awt.event.ActionListener { void KhalafStack$10(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/bin/StackDemo/KhalafStack$5.class
package StackDemo; synchronized class KhalafStack$5 implements java.awt.event.ActionListener { void KhalafStack$5(KhalafStack); public void actionPerformed(java.awt.event.ActionEvent); }
Khalaf/src/StackModel/StackEdit.java
Khalaf/src/StackModel/StackEdit.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
StackModel
;
import
javax
.
swing
.
undo
.
AbstractUndoableEdit
;
/**
*
*
@author
Yousef
*/
public
abstract
class
StackEdit
extends
AbstractUndoableEdit
{
protected
ArrayStack
<
String
>
model
=
null
;
public
abstract
String
excute
();
}
Khalaf/src/StackModel/StackADT.java
Khalaf/src/StackModel/StackADT.java
package
StackModel
;
/**
*
@author
Lewis and Chase
*
* Defines the interface to a stack data structure.
*/
public
interface
StackADT
<
T
>
{
/** Adds one element to the top of this stack.
*
@param
element element to be pushed onto stack
*/
public
void
push
(
T element
);
/** Removes and returns the top element from this stack.
*
@return
T element removed from the top of the stack
*/
public
T pop
();
/** Returns without removing the top element of this stack.
*
@return
T element on top of the stack
*/
public
T peek
();
/** Returns true if this stack contains no elements.
*
@return
boolean whether or not this stack is empty
*/
public
boolean
isEmpty
();
/** Returns the number of elements in this stack.
*
@return
int number of elements in this stack
*/
public
int
size
();
/** Returns a string representation of this stack.
*
@return
String representation of this stack
*/
public
String
toString
();
}
Khalaf/src/StackModel/PushEdit.java
Khalaf/src/StackModel/PushEdit.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
StackModel
;
import
javax
.
swing
.
undo
.
CannotRedoException
;
import
javax
.
swing
.
undo
.
CannotUndoException
;
/**
*
*
@author
yousef
*/
public
class
PushEdit
extends
StackEdit
{
private
String
input
;
public
PushEdit
(
ArrayStack
<
String
>
iniModel
,
String
iniInput
){
input
=
iniInput
;
model
=
iniModel
;
}
@
Override
public
String
excute
(){
model
.
push
(
input
);
return
null
;
}
public
void
redo
()
throws
CannotRedoException
{
model
.
push
(
input
);
}
public
void
undo
()
throws
CannotUndoException
{
if
(
!
model
.
isEmpty
())
model
.
pop
();
}
}
Khalaf/src/StackModel/PopEdit.java
Khalaf/src/StackModel/PopEdit.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
StackModel
;
import
javax
.
swing
.
undo
.
CannotRedoException
;
import
javax
.
swing
.
undo
.
CannotUndoException
;
/**
*
*
@author
yousef
*/
public
class
PopEdit
extends
StackEdit
{
// private final String input;
String
popped
;
public
PopEdit
(
ArrayStack
<
String
>
iniModel
)
{
model
=
iniModel
;
}
@
Override
public
String
excute
(){
popped
=
model
.
pop
();
return
popped
;
}
public
void
redo
()
throws
CannotRedoException
{
if
(
!
model
.
isEmpty
())
{
model
.
pop
();
}
}
public
void
undo
()
throws
CannotUndoException
{
// if(!model.isEmpty())
model
.
push
(
popped
);
}
}
Khalaf/src/StackModel/ArrayStack.java
Khalaf/src/StackModel/ArrayStack.java
package
StackModel
;
import
StackModel
.
exception
.
EmptyCollectionException
;
/**
*
@author
Lewis and Chase
*
* Represents an array implementation of a stack.
*/
public
class
ArrayStack
<
T
>
implements
StackADT
<
T
>
{
/**
* constant to represent the default capacity of the array
*/
private
final
int
DEFAULT_CAPACITY
=
100
;
//add
/**
* int that represents both the number of elements and the next available
* position in the array
*/
private
int
top
;
/**
* array of generic elements to represent the stack
*/
private
T
[]
stack
;
/**
* Creates an empty stack using the default capacity.
*/
public
ArrayStack
()
{
top
=
0
;
stack
=
(
T
[])
(
new
Object
[
DEFAULT_CAPACITY
]);
}
/**
* Creates an empty stack using the specified capacity.
*
*
@param
initialCapacity
* represents the specified capacity
*/
public
ArrayStack
(
int
initialCapacity
)
{
top
=
0
;
stack
=
(
T
[])
(
new
Object
[
initialCapacity
]);
}
/**
* Adds the specified element to the top of this stack, expanding the
* capacity of the stack array if necessary.
*
*
@param
element
* generic element to be pushed onto stack
*/
public
void
push
(
T element
)
{
// the incoming element should be stored in the top of the stack
if
(
size
()
==
stack
.
length
)
{
expandCapacity
();}
stack
[
top
++
]
=
element
;
// the top counter should be incremented to show the top has moved up
}
/**
* Removes the element at the top of this stack and returns a reference to
* it. Throws an EmptyCollectionException if the stack is empty.
*
*
@return
T element removed from top of stack
*
@throws
EmptyCollectionException
* if a pop is attempted on empty stack
*/
public
T pop
()
throws
EmptyCollectionException
{
if
(
isEmpty
())
throw
new
EmptyCollectionException
(
"Stack"
);
T result
=
stack
[
--
top
];
stack
[
top
]
=
null
;
return
result
;
}
/**
* Returns a reference to the element at the top of this stack. The element
* is not removed from the stack. Throws an EmptyCollectionException if the
* stack is empty.
*
*
@return
T element on top of stack
*
@throws
EmptyCollectionException
* if a peek is attempted on empty stack
*/
public
T peek
()
throws
EmptyCollectionException
//add
{
if
(
isEmpty
())
{
throw
new
EmptyCollectionException
(
"Stack"
);}
return
stack
[
top
-
1
];
}
/**
* Returns true if this stack is empty and false otherwise.
*
*
@return
boolean true if this stack is empty, false otherwise
*/
public
boolean
isEmpty
()
{
if
(
top
==
0
)
return
true
;
else
return
false
;
}
/**
* Returns the number of elements in this stack.
*
*
@return
int the number of elements in this stack
*/
public
int
size
()
{
return
top
;
}
/**
* Returns a string representation of this stack.
*
*
@return
String representation of this stack
*/
public
String
toString
()
{
String
result
=
""
;
for
(
int
scan
=
0
;
scan
<
top
;
scan
++
)
result
=
result
+
stack
[
scan
].
toString
()
+
"\n"
;
return
result
;
}
/**
* Creates a new array to store the contents of this stack with twice the
* capacity of the old one.
*/
private
void
expandCapacity
()
{
T
[]
larger
=
(
T
[])
(
new
Object
[
stack
.
length
*
2
]);
for
(
int
index
=
0
;
index
<
stack
.
length
;
index
++
)
larger
[
index
]
=
stack
[
index
];
stack
=
larger
;
}
void
pop
(
String
input
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
}
void
push
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
//To change body of generated methods, choose Tools | Templates.
}
}
Khalaf/src/StackDemo/KhalafStack.java
Khalaf/src/StackDemo/KhalafStack.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
StackDemo
;
import
StackModel
.
ArrayStack
;
import
StackModel
.
PopEdit
;
import
StackModel
.
PushEdit
;
import
java
.
awt
.
Container
;
import
java
.
awt
.
Font
;
import
java
.
awt
.
Frame
;
import
java
.
awt
.
GraphicsEnvironment
;
import
java
.
awt
.
event
.
ActionEvent
;
import
java
.
awt
.
event
.
ActionListener
;
import
java
.
awt
.
event
.
KeyEvent
;
import
java
.
util
.
Locale
;
import
javax
.
swing
.
ImageIcon
;
import
javax
.
swing
.
JMenuItem
;
import
javax
.
swing
.
JOptionPane
;
import
static
javax
.
swing
.
JOptionPane
.
INFORMATION_MESSAGE
;
import
javax
.
swing
.
undo
.
UndoManager
;
/**
*
*
@author
Khalaf
*/
public
class
KhalafStack
extends
javax
.
swing
.
JApplet
{
/**
* Initializes the applet KhalafStack
*/
@
Override
public
void
init
()
{
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try
{
for
(
javax
.
swing
.
UIManager
.
LookAndFeelInfo
info
:
javax
.
swing
.
UIManager
.
getInstalledLookAndFeels
())
{
if
(
"Nimbus"
.
equals
(
info
.
getName
()))
{
javax
.
swing
.
UIManager
.
setLookAndFeel
(
info
.
getClassName
());
break
;
}
}
}
catch
(
ClassNotFoundException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
KhalafStack
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
InstantiationException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
KhalafStack
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
IllegalAccessException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
KhalafStack
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
javax
.
swing
.
UnsupportedLookAndFeelException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
KhalafStack
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
//</editor-fold>
/* Create and display the applet */
try
{
java
.
awt
.
EventQueue
.
invokeAndWait
(
new
Runnable
()
{
public
void
run
()
{
initComponents
();
customeInit
();
}
});
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
}
private
void
customeInit
()
{
setBtnStatus
();
popButton
.
setEnabled
(
false
);
String
[]
fonts
=
new
String
[]{
"Arial"
,
"Times New Roman"
,
"David"
,
"Arial Black"
};
for
(
final
String
fName
:
fonts
)
{
JMenuItem
fMenu
=
new
JMenuItem
(
fName
);
fMenu
.
addActionListener
(
new
ActionListener
()
{
@
Override
public
void
actionPerformed
(
ActionEvent
e
)
{
setCurrentFont
(
fName
);
}
});
fontMenu
.
add
(
fMenu
);
}
this
.
fontID
=
pushButton
.
getFont
().
getFontName
();
this
.
fontStyle
=
pushButton
.
getFont
().
getStyle
();
this
.
fontSize
=
pushButton
.
getFont
().
getSize
();
}
private
void
setBtnStatus
(){
undoMenu
.
setEnabled
(
undoManager
.
canUndo
());
redoMenu
.
setEnabled
(
canRedo
());
pushButton
.
setEnabled
(
inputTextField
.
getText
()
==
""
);
popButton
.
setEnabled
(
!
myStack
.
isEmpty
());
peekButton
.
setEnabled
(
!
myStack
.
isEmpty
());
}
private
boolean
canRedo
(){
try
{
undoManager
.
redo
();
undoManager
.
undo
();
}
catch
(
Exception
ex
){
return
false
;
}
return
true
;
}
public
void
setCurrentFont
(
String
fontName
)
{
this
.
fontID
=
fontName
;
bindFont
();
}
@
SuppressWarnings
(
"unchecked"
)
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private
void
initComponents
()
{
jScrollPane1
=
new
javax
.
swing
.
JScrollPane
();
contentTextArea
=
new
javax
.
swing
.
JTextArea
();
inputTextField
=
new
javax
.
swing
.
JTextField
();
addLabel
=
new
javax
.
swing
.
JLabel
();
pushButton
=
new
javax
.
swing
.
JButton
();
popButton
=
new
javax
.
swing
.
JButton
();
jScrollPane2
=
new
javax
.
swing
.
JScrollPane
();
logTextArea
=
new
javax
.
swing
.
JTextArea
();
peekButton
=
new
javax
.
swing
.
JButton
();
sizeButton
=
new
javax
.
swing
.
JButton
();
emptyButton
=
new
javax
.
swing
.
JButton
();
menuBar
=
new
javax
.
swing
.
JMenuBar
();
fileMenu
=
new
javax
.
swing
.
JMenu
();
changeLangMenu
=
new
javax
.
swing
.
JMenu
();
englishMenu
=
new
javax
.
swing
.
JRadioButtonMenuItem
();
spanishMenu
=
new
javax
.
swing
.
JCheckBoxMenuItem
();
swedishMenu
=
new
javax
.
swing
.
JCheckBoxMenuItem
();
arabicMenu
=
new
javax
.
swing
.
JCheckBoxMenuItem
();
editMenu
=
new
javax
.
swing
.
JMenu
();
undoMenu
=
new
javax
.
swing
.
JMenuItem
();
redoMenu
=
new
javax
.
swing
.
JMenuItem
();
fontMenu
=
new
javax
.
swing
.
JMenu
();
fontStyleMenu
=
new
javax
.
swing
.
JMenu
();
boldMenu
=
new
javax
.
swing
.
JCheckBoxMenuItem
();
italicMenu
=
new
javax
.
swing
.
JCheckBoxMenuItem
();
fontSizeMenu
=
new
javax
.
swing
.
JMenu
();
increaseMenu
=
new
javax
.
swing
.
JMenuItem
();
decreaseMenu
=
new
javax
.
swing
.
JMenuItem
();
helpMenu
=
new
javax
.
swing
.
JMenu
();
tutorialMenu
=
new
javax
.
swing
.
JMenuItem
();
aboutMenu
=
new
javax
.
swing
.
JMenuItem
();
contentTextArea
.
setEditable
(
false
);
contentTextArea
.
setBackground
(
new
java
.
awt
.
Color
(
153
,
153
,
255
));
contentTextArea
.
setColumns
(
20
);
contentTextArea
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
contentTextArea
.
setRows
(
5
);
contentTextArea
.
setToolTipText
(
"Display stack elements"
);
contentTextArea
.
setBorder
(
new
javax
.
swing
.
border
.
MatteBorder
(
null
));
jScrollPane1
.
setViewportView
(
contentTextArea
);
inputTextField
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
inputTextField
.
setForeground
(
new
java
.
awt
.
Color
(
204
,
0
,
0
));
inputTextField
.
setToolTipText
(
"The text that you want to push to the stack"
);
inputTextField
.
setBorder
(
new
javax
.
swing
.
border
.
MatteBorder
(
null
));
inputTextField
.
addKeyListener
(
new
java
.
awt
.
event
.
KeyAdapter
()
{
public
void
keyTyped
(
java
.
awt
.
event
.
KeyEvent
evt
)
{
KeyTyped
(
evt
);
}
});
addLabel
.
setBackground
(
new
java
.
awt
.
Color
(
153
,
153
,
255
));
addLabel
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
java
.
util
.
ResourceBundle
bundle
=
java
.
util
.
ResourceBundle
.
getBundle
(
"StackDemo/language"
);
// NOI18N
addLabel
.
setText
(
bundle
.
getString
(
"addtoStack"
));
// NOI18N
addLabel
.
setBorder
(
new
javax
.
swing
.
border
.
MatteBorder
(
null
));
addLabel
.
setOpaque
(
true
);
pushButton
.
setBackground
(
new
java
.
awt
.
Color
(
255
,
204
,
153
));
pushButton
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
pushButton
.
setMnemonic
(
KeyEvent
.
VK_ENTER
);
pushButton
.
setText
(
bundle
.
getString
(
"push"
));
// NOI18N
pushButton
.
setToolTipText
(
"Click \"Push\" to push an element in the stack\n or Press Alt+Enter"
);
pushButton
.
setBorder
(
javax
.
swing
.
BorderFactory
.
createLineBorder
(
new
java
.
awt
.
Color
(
0
,
0
,
0
)));
pushButton
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
pushButtonActionPerformed
(
evt
);
}
});
popButton
.
setBackground
(
new
java
.
awt
.
Color
(
255
,
204
,
153
));
popButton
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
popButton
.
setMnemonic
(
KeyEvent
.
VK_P
);
popButton
.
setText
(
bundle
.
getString
(
"pop"
));
// NOI18N
popButton
.
setToolTipText
(
"Click \"Pop\" to pop an element from the stack \nor press Alt+P"
);
popButton
.
setActionCommand
(
""
);
popButton
.
setBorder
(
javax
.
swing
.
BorderFactory
.
createLineBorder
(
new
java
.
awt
.
Color
(
0
,
0
,
0
)));
popButton
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
popButtonActionPerformed
(
evt
);
}
});
logTextArea
.
setEditable
(
false
);
logTextArea
.
setBackground
(
new
java
.
awt
.
Color
(
204
,
255
,
204
));
logTextArea
.
setColumns
(
20
);
logTextArea
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
logTextArea
.
setForeground
(
new
java
.
awt
.
Color
(
51
,
51
,
255
));
logTextArea
.
setRows
(
5
);
logTextArea
.
setToolTipText
(
"The action that you did on the stack"
);
logTextArea
.
setBorder
(
new
javax
.
swing
.
border
.
MatteBorder
(
null
));
jScrollPane2
.
setViewportView
(
logTextArea
);
peekButton
.
setBackground
(
new
java
.
awt
.
Color
(
255
,
204
,
153
));
peekButton
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
peekButton
.
setMnemonic
(
KeyEvent
.
VK_K
);
peekButton
.
setText
(
"Peek"
);
peekButton
.
setToolTipText
(
"Click \"Peek\" to see the the top elemnt in the stack or press ALT+K"
);
peekButton
.
setBorder
(
javax
.
swing
.
BorderFactory
.
createLineBorder
(
new
java
.
awt
.
Color
(
0
,
0
,
0
)));
peekButton
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
peekButtonActionPerformed
(
evt
);
}
});
sizeButton
.
setBackground
(
new
java
.
awt
.
Color
(
255
,
204
,
153
));
sizeButton
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
sizeButton
.
setMnemonic
(
KeyEvent
.
VK_S
);
sizeButton
.
setText
(
"Size"
);
sizeButton
.
setToolTipText
(
"Click \"size\" to see the size of the stack or press Alt+S"
);
sizeButton
.
setBorder
(
javax
.
swing
.
BorderFactory
.
createLineBorder
(
new
java
.
awt
.
Color
(
0
,
0
,
0
)));
sizeButton
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
sizeButtonActionPerformed
(
evt
);
}
});
emptyButton
.
setBackground
(
new
java
.
awt
.
Color
(
255
,
204
,
153
));
emptyButton
.
setFont
(
new
java
.
awt
.
Font
(
"Times New Roman"
,
0
,
14
));
// NOI18N
emptyButton
.
setMnemonic
(
KeyEvent
.
VK_M
);