SlideShare a Scribd company logo
1 of 99
MTH 115-01 Stats Name__________________
85 Possible Points Fall 2015
Part A: For problems 1 - 4, draw the necessary pictures so that
I may follow your work. Label all z-scores and areas.
Assume that we have a normal distribution with a. (5 pts
each)
1. P(x < 75) = __________ 2. P(73 < x < 93) =
__________
3. P(x <73 or x > 75) = __________ 4. P(x = 73) =
___________
Part B: Determine whether each statement is true or false.
If the statement is false, explain why. (15 points = 3pts each)
1. The total area under the normal distribution bell-shaped
curve is infinite.
2. The standard normal distribution is a discrete
distribution.
3. The z value corresponding to a number below the mean
is always negative.
4. The area under the standard normal distribution to the
left of z = 0 is negative.
5. For a standard normal probability distribution, the
mean is always 1.
Part C: Work the following problems. Please show your work
to receive full credit.
1. (15pts) 30 High school students were randomly selected and
surveyed about the amounts of time they spend at after-school
jobs. The mean and standard deviation were found to be 26
hours and 6 hours, respectively. Assume that the given
statistics come from a normally distributed population.
a. Find the best point estimate of the population standard
deviation.
b. Find a 95% confidence interval for the population standard
deviation.
2. (10pts) You have just been hired by General Motors to tour
the United States giving randomly selected drivers test rides in
a new Corvette (yeah, right!). After giving the test drive, you
must ask the rider whether he or she would consider buying a
Corvette. How many riders must you survey (take for test
rides) to be 90% confident that the sample proportion is off by
no more than five percentage points?
3. (10pts) Of 2590 students randomly selected, 98% of them
own computers. Construct a 99% confidence interval for the
true proportion of all students who own computers.
4. (15pts) A food packing company fills sacks of cereal using
automated machinery. The fill amounts are normally distributed
with a mean weight of 2 pounds and a standard deviation of
0.20 pounds.
a) One sack is randomly selected. What is the probability that
the weight of the sack exceeds 2.05 pounds?
b) Sixteen sacks are randomly selected. What is the probability
that the mean weight of the sample of 16 sacks exceeds 2.05
pounds?
Page 1 of 3
75 and 10
ms
==
PainterStartup/.classpath
PainterStartup/.project
Painter
org.eclipse.jdt.core.javabuilder
org.eclipse.jdt.core.javanature
PainterStartup/.settings/org.eclipse.jdt.core.prefs
#Fri Apr 27 08:03:31 EDT 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enable
d
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
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.6
PainterStartup/com/javera/ui/actions/ActionUtilities.classpacka
ge com.javera.ui.actions;
publicsynchronizedclass ActionUtilities {
public void ActionUtilities();
publicstatic javax.swing.JFrame
getFrame(java.util.EventObject);
publicstatic javax.swing.JDialog
getDialog(java.util.EventObject);
publicstatic Object getCommandTarget(java.util.EventObject,
Class);
}
PainterStartup/com/javera/ui/actions/ActionUtilities.javaPainter
Startup/com/javera/ui/actions/ActionUtilities.javapackage com.j
avera.ui.actions;
import java.awt.Component;
import java.util.EventObject;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities;
publicclassActionUtilities{
publicstaticJFrame getFrame(EventObject e){
if(!(e.getSource()instanceofComponent)){
returnnull;
}
Component comp =(Component) e.getSource();
JFrame frame =(JFrame)SwingUtilities.getAncestorOfClass(JFra
me.class, comp);
while(frame ==null){
JPopupMenu popupMenu =
(JPopupMenu)SwingUtilities.getAncestorOfClass(JPopupMenu.
class, comp);
if(popupMenu ==null){
returnnull;
}
comp = popupMenu.getInvoker();
frame =(JFrame)SwingUtilities.getAncestorOfClass(JFr
ame.class, comp);
}
return frame;
}
publicstaticJDialog getDialog(EventObject e){
if(!(e.getSource()instanceofComponent)){
returnnull;
}
Component comp =(Component) e.getSource();
JDialog dialog =(JDialog)SwingUtilities.getAncestorOfClass(JD
ialog.class, comp);
while(dialog ==null){
JPopupMenu popupMenu =
(JPopupMenu)SwingUtilities.getAncestorOfClass(JPopupMenu.
class, comp);
if(popupMenu ==null){
returnnull;
}
comp = popupMenu.getInvoker();
dialog =(JDialog)SwingUtilities.getAncestorOfClass(JD
ialog.class, comp);
}
return dialog;
}
publicstaticObject getCommandTarget(EventObject e,Class com
mandClass){
Object target = getDialog(e);
if(target ==null){
target = getFrame(e);
}
for(;;){
if(target ==null){
returnnull;
}
if(commandClass.isInstance(target)){
return target;
}
if(!(target instanceofSelectable))
returnnull;
target =((Selectable) target).getSelectedItem();
}
}
}
PainterStartup/com/javera/ui/actions/Addable.classpackage
com.javera.ui.actions;
publicabstractinterface Addable {
publicabstract void add(java.awt.event.ActionEvent);
publicabstract boolean isAddable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Addable.javaPainterStartu
p/com/javera/ui/actions/Addable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* Things that support adding a new item (AddAction) should i
mplement this interface.
*/
publicinterfaceAddable{
publicvoid add(ActionEvent e);
publicboolean isAddable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/AddAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass AddAction extends
ManagedStateAction {
privatestatic AddAction addAction;
static void <clinit>();
private void AddAction();
publicstatic AddAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/AddAction.javaPainterStar
tup/com/javera/ui/actions/AddAction.javapackage com.javera.ui
.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import com.javera.ui.IconManager;
publicclassAddActionextendsManagedStateAction{
privatestaticAddAction addAction =newAddAction();
privateAddAction(){
super("New...",IconManager.getIcon("Add.gif"));
putValue(Action.SHORT_DESCRIPTION,"New");
}
publicstaticAddAction getAction(){
return addAction;
}
publicvoid actionPerformed(ActionEvent e ){
Addable target =(Addable)ActionUtilities.getCommandTarget( e
,
Addable.class);
if( target !=null&& target.isAddable( e )){
target.add( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Addable target =(Addable)ActionUtilities.getCommandTarget( e
vt,
Addable.class);
if( target !=null){
return target.isAddable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Closeable.classpackage
com.javera.ui.actions;
publicabstractinterface Closeable {
publicabstract void close(java.awt.event.ActionEvent);
publicabstract boolean isCloseable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Closeable.javaPainterStart
up/com/javera/ui/actions/Closeable.javapackage com.javera.ui.a
ctions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved.
* @author David T. Smith
*/
publicinterfaceCloseable{
publicvoid close(ActionEvent evt);
publicboolean isCloseable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/CloseAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass CloseAction extends
ManagedStateAction {
privatestatic CloseAction saveAction;
static void <clinit>();
private void CloseAction();
publicstatic CloseAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/CloseAction.javaPainterSt
artup/com/javera/ui/actions/CloseAction.java//Copyright 2004, (
c) Javera Software, LLC. as an unpublished work. All rights res
erved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicclassCloseActionextendsManagedStateAction{
privatestaticCloseAction saveAction =newCloseAction();
privateCloseAction(){
super("Close");
putValue(javax.swing.Action.SHORT_DESCRIPTION,"Cl
ose");
}
publicstaticCloseAction getAction(){
return saveAction;
}
publicvoid actionPerformed(ActionEvent e){
Closeable target =
(Closeable)ActionUtilities.getCommandTarget(e,Closeable.class
);
if(target !=null&& target.isCloseable(e)){
target.close(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
Closeable target =
(Closeable)ActionUtilities.getCommandTarget(evt,Closeable.cla
ss);
if(target !=null){
return target.isCloseable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/CloseAllable.classpackage
com.javera.ui.actions;
publicabstractinterface CloseAllable {
publicabstract boolean closeAll(java.awt.event.ActionEvent);
publicabstract boolean isCloseAllable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/CloseAllable.javaPainterSt
artup/com/javera/ui/actions/CloseAllable.javapackage com.javer
a.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved.
* @author David T. Smith
*/
publicinterfaceCloseAllable{
publicboolean closeAll(ActionEvent evt);
publicboolean isCloseAllable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/CloseAllAction.classpacka
ge com.javera.ui.actions;
publicsynchronizedclass CloseAllAction extends
javax.swing.AbstractAction {
privatestatic CloseAllAction saveAllAction;
static void <clinit>();
private void CloseAllAction();
publicstatic CloseAllAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/CloseAllAction.javaPainte
rStartup/com/javera/ui/actions/CloseAllAction.javapackage com
.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
publicclassCloseAllActionextendsAbstractAction{
privatestaticCloseAllAction saveAllAction =newCloseAllAction
();
privateCloseAllAction(){
super("Close All...");
putValue(javax.swing.Action.SHORT_DESCRIPTION,"Cl
ose All");
}
publicstaticCloseAllAction getAction(){
return saveAllAction;
}
publicvoid actionPerformed(ActionEvent e){
CloseAllable target =
(CloseAllable)ActionUtilities.getCommandTarget(e,CloseAllabl
e.class);
if(target !=null&& target.isCloseAllable(e)){
target.closeAll(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
CloseAllable target =
(CloseAllable)ActionUtilities.getCommandTarget(evt,CloseAlla
ble.class);
if(target !=null){
return target.isCloseAllable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Copyable.classpackage
com.javera.ui.actions;
publicabstractinterface Copyable {
publicabstract void copy(java.awt.event.ActionEvent);
publicabstract boolean isCopyable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Copyable.javaPainterStartu
p/com/javera/ui/actions/Copyable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* Components interested in interacting with CopyAction (e.g. h
ave UI-level
* Copy support) should implement this.
*/
publicinterfaceCopyable{
/**
* Tells the Component to do the Copy.
*/
publicvoid copy(ActionEvent evt );
/** Return true if a Copy is current possible. */
publicboolean isCopyable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/CopyAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass CopyAction extends
ManagedStateAction implements
java.awt.datatransfer.ClipboardOwner {
privatestatic CopyAction copyAction;
static void <clinit>();
private void CopyAction();
publicstatic CopyAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
public void lostOwnership(java.awt.datatransfer.Clipboard,
java.awt.datatransfer.Transferable);
}
PainterStartup/com/javera/ui/actions/CopyAction.javaPainterSta
rtup/com/javera/ui/actions/CopyAction.javapackage com.javera.
ui.actions;
import java.awt.Event;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
import com.javera.ui.IconManager;
publicclassCopyActionextendsManagedStateActionimplementsC
lipboardOwner{
privatestaticCopyAction copyAction =newCopyAction();
privateCopyAction(){
super("Copy",IconManager.getIcon("Copy.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('C'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_C,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Copy");
}
publicstaticCopyAction getAction(){return copyAction;}
publicvoid actionPerformed(ActionEvent e ){
Copyable copyable =(Copyable)
ActionUtilities.getCommandTarget( e,Copyable.class);
if( copyable !=null){
copyable.copy( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Copyable copyable =(Copyable)
ActionUtilities.getCommandTarget( evt,Copyable.class);
if( copyable !=null){
return copyable.isCopyable( evt );
}else{
returnfalse;
}
}
publicvoid lostOwnership(Clipboard clipboard,Transferable t ){
// no need to do anything here, but required to put data on Clipb
oard
}
}
PainterStartup/com/javera/ui/actions/Cutable.classpackage
com.javera.ui.actions;
publicabstractinterface Cutable {
publicabstract void cut(java.awt.event.ActionEvent);
publicabstract boolean isCutable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Cutable.javaPainterStartup
/com/javera/ui/actions/Cutable.javapackage com.javera.ui.action
s;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceCutable{
/**
* Tells the component to do the Cut.
*/
publicvoid cut(ActionEvent evt );
/** Returns true if a Cut is currently possible. */
publicboolean isCutable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/CutAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass CutAction extends
ManagedStateAction implements
java.awt.datatransfer.ClipboardOwner {
privatestatic CutAction cutAction;
static void <clinit>();
private void CutAction();
publicstatic CutAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
public void lostOwnership(java.awt.datatransfer.Clipboard,
java.awt.datatransfer.Transferable);
}
PainterStartup/com/javera/ui/actions/CutAction.javaPainterStart
up/com/javera/ui/actions/CutAction.javapackage com.javera.ui.a
ctions;
import java.awt.Event;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.Transferable;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
import com.javera.ui.IconManager;
publicclassCutActionextendsManagedStateActionimplementsCli
pboardOwner{
privatestaticCutAction cutAction =newCutAction();
privateCutAction(){
super("Cut",IconManager.getIcon("Cut.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('t'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_X,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Cut");
}
publicstaticCutAction getAction(){return cutAction;}
publicvoid actionPerformed(ActionEvent e ){
Cutable cutable =(Cutable)
ActionUtilities.getCommandTarget( e,Cutable.class);
if( cutable !=null){
cutable.cut( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Cutable cutable =(Cutable)
ActionUtilities.getCommandTarget( evt,Cutable.class);
if( cutable !=null){
return cutable.isCutable( evt );
}else{
returnfalse;
}
}
publicvoid lostOwnership(Clipboard par1,Transferable par2 ){
// following a paste, cut should probably be disabled at least unt
il
// a new event re-enables it
this.setEnabled(false);
}
}
PainterStartup/com/javera/ui/actions/Deleteable.classpackage
com.javera.ui.actions;
publicabstractinterface Deleteable {
publicabstract void delete(java.awt.event.ActionEvent);
publicabstract boolean isDeleteable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Deleteable.javaPainterStart
up/com/javera/ui/actions/Deleteable.javapackage com.javera.ui.
actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceDeleteable{
publicvoid delete(ActionEvent evt);
publicboolean isDeleteable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/DeleteAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass DeleteAction extends
ManagedStateAction {
privatestatic DeleteAction deleteAction;
static void <clinit>();
private void DeleteAction();
publicstatic DeleteAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/DeleteAction.javaPainterSt
artup/com/javera/ui/actions/DeleteAction.javapackage com.jave
ra.ui.actions;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
import com.javera.ui.IconManager;
publicclassDeleteActionextendsManagedStateAction{
privatestaticDeleteAction deleteAction =newDeleteAction();
privateDeleteAction(){
super("Delete",IconManager.getIcon("Delete.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('D'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));
putValue(Action.SHORT_DESCRIPTION,"Delete");
}
publicstaticDeleteAction getAction(){return deleteAction;}
publicvoid actionPerformed(ActionEvent evt ){
Deleteable deletable =(Deleteable)
ActionUtilities.getCommandTarget( evt,Deleteable.class);
if( deletable !=null){
deletable.delete( evt );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Deleteable deletable =(Deleteable)
ActionUtilities.getCommandTarget( evt,Deleteable.class);
if( deletable !=null){
return deletable.isDeleteable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Exitable.classpackage
com.javera.ui.actions;
publicabstractinterface Exitable {
publicabstract void exit(java.awt.event.ActionEvent);
publicabstract boolean isExitable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Exitable.javaPainterStartu
p/com/javera/ui/actions/Exitable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceExitable{
publicvoid exit(ActionEvent evt);
publicboolean isExitable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/ExitAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass ExitAction extends
javax.swing.AbstractAction {
privatestatic ExitAction exitAction;
static void <clinit>();
private void ExitAction();
publicstatic ExitAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/ExitAction.javaPainterStar
tup/com/javera/ui/actions/ExitAction.javapackage com.javera.ui
.actions;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassExitActionextendsAbstractAction{
privatestaticExitAction exitAction =newExitAction();
privateExitAction(){
super("Exit");
putValue(Action.MNEMONIC_KEY,newInteger('x'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_F4,Event.ALT_MASK )
);
}
publicstaticExitAction getAction(){return exitAction;}
publicvoid actionPerformed(ActionEvent e ){
Exitable exitable =(Exitable)
ActionUtilities.getCommandTarget( e,Exitable.class);
if( exitable !=null){
exitable.exit( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Exitable exitable =(Exitable)
ActionUtilities.getCommandTarget( evt,Exitable.class);
if( exitable !=null){
return exitable.isExitable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Exportable.classpackage
com.javera.ui.actions;
publicabstractinterface Exportable {
publicabstract void export(java.awt.event.ActionEvent);
publicabstract boolean isExportable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Exportable.javaPainterStar
tup/com/javera/ui/actions/Exportable.java/* Generated by Toget
her */
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Export actions.
*/
publicinterfaceExportable{
/**
* Performs the Export action.
*/
publicvoid export(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether an Export
* is currently performable.
*/
publicboolean isExportable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/ExportAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass ExportAction extends
ManagedStateAction {
privatestatic ExportAction exportAction;
static void <clinit>();
private void ExportAction();
publicstatic ExportAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/ExportAction.javaPainterS
tartup/com/javera/ui/actions/ExportAction.java/* Generated by
Together */
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
publicclassExportActionextendsManagedStateAction{
privatestaticExportAction exportAction =newExportAction();
privateExportAction(){
super("Export...");
putValue(Action.MNEMONIC_KEY,newInteger('t'));
putValue(Action.SHORT_DESCRIPTION,"Export");
}
publicstaticExportAction getAction(){
return exportAction;
}
publicvoid actionPerformed(ActionEvent e ){
Exportable exportable =(Exportable)
ActionUtilities.getCommandTarget( e,Exportable.class);
if( exportable !=null)
exportable.export( e );
}
publicboolean isTargetEnabled(EventObject evt ){
Object target =ActionUtilities.getCommandTarget( evt,
Exportable.class);
if( target !=null){
if(((Exportable)target ).isExportable( evt )){
returntrue;
}
}
returnfalse;
}
}
PainterStartup/com/javera/ui/actions/Filterable.classpackage
com.javera.ui.actions;
publicabstractinterface Filterable {
publicabstract void filter(java.awt.event.ActionEvent);
publicabstract boolean isFilterable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Filterable.javaPainterStart
up/com/javera/ui/actions/Filterable.javapackage com.javera.ui.a
ctions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceFilterable{
publicvoid filter(ActionEvent evt);
publicboolean isFilterable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/FilterAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass FilterAction extends
ManagedStateAction {
privatestatic FilterAction filterAction;
static void <clinit>();
private void FilterAction();
publicstatic FilterAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/FilterAction.javaPainterSta
rtup/com/javera/ui/actions/FilterAction.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import com.javera.ui.IconManager;
publicclassFilterActionextendsManagedStateAction{
privatestaticFilterAction filterAction =newFilterAction();
privateFilterAction(){
super("Filter...",IconManager.getIcon("filter.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('F'));
putValue(Action.SHORT_DESCRIPTION,"Filter");
}
publicstaticFilterAction getAction(){return filterAction;}
publicvoid actionPerformed(ActionEvent e ){
Filterable filterable =(Filterable)
ActionUtilities.getCommandTarget( e,Filterable.class);
if( filterable !=null){
filterable.filter( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Filterable filterable =(Filterable)
ActionUtilities.getCommandTarget( evt,Filterable.class);
if( filterable !=null){
return filterable.isFilterable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Findable.classpackage
com.javera.ui.actions;
publicabstractinterface Findable {
publicabstract void find(java.awt.event.ActionEvent);
publicabstract boolean isFindable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Findable.javaPainterStartu
p/com/javera/ui/actions/Findable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Find actions.
*/
publicinterfaceFindable{
/** Performs the Find action. */
publicvoid find(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether a Find
* is currently performable.
*/
publicboolean isFindable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/FindAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass FindAction extends
ManagedStateAction {
privatestatic FindAction findAction;
static void <clinit>();
private void FindAction();
publicstatic FindAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/FindAction.javaPainterStar
tup/com/javera/ui/actions/FindAction.javapackage com.javera.ui
.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import com.javera.ui.IconManager;
/** A managed state action for Find operations. */
publicclassFindActionextendsManagedStateAction{
privatestaticFindAction findAction =newFindAction();
privateFindAction(){
super("Find...",IconManager.getIcon("search.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('F'));
putValue(Action.SHORT_DESCRIPTION,"Find");
putValue(Action.LONG_DESCRIPTION,"Finds text value
s");
}
publicstaticFindAction getAction(){return findAction;}
publicvoid actionPerformed(ActionEvent e ){
Findable findable =(Findable)
ActionUtilities.getCommandTarget( e,Findable.class);
if( findable !=null){
findable.find( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Findable findable =(Findable)
ActionUtilities.getCommandTarget( evt,Findable.class);
if( findable !=null){
return findable.isFindable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Groupable.classpackage
com.javera.ui.actions;
publicabstractinterface Groupable {
publicabstract void group(java.awt.event.ActionEvent);
publicabstract boolean isGroupable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Groupable.javaPainterStart
up/com/javera/ui/actions/Groupable.javapackage com.javera.ui.
actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceGroupable{
/**
* Tells the component to do the group.
*/
publicvoid group(ActionEvent evt );
/** Returns true if a group is currently possible. */
publicboolean isGroupable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/GroupAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass GroupAction extends
ManagedStateAction {
privatestatic GroupAction groupAction;
static void <clinit>();
private void GroupAction();
publicstatic GroupAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/GroupAction.javaPainterSt
artup/com/javera/ui/actions/GroupAction.javapackage com.javer
a.ui.actions;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassGroupActionextendsManagedStateAction{
privatestaticGroupAction groupAction =newGroupAction();
privateGroupAction(){
super("Group");
putValue(Action.MNEMONIC_KEY,newInteger('G'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_G,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Group");
}
publicstaticGroupAction getAction(){return groupAction;}
publicvoid actionPerformed(ActionEvent e ){
Groupable group =(Groupable)
ActionUtilities.getCommandTarget( e,Groupable.class);
if( group !=null){
group.group( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Groupable group =(Groupable)
ActionUtilities.getCommandTarget( evt,Groupable.class);
if( group !=null){
return group.isGroupable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/ManagedStateAction.class
package com.javera.ui.actions;
publicabstractsynchronizedclass ManagedStateAction extends
javax.swing.AbstractAction {
privatestatic java.util.ArrayList managedActions;
static void <clinit>();
public void ManagedStateAction();
public void ManagedStateAction(String);
public void ManagedStateAction(String, javax.swing.Icon);
publicabstract boolean
isTargetEnabled(java.util.EventObject);
publicstatic void setStateFor(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/ManagedStateAction.javaP
ainterStartup/com/javera/ui/actions/ManagedStateAction.javapa
ckage com.javera.ui.actions;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.Iterator;
import javax.swing.AbstractAction;
import javax.swing.Icon;
publicabstractclassManagedStateActionextendsAbstractAction{
privatestaticArrayList managedActions =newArrayList();
publicManagedStateAction(){
super();
managedActions.add(this);
this.setEnabled(true);
}
publicManagedStateAction(String label){
super(label);
managedActions.add(this);
this.setEnabled(true);
}
publicManagedStateAction(String label,Icon icon){
super(label, icon);
managedActions.add(this);
this.setEnabled(true);
}
publicabstractboolean isTargetEnabled(EventObject evt);
publicstaticvoid setStateFor(EventObject evt){
for(Iterator iter = managedActions.iterator(); iter.hasNext();){
ManagedStateAction action =(ManagedStateAction) iter.next();
action.setEnabled(action.isTargetEnabled(evt));
}
}
}
PainterStartup/com/javera/ui/actions/Newable.classpackage
com.javera.ui.actions;
publicabstractinterface Newable {
publicabstract javax.swing.JInternalFrame
makeNew(java.awt.event.ActionEvent);
publicabstract boolean isNewable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Newable.javaPainterStartu
p/com/javera/ui/actions/Newable.javapackage com.javera.ui.acti
ons;
import javax.swing.JInternalFrame;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceNewable{
publicJInternalFrame makeNew(ActionEvent evt);
publicboolean isNewable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/NewAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass NewAction extends
javax.swing.AbstractAction {
privatestatic NewAction newAction;
static void <clinit>();
private void NewAction();
publicstatic NewAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/NewAction.javaPainterStar
tup/com/javera/ui/actions/NewAction.javapackage com.javera.ui
.actions;
import com.javera.ui.IconManager;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.AbstractAction;
publicclassNewActionextendsAbstractAction{
privatestaticNewAction newAction =newNewAction();
privateNewAction(){
super("New...",IconManager.getIcon("New.gif"));
putValue(Action.SHORT_DESCRIPTION,"New");
}
publicstaticNewAction getAction(){
return newAction;
}
publicvoid actionPerformed(ActionEvent e ){
Newable newable =(Newable)
ActionUtilities.getCommandTarget( e,Newable.class);
if( newable !=null){
newable.makeNew( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Newable newable =(Newable)
ActionUtilities.getCommandTarget( evt,Newable.class);
if( newable !=null){
return newable.isNewable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Openable.classpackage
com.javera.ui.actions;
publicabstractinterface Openable {
publicabstract void open(java.awt.event.ActionEvent);
publicabstract boolean isOpenable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Openable.javaPainterStartu
p/com/javera/ui/actions/Openable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceOpenable{
publicvoid open(ActionEvent evt);
publicboolean isOpenable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/OpenableSpecial.classpack
age com.javera.ui.actions;
publicabstractinterface OpenableSpecial {
publicabstract javax.swing.JInternalFrame openSpecial();
publicabstract boolean
isOpenableSpecial(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/OpenableSpecial.javaPaint
erStartup/com/javera/ui/actions/OpenableSpecial.javapackage c
om.javera.ui.actions;
import java.util.EventObject;
import javax.swing.JInternalFrame;
publicinterfaceOpenableSpecial{
publicJInternalFrame openSpecial();
publicboolean isOpenableSpecial(EventObject evt);
}
PainterStartup/com/javera/ui/actions/OpenAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass OpenAction extends
ManagedStateAction {
privatestatic OpenAction openAction;
static void <clinit>();
private void OpenAction();
publicstatic OpenAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/OpenAction.javaPainterSta
rtup/com/javera/ui/actions/OpenAction.javapackage com.javera.
ui.actions;
import com.javera.ui.IconManager;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
publicclassOpenActionextendsManagedStateAction{
privatestaticOpenAction openAction =newOpenAction();
privateOpenAction(){
super("Open...",IconManager.getIcon("Open.gif"));
putValue(Action.SHORT_DESCRIPTION,"Open");
}
publicstaticOpenAction getAction(){
return openAction;
}
publicvoid actionPerformed(ActionEvent e ){
Openable openable =(Openable)
ActionUtilities.getCommandTarget( e,Openable.class);
if( openable !=null){
openable.open( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Openable openable =(Openable)
ActionUtilities.getCommandTarget( evt,Openable.class);
if( openable !=null){
return openable.isOpenable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/OpenSpecialAction.classpa
ckage com.javera.ui.actions;
publicsynchronizedclass OpenSpecialAction extends
ManagedStateAction {
privatestatic OpenSpecialAction openSpecialAction;
static void <clinit>();
private void OpenSpecialAction();
publicstatic OpenSpecialAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/OpenSpecialAction.javaPai
nterStartup/com/javera/ui/actions/OpenSpecialAction.javapacka
ge com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import com.javera.ui.IconManager;
publicclassOpenSpecialActionextendsManagedStateAction{
privatestaticOpenSpecialAction openSpecialAction =newOpenS
pecialAction();
privateOpenSpecialAction()
{
super("Open Special...",IconManager.getIcon("Open.gif"));
}
publicstaticOpenSpecialAction getAction(){
return openSpecialAction;
}
publicvoid actionPerformed(ActionEvent e)
{
OpenableSpecial openable =(OpenableSpecial)ActionUtilities.g
etCommandTarget(e,OpenableSpecial.class);
if(openable !=null){
openable.openSpecial();
}
}
publicboolean isTargetEnabled(EventObject evt){
OpenableSpecial openable =(OpenableSpecial)ActionUtilities.g
etCommandTarget(evt,OpenableSpecial.class);
if(openable !=null){
return openable.isOpenableSpecial(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/PageSetupable.classpackag
e com.javera.ui.actions;
publicabstractinterface PageSetupable {
publicabstract void pageSetup(java.awt.event.ActionEvent);
publicabstract boolean
isPageSetupable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/PageSetupable.javaPainter
Startup/com/javera/ui/actions/PageSetupable.javapackage com.j
avera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Print actions.
*/
publicinterfacePageSetupable{
/** Performs the Print action. */
publicvoid pageSetup(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether a Print
* is currently performable.
*/
publicboolean isPageSetupable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/PageSetupAction.classpack
age com.javera.ui.actions;
publicsynchronizedclass PageSetupAction extends
javax.swing.AbstractAction {
privatestatic PageSetupAction pageSetupAction;
static void <clinit>();
private void PageSetupAction();
publicstatic PageSetupAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/PageSetupAction.javaPaint
erStartup/com/javera/ui/actions/PageSetupAction.javapackage c
om.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
import javax.swing.Action;
publicclassPageSetupActionextendsAbstractAction
{
privatestaticPageSetupAction pageSetupAction =newPageSetup
Action();
privatePageSetupAction(){
super("Page Setup...");
putValue(Action.SHORT_DESCRIPTION,"Page Setup");
}
publicstaticPageSetupAction getAction(){
return pageSetupAction;
}
publicvoid actionPerformed(ActionEvent e){
PageSetupable pageSetupable =
(PageSetupable)ActionUtilities.getCommandTarget(e,PageSetup
able.class);
if(pageSetupable !=null)
pageSetupable.pageSetup(e);
}
publicboolean isTargetEnabled(EventObject evt){
Object target =ActionUtilities.getCommandTarget(evt,PageSetu
pable.class);
if(target !=null){
if(((PageSetupable) target).isPageSetupable(evt)){
returntrue;
}
}
returnfalse;
}
}
PainterStartup/com/javera/ui/actions/Pasteable.classpackage
com.javera.ui.actions;
publicabstractinterface Pasteable {
publicabstract void paste(java.awt.event.ActionEvent);
publicabstract boolean isPasteable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Pasteable.javaPainterStartu
p/com/javera/ui/actions/Pasteable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* Components interested in interaction with PasteAction should
* implement this.
*/
publicinterfacePasteable{
/** Hands the component the object that's been Pasted. */
publicvoid paste(ActionEvent evt);
/** Returns true if a Paste is currently possible. */
publicboolean isPasteable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/PasteAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass PasteAction extends
ManagedStateAction {
privatestatic PasteAction pasteAction;
static void <clinit>();
private void PasteAction();
publicstatic PasteAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/PasteAction.javaPainterSta
rtup/com/javera/ui/actions/PasteAction.javapackage com.javera.
ui.actions;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
import com.javera.ui.IconManager;
publicclassPasteActionextendsManagedStateAction{
privatestaticPasteAction pasteAction =newPasteAction();
privatePasteAction(){
super("Paste",IconManager.getIcon("Paste.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('P'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_V,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Paste");
}
publicstaticPasteAction getAction(){return pasteAction;}
publicvoid actionPerformed(ActionEvent e ){
Pasteable pasteable =(Pasteable)
ActionUtilities.getCommandTarget( e,Pasteable.class);
if( pasteable !=null){
pasteable.paste( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Pasteable pasteable =(Pasteable)
ActionUtilities.getCommandTarget( evt,Pasteable.class);
if( pasteable !=null){
return pasteable.isPasteable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Printable.classpackage
com.javera.ui.actions;
publicabstractinterface Printable {
publicabstract void print(java.awt.event.ActionEvent);
publicabstract boolean isPrintable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Printable.javaPainterStartu
p/com/javera/ui/actions/Printable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Print actions.
*/
publicinterfacePrintable{
/** Performs the Print action. */
publicvoid print(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether a Print
* is currently performable.
*/
publicboolean isPrintable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/PrintAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass PrintAction extends
ManagedStateAction {
privatestatic PrintAction printAction;
static void <clinit>();
private void PrintAction();
publicstatic PrintAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/PrintAction.javaPainterSta
rtup/com/javera/ui/actions/PrintAction.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
import com.javera.ui.IconManager;
publicclassPrintActionextendsManagedStateAction{
privatestaticPrintAction printAction =newPrintAction();
privatePrintAction(){
super("Print...",IconManager.getIcon("Print.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('i'));
putValue(Action.SHORT_DESCRIPTION,"Print");
}
publicstaticPrintAction getAction(){
return printAction;
}
publicvoid actionPerformed(ActionEvent e){
Printable printable =
(Printable)ActionUtilities.getCommandTarget(e,Printable.class)
;
if(printable !=null)
printable.print(e);
}
publicboolean isTargetEnabled(EventObject evt){
Object target =ActionUtilities.getCommandTarget(evt,Printable.
class);
if(target !=null){
if(((Printable) target).isPrintable(evt)){
returntrue;
}
}
returnfalse;
}
}
PainterStartup/com/javera/ui/actions/Redoable.classpackage
com.javera.ui.actions;
publicabstractinterface Redoable {
publicabstract void redo(java.awt.event.ActionEvent);
publicabstract boolean isRedoable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Redoable.javaPainterStartu
p/com/javera/ui/actions/Redoable.javapackage com.javera.ui.act
ions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceRedoable{
publicvoid redo(ActionEvent evt);
publicboolean isRedoable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/RedoAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass RedoAction extends
ManagedStateAction {
privatestatic RedoAction redoAction;
static void <clinit>();
private void RedoAction();
publicstatic RedoAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/RedoAction.javaPainterSta
rtup/com/javera/ui/actions/RedoAction.javapackage com.javera.
ui.actions;
import com.javera.ui.IconManager;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassRedoActionextendsManagedStateAction{
privatestaticRedoAction redoAction =newRedoAction();
privateRedoAction(){
super("Redo",IconManager.getIcon("Redo.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('R'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_Z,
Event.CTRL_MASK +Event.SHIFT_MASK ));
putValue(Action.SHORT_DESCRIPTION,"Redo");
}
publicstaticRedoAction getAction(){
return redoAction;
}
publicvoid actionPerformed(ActionEvent evt ){
Redoable redoable =(Redoable)
ActionUtilities.getCommandTarget( evt,Redoable.class);
if( redoable !=null)
redoable.redo( evt );
}
publicboolean isTargetEnabled(EventObject evt ){
Redoable redoable =(Redoable)
ActionUtilities.getCommandTarget( evt,Redoable.class);
if( redoable !=null){
return redoable.isRedoable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Refreshable.classpackage
com.javera.ui.actions;
publicabstractinterface Refreshable {
publicabstract void refresh(java.awt.event.ActionEvent);
publicabstract boolean isRefreshable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Refreshable.javaPainterSta
rtup/com/javera/ui/actions/Refreshable.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by components that wis
h to work
* with Refresh actions.
*/
publicinterfaceRefreshable{
/** Performs the Find action. */
publicvoid refresh(ActionEvent evt );
/**
* Implementing object should use this method to specify wh
ether a Refresh
* is currently performable.
*/
publicboolean isRefreshable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/RefreshAction.classpackag
e com.javera.ui.actions;
publicsynchronizedclass RefreshAction extends
ManagedStateAction {
privatestatic RefreshAction refreshAction;
static void <clinit>();
private void RefreshAction();
publicstatic RefreshAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/RefreshAction.javaPainter
Startup/com/javera/ui/actions/RefreshAction.javapackage com.j
avera.ui.actions;
import com.javera.ui.IconManager;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
/** A managed state action for Refresh operations. */
publicclassRefreshActionextendsManagedStateAction{
privatestaticRefreshAction refreshAction =newRefreshAction();
privateRefreshAction(){
super("Refresh...",IconManager.getIcon("Refresh.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('F'));
putValue(Action.SHORT_DESCRIPTION,"Refresh");
putValue(Action.LONG_DESCRIPTION,"Refresh");
}
publicstaticRefreshAction getAction(){
return refreshAction;
}
publicvoid actionPerformed(ActionEvent e ){
Refreshable refreshable =(Refreshable)
ActionUtilities.getCommandTarget( e,Refreshable.class);
if( refreshable !=null)
refreshable.refresh( e );
}
publicboolean isTargetEnabled(EventObject evt ){
Refreshable refreshable =(Refreshable)
ActionUtilities.getCommandTarget( evt,Refreshable.class);
if( refreshable !=null){
return refreshable.isRefreshable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Saveable.classpackage
com.javera.ui.actions;
publicabstractinterface Saveable {
publicabstract void save(java.awt.event.ActionEvent);
publicabstract boolean isSaveable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Saveable.javaPainterStartu
p/com/javera/ui/actions/Saveable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved.
* @author David T. Smith
*/
publicinterfaceSaveable{
publicvoid save(ActionEvent evt);
publicboolean isSaveable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/SaveAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass SaveAction extends
ManagedStateAction {
privatestatic SaveAction saveAction;
static void <clinit>();
private void SaveAction();
publicstatic SaveAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAction.javaPainterSta
rtup/com/javera/ui/actions/SaveAction.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import com.javera.ui.IconManager;
publicclassSaveActionextendsManagedStateAction{
privatestaticSaveAction saveAction =newSaveAction();
privateSaveAction(){
super("Save",IconManager.getIcon("Save.gif"));
putValue(javax.swing.Action.SHORT_DESCRIPTION,"Sa
ve");
}
publicstaticSaveAction getAction(){
return saveAction;
}
publicvoid actionPerformed(ActionEvent e){
Saveable target =
(Saveable)ActionUtilities.getCommandTarget(e,Saveable.class);
if(target !=null&& target.isSaveable(e)){
target.save(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
Saveable target =
(Saveable)ActionUtilities.getCommandTarget(evt,Saveable.clas
s);
if(target !=null){
return target.isSaveable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/SaveAllable.classpackage
com.javera.ui.actions;
publicabstractinterface SaveAllable {
publicabstract void saveAll(java.awt.event.ActionEvent);
publicabstract boolean isSaveAllable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAllable.javaPainterSta
rtup/com/javera/ui/actions/SaveAllable.javapackage com.javera.
ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved.
* @author David T. Smith
*/
publicinterfaceSaveAllable{
publicvoid saveAll(ActionEvent evt);
publicboolean isSaveAllable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/SaveAllAction.classpackag
e com.javera.ui.actions;
publicsynchronizedclass SaveAllAction extends
javax.swing.AbstractAction {
privatestatic SaveAllAction saveAllAction;
static void <clinit>();
private void SaveAllAction();
publicstatic SaveAllAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAllAction.javaPainter
Startup/com/javera/ui/actions/SaveAllAction.javapackage com.j
avera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
publicclassSaveAllActionextendsAbstractAction{
privatestaticSaveAllAction saveAllAction =newSaveAllAction()
;
privateSaveAllAction(){
super("Save All...");
putValue(javax.swing.Action.SHORT_DESCRIPTION,"Sa
ve All");
}
publicstaticSaveAllAction getAction(){
return saveAllAction;
}
publicvoid actionPerformed(ActionEvent e){
SaveAllable target =
(SaveAllable)ActionUtilities.getCommandTarget(e,SaveAllable.
class);
if(target !=null&& target.isSaveAllable(e)){
target.saveAll(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
SaveAllable target =
(SaveAllable)ActionUtilities.getCommandTarget(evt,SaveAllabl
e.class);
if(target !=null){
return target.isSaveAllable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/SaveAsable.classpackage
com.javera.ui.actions;
publicabstractinterface SaveAsable {
publicabstract void saveAs(java.awt.event.ActionEvent);
publicabstract boolean isSaveAsable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAsable.javaPainterSta
rtup/com/javera/ui/actions/SaveAsable.java//Copyright 2004, (c)
Javera Software, LLC. as an unpublished work. All rights reser
ved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
/**
* This interface should be implemented by UI classes that want
to allow some data they handle to be saved
* as another entity.
* @author David T. Smith
*/
publicinterfaceSaveAsable{
publicvoid saveAs(ActionEvent evt);
publicboolean isSaveAsable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/SaveAsAction.classpackag
e com.javera.ui.actions;
publicsynchronizedclass SaveAsAction extends
javax.swing.AbstractAction {
privatestatic SaveAsAction saveAsAction;
static void <clinit>();
private void SaveAsAction();
publicstatic SaveAsAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SaveAsAction.javaPainter
Startup/com/javera/ui/actions/SaveAsAction.java//Copyright 20
04, (c) Javera Software, LLC. as an unpublished work. All right
s reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.AbstractAction;
publicclassSaveAsActionextendsAbstractAction{
privatestaticSaveAsAction saveAsAction =newSaveAsAction();
privateSaveAsAction(){
super("Save As...");
}
publicstaticSaveAsAction getAction(){
return saveAsAction;
}
publicvoid actionPerformed(ActionEvent e){
SaveAsable target =
(SaveAsable)ActionUtilities.getCommandTarget(e,SaveAsable.c
lass);
if(target !=null&& target.isSaveAsable(e)){
target.saveAs(e);
}
}
publicboolean isTargetEnabled(EventObject evt){
SaveAsable target =
(SaveAsable)ActionUtilities.getCommandTarget(evt,SaveAsable
.class);
if(target !=null){
return target.isSaveAsable(evt);
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Selectable.classpackage
com.javera.ui.actions;
publicabstractinterface Selectable {
publicabstract Object getSelectedItem();
}
PainterStartup/com/javera/ui/actions/Selectable.javaPainterStart
up/com/javera/ui/actions/Selectable.javapackage com.javera.ui.a
ctions;
publicinterfaceSelectable{
publicObject getSelectedItem();
}
PainterStartup/com/javera/ui/actions/Sortable.classpackage
com.javera.ui.actions;
publicabstractinterface Sortable {
publicabstract void sort(java.awt.event.ActionEvent);
publicabstract boolean isSortable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Sortable.javaPainterStartu
p/com/javera/ui/actions/Sortable.javapackage com.javera.ui.acti
ons;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceSortable{
publicvoid sort(ActionEvent e);
publicboolean isSortable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/SortAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass SortAction extends
ManagedStateAction {
privatestatic SortAction filterAction;
static void <clinit>();
private void SortAction();
publicstatic SortAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/SortAction.javaPainterStar
tup/com/javera/ui/actions/SortAction.javapackage com.javera.ui
.actions;
import com.javera.ui.IconManager;
import java.awt.event.ActionEvent;
import java.util.EventObject;
import javax.swing.Action;
publicclassSortActionextendsManagedStateAction{
privatestaticSortAction filterAction =newSortAction();
privateSortAction(){
super("Sort...",IconManager.getIcon("sort.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('F'));
putValue(Action.SHORT_DESCRIPTION,"Sort");
}
publicstaticSortAction getAction(){
return filterAction;
}
publicvoid actionPerformed(ActionEvent e ){
Sortable sortable =(Sortable)
ActionUtilities.getCommandTarget( e,Sortable.class);
if( sortable !=null)
sortable.sort( e );
}
publicboolean isTargetEnabled(EventObject evt ){
Sortable sortable =(Sortable)
ActionUtilities.getCommandTarget( evt,Sortable.class);
if( sortable !=null){
return sortable.isSortable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Undoable.classpackage
com.javera.ui.actions;
publicabstractinterface Undoable {
publicabstract void undo(java.awt.event.ActionEvent);
publicabstract boolean isUndoable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Undoable.javaPainterStart
up/com/javera/ui/actions/Undoable.javapackage com.javera.ui.a
ctions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceUndoable{
publicvoid undo(ActionEvent evt);
publicboolean isUndoable(EventObject evt);
}
PainterStartup/com/javera/ui/actions/UndoAction.classpackage
com.javera.ui.actions;
publicsynchronizedclass UndoAction extends
ManagedStateAction {
privatestatic UndoAction undoAction;
static void <clinit>();
private void UndoAction();
publicstatic UndoAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/UndoAction.javaPainterSta
rtup/com/javera/ui/actions/UndoAction.javapackage com.javera.
ui.actions;
import com.javera.ui.IconManager;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassUndoActionextendsManagedStateAction{
privatestaticUndoAction undoAction =newUndoAction();
privateUndoAction(){
super("Undo",IconManager.getIcon("Undo.gif"));
putValue(Action.MNEMONIC_KEY,newInteger('U'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_Z,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Undo");
}
publicstaticUndoAction getAction(){
return undoAction;
}
publicvoid actionPerformed(ActionEvent evt ){
Undoable undoable =(Undoable)
ActionUtilities.getCommandTarget( evt,Undoable.class);
if( undoable !=null)
undoable.undo( evt );
}
publicboolean isTargetEnabled(EventObject evt ){
Undoable undoable =(Undoable)
ActionUtilities.getCommandTarget( evt,Undoable.class);
if( undoable !=null){
return undoable.isUndoable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/actions/Ungroupable.classpackage
com.javera.ui.actions;
publicabstractinterface Ungroupable {
publicabstract void ungroup(java.awt.event.ActionEvent);
publicabstract boolean isUngroupable(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/Ungroupable.javaPainterSt
artup/com/javera/ui/actions/Ungroupable.javapackage com.javer
a.ui.actions;
import java.awt.event.ActionEvent;
import java.util.EventObject;
publicinterfaceUngroupable{
/**
* Tells the component to do the ungroup.
*/
publicvoid ungroup(ActionEvent evt );
/** Returns true if a ungroup is currently possible. */
publicboolean isUngroupable(EventObject evt );
}
PainterStartup/com/javera/ui/actions/UngroupAction.classpacka
ge com.javera.ui.actions;
publicsynchronizedclass UngroupAction extends
ManagedStateAction {
privatestatic UngroupAction groupAction;
static void <clinit>();
private void UngroupAction();
publicstatic UngroupAction getAction();
public void actionPerformed(java.awt.event.ActionEvent);
public boolean isTargetEnabled(java.util.EventObject);
}
PainterStartup/com/javera/ui/actions/UngroupAction.javaPainter
Startup/com/javera/ui/actions/UngroupAction.javapackage com.j
avera.ui.actions;
import java.awt.Event;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.EventObject;
import javax.swing.Action;
import javax.swing.KeyStroke;
publicclassUngroupActionextendsManagedStateAction{
privatestaticUngroupAction groupAction =newUngroupAction()
;
privateUngroupAction(){
super("Ungroup");
putValue(Action.MNEMONIC_KEY,newInteger('U'));
putValue(Action.ACCELERATOR_KEY,
KeyStroke.getKeyStroke(KeyEvent.VK_U,Event.CTRL_MASK
));
putValue(Action.SHORT_DESCRIPTION,"Ungroup");
}
publicstaticUngroupAction getAction(){return groupAction;}
publicvoid actionPerformed(ActionEvent e ){
Ungroupable ungroup =(Ungroupable)
ActionUtilities.getCommandTarget( e,Ungroupable.class);
if( ungroup !=null){
ungroup.ungroup( e );
}
}
publicboolean isTargetEnabled(EventObject evt ){
Ungroupable ungroup =(Ungroupable)
ActionUtilities.getCommandTarget( evt,Ungroupable.class);
if( ungroup !=null){
return ungroup.isUngroupable( evt );
}else{
returnfalse;
}
}
}
PainterStartup/com/javera/ui/CompleteEntry.classpackage
com.javera.ui;
publicabstractinterface CompleteEntry {
publicabstract void completeEntry();
}
PainterStartup/com/javera/ui/CompleteEntry.javaPainterStartup/
com/javera/ui/CompleteEntry.javapackage com.javera.ui;
/**
* @author dtsmith
*/
publicinterfaceCompleteEntry{
publicvoid completeEntry();
}
PainterStartup/com/javera/ui/GetIcon.classpackage
com.javera.ui;
publicabstractinterface GetIcon {
publicabstract javax.swing.Icon getIcon();
}
PainterStartup/com/javera/ui/GetIcon.javaPainterStartup/com/ja
vera/ui/GetIcon.java//Copyright 2004, (c) Javera Software, LLC
. as an unpublished work. All rights reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
import javax.swing.Icon;
/**
* GetIcon interface provides access to the getIcon() method use
d by
* the various renderers to obtain an Icon for a given object
*
* @author David T. Smith
*/
publicinterfaceGetIcon{
/**
* Get the icon to be displayed by the renderer
* @ return the icon to be displayed
*/
publicIcon getIcon();
}
PainterStartup/com/javera/ui/GetObject.classpackage
com.javera.ui;
publicabstractinterface GetObject {
publicabstract Object getObject();
}
PainterStartup/com/javera/ui/GetObject.javaPainterStartup/com/
javera/ui/GetObject.java//Copyright 2004, (c) Javera Software,
LLC. as an unpublished work. All rights reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
/**
* GetObject interface provides access to the getObject() metho
d used by
* the various renderers to obtain a contained object
*
* @author David T. Smith
*/
publicinterfaceGetObject{
/**
* Get the contained object
* @return the contained object
*/
publicObject getObject();
}
PainterStartup/com/javera/ui/GetPopupMenu.classpackage
com.javera.ui;
publicabstractinterface GetPopupMenu {
publicabstract javax.swing.JPopupMenu
getPopupMenu(java.awt.event.MouseEvent);
}
PainterStartup/com/javera/ui/GetPopupMenu.javaPainterStartup
/com/javera/ui/GetPopupMenu.java//Copyright 2004, (c) Javera
Software, LLC. as an unpublished work. All rights reserved wo
rld-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
import java.awt.event.MouseEvent;
import javax.swing.JPopupMenu;
publicinterfaceGetPopupMenu{
publicJPopupMenu getPopupMenu(MouseEvent e);
}
PainterStartup/com/javera/ui/GetText.classpackage
com.javera.ui;
publicabstractinterface GetText {
publicabstract String getText();
}
PainterStartup/com/javera/ui/GetText.javaPainterStartup/com/ja
vera/ui/GetText.java//Copyright 2004, (c) Javera Software, LLC
. as an unpublished work. All rights reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
/**
* GetText interface provides access to the getText() method us
ed by
* the default renderers for JvList and JvComboBox to get the te
xt to be
* displayed as an entry
*
* @author David T. Smith
*/
publicinterfaceGetText{
/**
* Get the text to be displayed by the renderer
* @ return the text to be displayed
*/
publicString getText();
}
PainterStartup/com/javera/ui/GetTransferable.classpackage
com.javera.ui;
publicabstractinterface GetTransferable {
publicabstract java.awt.datatransfer.Transferable
getTransferable();
}
PainterStartup/com/javera/ui/GetTransferable.javaPainterStartu
p/com/javera/ui/GetTransferable.java// Copyright 2004, (c) Jave
ra Software, LLC. as an unpublished work. All rights reserved
world-wide.
// This is a proprietary trade secret of Javera Software LLC. Us
e restricted to licensing terms.
package com.javera.ui;
import java.awt.datatransfer.Transferable;
/**
* @author dtsmith
*/
publicinterfaceGetTransferable{
/**
* @return
*/
Transferable getTransferable();
}
PainterStartup/com/javera/ui/GetValue.classpackage
com.javera.ui;
publicabstractinterface GetValue {
publicabstract Object getValue();
}
PainterStartup/com/javera/ui/GetValue.javaPainterStartup/com/j
avera/ui/GetValue.java//Copyright 2004, (c) Javera Software, L
LC. as an unpublished work. All rights reserved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
/**
* GetValue interface provides access to the getValue() method
used
* to obtain a value associated with an object
*
* @author David T. Smith
*/
publicinterfaceGetValue{
/**
* Get the contained object
* @return the contained object
*/
publicObject getValue();
}
PainterStartup/com/javera/ui/GuiListDataListener.classpackage
com.javera.ui;
publicabstractinterface GuiListDataListener extends
javax.swing.event.ListDataListener {
}
PainterStartup/com/javera/ui/GuiListDataListener.javaPainterSt
artup/com/javera/ui/GuiListDataListener.java// Copyright 2004,
(c) Javera Software, LLC. as an unpublished work. All rights re
served world-wide.
// This is a proprietary trade secret of Javera Software LLC. Us
e restricted to licensing terms.
package com.javera.ui;
import javax.swing.event.ListDataListener;
/**
* @author dtsmith
*/
publicinterfaceGuiListDataListenerextendsListDataListener{
}
PainterStartup/com/javera/ui/IconManager.classpackage
com.javera.ui;
publicsynchronizedclass IconManager {
static ClassLoader classLoader;
static java.util.Hashtable iconTable;
static void <clinit>();
public void IconManager();
publicstatic javax.swing.ImageIcon getIcon(String);
publicstatic javax.swing.ImageIcon getImageIcon(String);
}
PainterStartup/com/javera/ui/IconManager.javaPainterStartup/c
om/javera/ui/IconManager.java//Copyright 2004, (c) Javera Soft
ware, LLC. as an unpublished work. All rights reserved world-
wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui;
import java.net.*;
import java.util.Hashtable;
import javax.swing.ImageIcon;
/**
* IconManager provides a convenience class to load icons.
*
* @author David T. Smith
*/
publicclassIconManager{
staticClassLoader classLoader =IconManager.class.getClassLoa
der();
staticHashtable iconTable =newHashtable();
publicstaticImageIcon getIcon(String iconName)
{
return getImageIcon("images/"+ iconName);
}
staticpublicImageIcon getImageIcon(String iconName)
{
ImageIcon icon =(ImageIcon) iconTable.get(iconName);
if(icon ==null)
{
URL url = classLoader.getResource(iconName);
if(url !=null)
icon =newImageIcon(url);
else
icon =newImageIcon("x.gif");
iconTable.put(iconName, icon);
}
return icon;
}
}
PainterStartup/com/javera/ui/JavaObjectTransferable.classpacka
ge com.javera.ui;
publicsynchronizedclass JavaObjectTransferable implements
java.awt.datatransfer.Transferable, java.io.Serializable {
privatetransient Object javaObject;
private java.util.ArrayList dataFlavors;
public void JavaObjectTransferable(Object);
public java.awt.datatransfer.DataFlavor[]
getTransferDataFlavors();
public boolean
isDataFlavorSupported(java.awt.datatransfer.DataFlavor);
public boolean
addDataFlavor(java.awt.datatransfer.DataFlavor);
public Object
getTransferData(java.awt.datatransfer.DataFlavor) throws
java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException;
}
PainterStartup/com/javera/ui/JavaObjectTransferable.javaPainte
rStartup/com/javera/ui/JavaObjectTransferable.java// Copyright
2004, (c) Javera Software, LLC. as an unpublished work. All ri
ghts reserved world-wide.
// This is a proprietary trade secret of Javera Software LLC. Us
e restricted to licensing terms.
package com.javera.ui;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
/**
* @author dtsmith
*/
publicclassJavaObjectTransferableimplementsTransferable,Seria
lizable{
privatetransientObject javaObject;
privateArrayList dataFlavors =newArrayList();
publicJavaObjectTransferable(Object javaObject){
this.javaObject = javaObject;
}
publicDataFlavor[] getTransferDataFlavors(){
return(DataFlavor[]) dataFlavors.toArray(newDataFlavor[dataFl
avors.size()]);
}
publicboolean isDataFlavorSupported(DataFlavor flavor){
return dataFlavors.contains(flavor);
}
publicboolean addDataFlavor(DataFlavor flavor){
return dataFlavors.add(flavor);
}
publicObject getTransferData(DataFlavor flavor)throwsUnsuppo
rtedFlavorException,IOException{
if(isDataFlavorSupported(flavor)){
return javaObject;
}else{
returnnull;
}
}
}
PainterStartup/com/javera/ui/layout/JvBoxLayout$Filler.classpa
ckage com.javera.ui.layout;
publicsynchronizedclass JvBoxLayout$Filler extends
java.awt.Component implements javax.accessibility.Accessible
{
private java.awt.Dimension dim;
public void JvBoxLayout$Filler(int, int);
public java.awt.Dimension getMinimumSize();
public java.awt.Dimension getPreferredSize();
public java.awt.Dimension getMaximumSize();
}
PainterStartup/com/javera/ui/layout/JvBoxLayout.classpackage
com.javera.ui.layout;
publicsynchronizedclass JvBoxLayout implements
java.awt.LayoutManager2, com.javera.ui.LayoutPrintLayout,
java.io.Serializable {
publicstaticfinal int X_AXIS = 0;
publicstaticfinal int Y_AXIS = 1;
private int axis;
private int gap;
private int topMargin;
private int bottomMargin;
private int leftMargin;
private int rightMargin;
private java.util.Map weightMap;
public void JvBoxLayout(int);
public void JvBoxLayout(int, int, int, int, int, int);
public int getGap();
public void setGap(int);
public int getTopMargin();
public void setTopMargin(int);
public int getLeftMargin();
public void setLeftMargin(int);
public int getBottomMargin();
public void setBottomMargin(int);
public int getRightMargin();
public void setRightMargin(int);
public void addLayoutComponent(java.awt.Component,
Object);
public java.awt.Dimension
maximumLayoutSize(java.awt.Container);
public float getLayoutAlignmentX(java.awt.Container);
public float getLayoutAlignmentY(java.awt.Container);
public void invalidateLayout(java.awt.Container);
public void addLayoutComponent(String,
java.awt.Component);
public void removeLayoutComponent(java.awt.Component);
public java.awt.Dimension
minimumLayoutSize(java.awt.Container);
public java.awt.Dimension
preferredLayoutSize(java.awt.Container);
public void layoutContainer(java.awt.Container);
publicstatic java.awt.Component createFiller(int, int);
public int layoutPrint(java.awt.Container, int);
}
PainterStartup/com/javera/ui/layout/JvBoxLayout.javaPainterSt
artup/com/javera/ui/layout/JvBoxLayout.java//Copyright 2004, (
c) Javera Software, LLC. as an unpublished work. All rights res
erved world-wide.
//This is a proprietary trade secret of Javera Software LLC. Use
restricted to licensing terms.
package com.javera.ui.layout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.LayoutManager2;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.accessibility.Accessible;
import com.javera.ui.LayoutPrintLayout;
import com.javera.ui.LayoutPrint;
//import com.javera.ui.panel.JvPanel;
/**
* A Javera box layout arranges components in a vertical or hori
zontal format.
* For vertical format all components are resized to have the sa
me width of
* the container, but have a height that is in proportion to their a
ssigned
* weights and such that the total height of all compoenents fills
the height
* of the container. Likewise a horizontal format will resize co
mponents to
* have the same width as the container and a height that is in pr
oportion to
* the assigned weights. If a component has an assigned weight
of 0 then that
* components is sized according to its preferred size.
*
* Weights are assigned using a Double as the second argument
to the
* containers add method. A null second argument will be inter
preted as a
* zero weight assignement.
*
* A Javera box layout is similar in function to a Box layout exc
ept that the
* assigned weights, not glue or preferred sizes are used to distr
ibute space
* over the row or column. Javera box layout also provides gap
* separation and margins.
*
* @author David T. Smith
*/
publicclassJvBoxLayoutimplementsLayoutManager2,LayoutPrin
tLayout,Serializable{
/**
* Horizontal axis orientation
*/
publicfinalstaticint X_AXIS =0;
/**
* Vertical axis orientation
*/
publicfinalstaticint Y_AXIS =1;
/**
* The axis orientation of the weighted layout.
*/
privateint axis;
/**
* The weighted layout manager allows a seperation of compo
nents with
* gaps. The gap will specify the space between components.
*
* @serial
* @see getGap
* @see setGap
*/
privateint gap;
/**
* The weighted layout manager allows specification of a top
margin to be
* reserved above laidout components.
*
* @serial
* @see getTopMargin
* @see setTopMargin
*/
privateint topMargin;
/**
* The command button layout manager allows specification
of a bottom
* margin to be reserved below laidout components.
*
* @serial
* @see getBottomMargin
* @see setBottomMargin
*/
privateint bottomMargin;
/**
* The weighted layout manager allows specification of a left
margin to be
* reserved to the left of the leftmost component.
*
* @serial
* @see getLeftMargin
* @see setLeftMargin
*/
privateint leftMargin;
/**
* The weighted layout manager allows specification of a rig
ht margin to
* be reserved to the right of the rightmost component.
*
* @serial
* @see getRightMargin
* @see setRightMargin
*/
privateint rightMargin;
/**
* A Map of each component's weight, keyed on the compone
nt
* objects themselves.
*/
privateMap weightMap =newHashMap();
/**
* Constructs a new Weighted Layout with specified axis, a d
efault 5 pixel
* gap, and a 5 pixel margins.
*
* @param axis X_AXIS or Y_AXIS
*/
publicJvBoxLayout(int axis){
this(axis,5,5,5,5,5);
}
/**
* Constructs a new Weighted Layout with specified axis, gap
, and margins.
*
* @param axis X_AXIS or Y_AXIS
* @param gap the gap between components.
* @param topMargin the top margin.
* @param leftMargin the left margin.
* @param bottomMargin the bottom margin.
* @param rightMargin the right margin.
*/
publicJvBoxLayout(
int axis,
int gap,
int topMargin,
int leftMargin,
int bottomMargin,
int rightMargin){
this.axis = axis;
this.gap = gap;
this.topMargin = topMargin;
this.leftMargin = leftMargin;
this.bottomMargin = bottomMargin;
this.rightMargin = rightMargin;
}
/**
* Gets the gap between components.
*
* @return the gap between components.
*/
publicint getGap(){
return gap;
}
/**
* Sets the gap between components.
*
* @param gap the gap between components
*/
publicvoid setGap(int gap){
this.gap = gap;
}
/**
* Gets the top margin to be reserved above all components.
*
* @return the top margin.
*/
publicint getTopMargin(){
return topMargin;
}
/**
* Sets the top margin to be reserve above components.
*
* @param topMargin the top margin.
*/
publicvoid setTopMargin(int topMargin){
this.topMargin = topMargin;
}
/**
* Gets the left margin to be reserved to the left of the
* leftmost component.
*
* @return the left margin.
*/
publicint getLeftMargin(){
return leftMargin;
}
/**
* Sets the left margin to be reserved to the left of the
* leftmost component.
*
* @param leftMargin the left margin.
*/
publicvoid setLeftMargin(int leftMargin){
this.leftMargin = leftMargin;
}
/**
* Gets the bottom margin to be reserved below all componen
ts.
*
* @return the bottom margin.
*/
publicint getBottomMargin(){
return bottomMargin;
}
/**
* Sets the bottom margin to be reserve below components.
*
* @param bottomMargin the bottom margin.
*/
publicvoid setBottomMargin(int bottomMargin){
this.bottomMargin = bottomMargin;
}
/**
* Gets the right margin to be reserved to the right of the
* rightmost component.
*
* @return the right margin.
*/
COSC 210 - Object Oriented Programming
Assignment 7
Due: Nov 18th
The objectives of this assignment are to:
1) Gain further understanding and experience with inheritance.
2) Gain understanding and experience with polymorphism.
3) Gain further understanding and experience with interfaces.
4) Gain understanding and experience with low level graphics.
5) Modify an existing program to meet new requirements
applying concepts of objectives 1 through 4.
6) Gain experience with medium-size Java program.
7) Continue to practice good programming techniques.
AFTER YOU HAVE COMPLETED, create a zip file named
[your name]Assignment7.zip containing your entire project.
Upload the .zip file to Moodle. Printout all source files you
created or modified. Include a screen shot of the editor with
boxes, ellipses, lines and images shown in the editor. Turn-in
all printouts.
COSC 210 – Fundamentals of Computer Science
Assignment 7 Problem Statement
Updated
On the tomcat drive in folder cosc210 you will find file named
PainterStartup.zip. This file contains the source code for the
start of a Painter program. In its current state, Painter can
create boxes and text objects at given locations. Both boxes
and text objects can be repositioned and resized using a mouse.
The task is to add to the program the implementation for an
ellipse, line, image, and group objects.
Instructions:
1) Add an ellipse object. An ellipse is very similar in
implementation as the box, except it renders an oval instead of a
rectangle. The ellipse can be repositioned by dragging the
object to a new location. The ellipse can be resized by first
clicking over the ellipse to display grab handles and then
dragging a grab handle to a new position. The grab handles are
to be rendered at the same positions as the box. Likewise,
clicking anywhere in the smallest rectangle that encloses the
ellipse performs selection.
2) Add a Line object. A Line is to be created by selecting a
Line tool and then click and drag over the canvas. The line is
rendered from the point of the initial click to the mouse pointer.
On releasing the mouse the construction of the line object is
completed. Have the Line object inherit from
PtrDrawAbstractAreaObject. Thus it will have only two grab
handles.
A Line is selected by clicking anywhere over the line. Right
now if you click anywhere in the rectangular region hold the
line, then the line is selected. To accomplish this task,
override the isOver method in PtrDrawAbstractAreaObject.
Given below is a partial solution to determine if a mouse click
position (the x and y parameters to the isOver method) is over a
line:
double ratio = (double) getWidth() / (double) getHeight();
if (Math.abs((x - getX()) * ratio) - (y - getY()) <= 1) {
return true;
}
You need to modify this code when the y to x ratio is less than -
1 or greater than 1. (Hint: Inverse the roles of width and
height, and the roles of x and y)
3) Add an Image object. An Image object is created by
selecting an Image tool and then clicking anywhere on the
canvas. On clicking the canvas, a File Selection Dialog should
be displayed. The dialog prompts for selection of .gif and .jpg
files. On selecting a .gif or .jpg file and clicking “Open”, an
Image object that renders the image of the selected file is
created at the click position. Image selection and drag
behaviors are the same as a Box object. The image object
additionally renders lines at the edges of the image (as done in
Box).
The code for displaying a File Selection Dialog is:
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileFilter(new FileFilter() {
public boolean accept(File f) {
return f.isDirectory() ||
f.getName().toLowerCase().endsWith(".jpg")
|| f.getName().toLowerCase().endsWith(".gif");
}
public String getDescription() {
return "JPG & GIF Images";
}
});
if (fileChooser.showOpenDialog(editor) ==
JFileChooser.APPROVE_OPTION) {
ImageIcon image = new
ImageIcon(fileChooser.getSelectedFile().getAbsolutePath());
/* you will need to do stuff with your image here
*/
/* note the Graphics object has a method drawImage() */
}
Make sure to import FileFilter from the javax.swing.filechooser.
The above code is added to the PtrDrawImageTool
4) Add a group object. A group object represents a set of
objects that have been grouped together. A partial
implementation is provided. Your task is to fix the rendering.
The group object should draw each of the objects in the
groupedObjects list.
Before drawing any object your will need to create a new
graphics object that is transposed to the dimensions if the group
object itself. To do this use:
Graphics2D g2 = (Graphics2D) g.create(getX(), getY(),
getWidth(),
getHeight());
After drawing each of the objects in groupedObjects list, release
the resources used by the created graphics object by calling
dispose:
g2.dispose();
One more item, after creating the new graphics context and
before drawing each of the objects in the group, use scale as
follows:
g2.scale(getXScale(), getYScale());
This will insure that all objects get rendered as at the right scale
when the group object itself is resized.
5) Have the box, ellipse, line, and image implement the
Lineable and Colorable interface. Create instance variables as
needed to hold the values of the parameters. Before doing any
rendering of lines (e.g., any g.drawXXXX method) create a new
graphics context as follows:
Graphics2D g2 = (Graphics2D) g.create();
Then set the line width by:
g2.setStroke(new BasicStroke(lineWidth));
Also set the color to the lineColor:
g2.setColor(lineColor);
Use g2 to do the rendering of the lines. After all line rendering,
release the resources of the graphics context by calling
dispose();
In the corresponding tool object (e.g., PtrDrawBoxTool for
PtrDrawBox), after creating the draw object add the following
calls in the object:
box.setLineColor(editor.getLineColor());
box.setLineWidth(editor.getLineWidth());
6) Have the box and ellipse, line implement the Colorable
interface. Create instance variables as need to hold the value of
the parameter (color). Before doing any rendering of filled
areas (e.g., any g.fillXXXX method) set the graphics color to
the color instance variable:
g.setColor(color); // or use g2 if you have created a new
graphics context
In the corresponding tool object (e.g., PtrDrawBoxTool for
PtrDrawBox), after creating the draw object add the following
calls in the object:
box.setColor(editor.getColor());
Warning:
Your objects may not render correctly whenever they are
resized such that either the height or width is negative.
Bonus:
1) Bonus 5 points -The isInside method provides the
implementation for determining if the line is inside a
rectangular area as specified by the parameters. This code may
not work right if the ending point of the line is to the left or
above the starting point. Fix this to work in all cases for 3
bonus points.
2) Currently, if you click in the area where two objects overlap,
the object on the bottom is selected. Change this so that the top
object is selected. 3 bonus points.
3) On the Group object, clicking in anywhere in the bounding
rectangle will select the object. Change this so that a group is
only selected with clicking over an object in the group. 3 bonus
points
4) The south east grab handle processing is broken. Fix this to
behave as the other grab handles for 3 bonus points
5) Currently, if you drag the right hand side smaller than the
left (likewise the bottom smaller that the top) the objects may
not be displayed correctly (or even at all). Once in the bad
display state, clicking over the object no longer works. Second,
if you click in the region of overlapping object, the object on
the bottom gets selected. It should be the top object. Fix these
bugs. One possible solution is to add a normalizeRect method to
PtrDrawRect. This will adjust the x, y, width, and height
variables so that width and height are never negative. For
example if width is negative then change x to be the value of x
plus width and then change width to be the absolute value.
Place a call to this method in the corresponding setter methods
after updating the instance variables. (Note there may be
problems with the grab handles). 3 points bonus.

More Related Content

Similar to MTH 115-01 StatsName__________________85 Possible Points.docx

Pro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise ApplicationsPro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise ApplicationsStephen Chin
 
Testing in those hard to reach places
Testing in those hard to reach placesTesting in those hard to reach places
Testing in those hard to reach placesdn
 
Lecture 3.1_ Logistic Regression.pptx
Lecture 3.1_ Logistic Regression.pptxLecture 3.1_ Logistic Regression.pptx
Lecture 3.1_ Logistic Regression.pptxajondaree
 
maxbox starter60 machine learning
maxbox starter60 machine learningmaxbox starter60 machine learning
maxbox starter60 machine learningMax Kleiner
 
Question 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docxQuestion 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docxamrit47
 
An introduction to Machine Learning
An introduction to Machine LearningAn introduction to Machine Learning
An introduction to Machine LearningValéry BERNARD
 
Module 6: Ensemble Algorithms
Module 6:  Ensemble AlgorithmsModule 6:  Ensemble Algorithms
Module 6: Ensemble AlgorithmsSara Hooker
 
Competition 1 (blog 1)
Competition 1 (blog 1)Competition 1 (blog 1)
Competition 1 (blog 1)TarunPaparaju
 
Math for anomaly detection
Math for anomaly detectionMath for anomaly detection
Math for anomaly detectionMenglinLiu1
 
Monte Carlo Simulation lecture.pdf
Monte Carlo Simulation lecture.pdfMonte Carlo Simulation lecture.pdf
Monte Carlo Simulation lecture.pdfWellingtonIsraelQuim
 
Assessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's GuideAssessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's GuideMegan Verbakel
 
Introduction Machine Learning by MyLittleAdventure
Introduction Machine Learning by MyLittleAdventureIntroduction Machine Learning by MyLittleAdventure
Introduction Machine Learning by MyLittleAdventuremylittleadventure
 

Similar to MTH 115-01 StatsName__________________85 Possible Points.docx (20)

Pro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise ApplicationsPro Java Fx – Developing Enterprise Applications
Pro Java Fx – Developing Enterprise Applications
 
Testing in those hard to reach places
Testing in those hard to reach placesTesting in those hard to reach places
Testing in those hard to reach places
 
Quality Python Homework Help
Quality Python Homework HelpQuality Python Homework Help
Quality Python Homework Help
 
Repair dagstuhl jan2017
Repair dagstuhl jan2017Repair dagstuhl jan2017
Repair dagstuhl jan2017
 
Lecture 3.1_ Logistic Regression.pptx
Lecture 3.1_ Logistic Regression.pptxLecture 3.1_ Logistic Regression.pptx
Lecture 3.1_ Logistic Regression.pptx
 
Xgboost
XgboostXgboost
Xgboost
 
How to fake_properly
How to fake_properlyHow to fake_properly
How to fake_properly
 
wk5ppt2_Iris
wk5ppt2_Iriswk5ppt2_Iris
wk5ppt2_Iris
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Backpropagation - Elisa Sayrol - UPC Barcelona 2018Backpropagation - Elisa Sayrol - UPC Barcelona 2018
Backpropagation - Elisa Sayrol - UPC Barcelona 2018
 
Curvefitting
CurvefittingCurvefitting
Curvefitting
 
maxbox starter60 machine learning
maxbox starter60 machine learningmaxbox starter60 machine learning
maxbox starter60 machine learning
 
Question 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docxQuestion 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docx
 
An introduction to Machine Learning
An introduction to Machine LearningAn introduction to Machine Learning
An introduction to Machine Learning
 
Module 6: Ensemble Algorithms
Module 6:  Ensemble AlgorithmsModule 6:  Ensemble Algorithms
Module 6: Ensemble Algorithms
 
Competition 1 (blog 1)
Competition 1 (blog 1)Competition 1 (blog 1)
Competition 1 (blog 1)
 
Math for anomaly detection
Math for anomaly detectionMath for anomaly detection
Math for anomaly detection
 
Monte Carlo Simulation lecture.pdf
Monte Carlo Simulation lecture.pdfMonte Carlo Simulation lecture.pdf
Monte Carlo Simulation lecture.pdf
 
Assessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's GuideAssessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's Guide
 
Introduction Machine Learning by MyLittleAdventure
Introduction Machine Learning by MyLittleAdventureIntroduction Machine Learning by MyLittleAdventure
Introduction Machine Learning by MyLittleAdventure
 

More from rosemarybdodson23141

Young Adulthood begins with the individual being on the verge of att.docx
Young Adulthood begins with the individual being on the verge of att.docxYoung Adulthood begins with the individual being on the verge of att.docx
Young Adulthood begins with the individual being on the verge of att.docxrosemarybdodson23141
 
Your abilities in international management have been recognize.docx
Your abilities in international management have been recognize.docxYour abilities in international management have been recognize.docx
Your abilities in international management have been recognize.docxrosemarybdodson23141
 
your 14 years daughter accidently leaves her purse open in the fam.docx
your 14 years daughter accidently leaves her purse open in the fam.docxyour 14 years daughter accidently leaves her purse open in the fam.docx
your 14 years daughter accidently leaves her purse open in the fam.docxrosemarybdodson23141
 
Young people are ruining the English languageIn your reflectio.docx
Young people are ruining the English languageIn your reflectio.docxYoung people are ruining the English languageIn your reflectio.docx
Young people are ruining the English languageIn your reflectio.docxrosemarybdodson23141
 
Young man drops out of school in seventh grade and becomes his mothe.docx
Young man drops out of school in seventh grade and becomes his mothe.docxYoung man drops out of school in seventh grade and becomes his mothe.docx
Young man drops out of school in seventh grade and becomes his mothe.docxrosemarybdodson23141
 
Young and the RestlessWeek 11 Couples Therapy Movie Experience .docx
Young and the RestlessWeek 11 Couples Therapy Movie Experience .docxYoung and the RestlessWeek 11 Couples Therapy Movie Experience .docx
Young and the RestlessWeek 11 Couples Therapy Movie Experience .docxrosemarybdodson23141
 
You-Attitude A Linguistic PerspectiveLllita RodmanThe Uni.docx
You-Attitude A Linguistic PerspectiveLllita RodmanThe Uni.docxYou-Attitude A Linguistic PerspectiveLllita RodmanThe Uni.docx
You-Attitude A Linguistic PerspectiveLllita RodmanThe Uni.docxrosemarybdodson23141
 
You  may have seen how financial news outlets provide real-time .docx
You  may have seen how financial news outlets provide real-time .docxYou  may have seen how financial news outlets provide real-time .docx
You  may have seen how financial news outlets provide real-time .docxrosemarybdodson23141
 
You  are responsible for putting together the Harmony Day celebr.docx
You  are responsible for putting together the Harmony Day celebr.docxYou  are responsible for putting together the Harmony Day celebr.docx
You  are responsible for putting together the Harmony Day celebr.docxrosemarybdodson23141
 
You wrote this scenario from the perspective of Behaviorism learni.docx
You wrote this scenario from the perspective of Behaviorism learni.docxYou wrote this scenario from the perspective of Behaviorism learni.docx
You wrote this scenario from the perspective of Behaviorism learni.docxrosemarybdodson23141
 
You worked closely with your IT managers to develop a complementing .docx
You worked closely with your IT managers to develop a complementing .docxYou worked closely with your IT managers to develop a complementing .docx
You worked closely with your IT managers to develop a complementing .docxrosemarybdodson23141
 
You work in the office of a personal financial planner. He has asked.docx
You work in the office of a personal financial planner. He has asked.docxYou work in the office of a personal financial planner. He has asked.docx
You work in the office of a personal financial planner. He has asked.docxrosemarybdodson23141
 
You work in the IT department of a financial services company that s.docx
You work in the IT department of a financial services company that s.docxYou work in the IT department of a financial services company that s.docx
You work in the IT department of a financial services company that s.docxrosemarybdodson23141
 
You work for the Jaguars Bank as the Chief Information Officer.  It .docx
You work for the Jaguars Bank as the Chief Information Officer.  It .docxYou work for the Jaguars Bank as the Chief Information Officer.  It .docx
You work for the Jaguars Bank as the Chief Information Officer.  It .docxrosemarybdodson23141
 
You work for OneEarth, an environmental consulting company that .docx
You work for OneEarth, an environmental consulting company that .docxYou work for OneEarth, an environmental consulting company that .docx
You work for OneEarth, an environmental consulting company that .docxrosemarybdodson23141
 
You work for an international construction company that has been con.docx
You work for an international construction company that has been con.docxYou work for an international construction company that has been con.docx
You work for an international construction company that has been con.docxrosemarybdodson23141
 
You will write your Literature Review Section of your EBP Projec.docx
You will write your Literature Review Section of your EBP Projec.docxYou will write your Literature Review Section of your EBP Projec.docx
You will write your Literature Review Section of your EBP Projec.docxrosemarybdodson23141
 
You work for an airline, a small airline, so small you have only one.docx
You work for an airline, a small airline, so small you have only one.docxYou work for an airline, a small airline, so small you have only one.docx
You work for an airline, a small airline, so small you have only one.docxrosemarybdodson23141
 
You work for a small community hospital that has recently updated it.docx
You work for a small community hospital that has recently updated it.docxYou work for a small community hospital that has recently updated it.docx
You work for a small community hospital that has recently updated it.docxrosemarybdodson23141
 
You work for a regional forensic computer lab and have been tasked w.docx
You work for a regional forensic computer lab and have been tasked w.docxYou work for a regional forensic computer lab and have been tasked w.docx
You work for a regional forensic computer lab and have been tasked w.docxrosemarybdodson23141
 

More from rosemarybdodson23141 (20)

Young Adulthood begins with the individual being on the verge of att.docx
Young Adulthood begins with the individual being on the verge of att.docxYoung Adulthood begins with the individual being on the verge of att.docx
Young Adulthood begins with the individual being on the verge of att.docx
 
Your abilities in international management have been recognize.docx
Your abilities in international management have been recognize.docxYour abilities in international management have been recognize.docx
Your abilities in international management have been recognize.docx
 
your 14 years daughter accidently leaves her purse open in the fam.docx
your 14 years daughter accidently leaves her purse open in the fam.docxyour 14 years daughter accidently leaves her purse open in the fam.docx
your 14 years daughter accidently leaves her purse open in the fam.docx
 
Young people are ruining the English languageIn your reflectio.docx
Young people are ruining the English languageIn your reflectio.docxYoung people are ruining the English languageIn your reflectio.docx
Young people are ruining the English languageIn your reflectio.docx
 
Young man drops out of school in seventh grade and becomes his mothe.docx
Young man drops out of school in seventh grade and becomes his mothe.docxYoung man drops out of school in seventh grade and becomes his mothe.docx
Young man drops out of school in seventh grade and becomes his mothe.docx
 
Young and the RestlessWeek 11 Couples Therapy Movie Experience .docx
Young and the RestlessWeek 11 Couples Therapy Movie Experience .docxYoung and the RestlessWeek 11 Couples Therapy Movie Experience .docx
Young and the RestlessWeek 11 Couples Therapy Movie Experience .docx
 
You-Attitude A Linguistic PerspectiveLllita RodmanThe Uni.docx
You-Attitude A Linguistic PerspectiveLllita RodmanThe Uni.docxYou-Attitude A Linguistic PerspectiveLllita RodmanThe Uni.docx
You-Attitude A Linguistic PerspectiveLllita RodmanThe Uni.docx
 
You  may have seen how financial news outlets provide real-time .docx
You  may have seen how financial news outlets provide real-time .docxYou  may have seen how financial news outlets provide real-time .docx
You  may have seen how financial news outlets provide real-time .docx
 
You  are responsible for putting together the Harmony Day celebr.docx
You  are responsible for putting together the Harmony Day celebr.docxYou  are responsible for putting together the Harmony Day celebr.docx
You  are responsible for putting together the Harmony Day celebr.docx
 
You wrote this scenario from the perspective of Behaviorism learni.docx
You wrote this scenario from the perspective of Behaviorism learni.docxYou wrote this scenario from the perspective of Behaviorism learni.docx
You wrote this scenario from the perspective of Behaviorism learni.docx
 
You worked closely with your IT managers to develop a complementing .docx
You worked closely with your IT managers to develop a complementing .docxYou worked closely with your IT managers to develop a complementing .docx
You worked closely with your IT managers to develop a complementing .docx
 
You work in the office of a personal financial planner. He has asked.docx
You work in the office of a personal financial planner. He has asked.docxYou work in the office of a personal financial planner. He has asked.docx
You work in the office of a personal financial planner. He has asked.docx
 
You work in the IT department of a financial services company that s.docx
You work in the IT department of a financial services company that s.docxYou work in the IT department of a financial services company that s.docx
You work in the IT department of a financial services company that s.docx
 
You work for the Jaguars Bank as the Chief Information Officer.  It .docx
You work for the Jaguars Bank as the Chief Information Officer.  It .docxYou work for the Jaguars Bank as the Chief Information Officer.  It .docx
You work for the Jaguars Bank as the Chief Information Officer.  It .docx
 
You work for OneEarth, an environmental consulting company that .docx
You work for OneEarth, an environmental consulting company that .docxYou work for OneEarth, an environmental consulting company that .docx
You work for OneEarth, an environmental consulting company that .docx
 
You work for an international construction company that has been con.docx
You work for an international construction company that has been con.docxYou work for an international construction company that has been con.docx
You work for an international construction company that has been con.docx
 
You will write your Literature Review Section of your EBP Projec.docx
You will write your Literature Review Section of your EBP Projec.docxYou will write your Literature Review Section of your EBP Projec.docx
You will write your Literature Review Section of your EBP Projec.docx
 
You work for an airline, a small airline, so small you have only one.docx
You work for an airline, a small airline, so small you have only one.docxYou work for an airline, a small airline, so small you have only one.docx
You work for an airline, a small airline, so small you have only one.docx
 
You work for a small community hospital that has recently updated it.docx
You work for a small community hospital that has recently updated it.docxYou work for a small community hospital that has recently updated it.docx
You work for a small community hospital that has recently updated it.docx
 
You work for a regional forensic computer lab and have been tasked w.docx
You work for a regional forensic computer lab and have been tasked w.docxYou work for a regional forensic computer lab and have been tasked w.docx
You work for a regional forensic computer lab and have been tasked w.docx
 

Recently uploaded

Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

MTH 115-01 StatsName__________________85 Possible Points.docx

  • 1. MTH 115-01 Stats Name__________________ 85 Possible Points Fall 2015 Part A: For problems 1 - 4, draw the necessary pictures so that I may follow your work. Label all z-scores and areas. Assume that we have a normal distribution with a. (5 pts each) 1. P(x < 75) = __________ 2. P(73 < x < 93) = __________ 3. P(x <73 or x > 75) = __________ 4. P(x = 73) = ___________
  • 2. Part B: Determine whether each statement is true or false. If the statement is false, explain why. (15 points = 3pts each) 1. The total area under the normal distribution bell-shaped curve is infinite. 2. The standard normal distribution is a discrete distribution. 3. The z value corresponding to a number below the mean is always negative. 4. The area under the standard normal distribution to the left of z = 0 is negative. 5. For a standard normal probability distribution, the mean is always 1. Part C: Work the following problems. Please show your work to receive full credit. 1. (15pts) 30 High school students were randomly selected and surveyed about the amounts of time they spend at after-school jobs. The mean and standard deviation were found to be 26 hours and 6 hours, respectively. Assume that the given statistics come from a normally distributed population. a. Find the best point estimate of the population standard deviation.
  • 3. b. Find a 95% confidence interval for the population standard deviation. 2. (10pts) You have just been hired by General Motors to tour the United States giving randomly selected drivers test rides in a new Corvette (yeah, right!). After giving the test drive, you must ask the rider whether he or she would consider buying a Corvette. How many riders must you survey (take for test rides) to be 90% confident that the sample proportion is off by no more than five percentage points? 3. (10pts) Of 2590 students randomly selected, 98% of them own computers. Construct a 99% confidence interval for the true proportion of all students who own computers.
  • 4. 4. (15pts) A food packing company fills sacks of cereal using automated machinery. The fill amounts are normally distributed with a mean weight of 2 pounds and a standard deviation of 0.20 pounds. a) One sack is randomly selected. What is the probability that the weight of the sack exceeds 2.05 pounds? b) Sixteen sacks are randomly selected. What is the probability that the mean weight of the sample of 16 sacks exceeds 2.05 pounds? Page 1 of 3 75 and 10 ms == PainterStartup/.classpath
  • 5. PainterStartup/.project Painter org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature PainterStartup/.settings/org.eclipse.jdt.core.prefs #Fri Apr 27 08:03:31 EDT 2012 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enable d org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
  • 6. 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.6 PainterStartup/com/javera/ui/actions/ActionUtilities.classpacka ge com.javera.ui.actions; publicsynchronizedclass ActionUtilities { public void ActionUtilities(); publicstatic javax.swing.JFrame getFrame(java.util.EventObject); publicstatic javax.swing.JDialog getDialog(java.util.EventObject); publicstatic Object getCommandTarget(java.util.EventObject, Class); } PainterStartup/com/javera/ui/actions/ActionUtilities.javaPainter Startup/com/javera/ui/actions/ActionUtilities.javapackage com.j avera.ui.actions; import java.awt.Component; import java.util.EventObject; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPopupMenu; import javax.swing.SwingUtilities;
  • 7. publicclassActionUtilities{ publicstaticJFrame getFrame(EventObject e){ if(!(e.getSource()instanceofComponent)){ returnnull; } Component comp =(Component) e.getSource(); JFrame frame =(JFrame)SwingUtilities.getAncestorOfClass(JFra me.class, comp); while(frame ==null){ JPopupMenu popupMenu = (JPopupMenu)SwingUtilities.getAncestorOfClass(JPopupMenu. class, comp); if(popupMenu ==null){ returnnull; } comp = popupMenu.getInvoker(); frame =(JFrame)SwingUtilities.getAncestorOfClass(JFr ame.class, comp); } return frame; } publicstaticJDialog getDialog(EventObject e){ if(!(e.getSource()instanceofComponent)){ returnnull; } Component comp =(Component) e.getSource();
  • 8. JDialog dialog =(JDialog)SwingUtilities.getAncestorOfClass(JD ialog.class, comp); while(dialog ==null){ JPopupMenu popupMenu = (JPopupMenu)SwingUtilities.getAncestorOfClass(JPopupMenu. class, comp); if(popupMenu ==null){ returnnull; } comp = popupMenu.getInvoker(); dialog =(JDialog)SwingUtilities.getAncestorOfClass(JD ialog.class, comp); } return dialog; } publicstaticObject getCommandTarget(EventObject e,Class com mandClass){ Object target = getDialog(e); if(target ==null){ target = getFrame(e); } for(;;){ if(target ==null){ returnnull; } if(commandClass.isInstance(target)){
  • 9. return target; } if(!(target instanceofSelectable)) returnnull; target =((Selectable) target).getSelectedItem(); } } } PainterStartup/com/javera/ui/actions/Addable.classpackage com.javera.ui.actions; publicabstractinterface Addable { publicabstract void add(java.awt.event.ActionEvent); publicabstract boolean isAddable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Addable.javaPainterStartu p/com/javera/ui/actions/Addable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent; import java.util.EventObject; /** * Things that support adding a new item (AddAction) should i mplement this interface. */ publicinterfaceAddable{ publicvoid add(ActionEvent e); publicboolean isAddable(EventObject evt); }
  • 10. PainterStartup/com/javera/ui/actions/AddAction.classpackage com.javera.ui.actions; publicsynchronizedclass AddAction extends ManagedStateAction { privatestatic AddAction addAction; static void <clinit>(); private void AddAction(); publicstatic AddAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/AddAction.javaPainterStar tup/com/javera/ui/actions/AddAction.javapackage com.javera.ui .actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import com.javera.ui.IconManager; publicclassAddActionextendsManagedStateAction{ privatestaticAddAction addAction =newAddAction(); privateAddAction(){ super("New...",IconManager.getIcon("Add.gif")); putValue(Action.SHORT_DESCRIPTION,"New"); } publicstaticAddAction getAction(){ return addAction; }
  • 11. publicvoid actionPerformed(ActionEvent e ){ Addable target =(Addable)ActionUtilities.getCommandTarget( e , Addable.class); if( target !=null&& target.isAddable( e )){ target.add( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Addable target =(Addable)ActionUtilities.getCommandTarget( e vt, Addable.class); if( target !=null){ return target.isAddable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Closeable.classpackage com.javera.ui.actions; publicabstractinterface Closeable { publicabstract void close(java.awt.event.ActionEvent); publicabstract boolean isCloseable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Closeable.javaPainterStart up/com/javera/ui/actions/Closeable.javapackage com.javera.ui.a ctions;
  • 12. import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved. * @author David T. Smith */ publicinterfaceCloseable{ publicvoid close(ActionEvent evt); publicboolean isCloseable(EventObject evt); } PainterStartup/com/javera/ui/actions/CloseAction.classpackage com.javera.ui.actions; publicsynchronizedclass CloseAction extends ManagedStateAction { privatestatic CloseAction saveAction; static void <clinit>(); private void CloseAction(); publicstatic CloseAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/CloseAction.javaPainterSt artup/com/javera/ui/actions/CloseAction.java//Copyright 2004, ( c) Javera Software, LLC. as an unpublished work. All rights res erved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui.actions;
  • 13. import java.awt.event.ActionEvent; import java.util.EventObject; publicclassCloseActionextendsManagedStateAction{ privatestaticCloseAction saveAction =newCloseAction(); privateCloseAction(){ super("Close"); putValue(javax.swing.Action.SHORT_DESCRIPTION,"Cl ose"); } publicstaticCloseAction getAction(){ return saveAction; } publicvoid actionPerformed(ActionEvent e){ Closeable target = (Closeable)ActionUtilities.getCommandTarget(e,Closeable.class ); if(target !=null&& target.isCloseable(e)){ target.close(e); } } publicboolean isTargetEnabled(EventObject evt){ Closeable target = (Closeable)ActionUtilities.getCommandTarget(evt,Closeable.cla ss); if(target !=null){ return target.isCloseable(evt); }else{ returnfalse; }
  • 14. } } PainterStartup/com/javera/ui/actions/CloseAllable.classpackage com.javera.ui.actions; publicabstractinterface CloseAllable { publicabstract boolean closeAll(java.awt.event.ActionEvent); publicabstract boolean isCloseAllable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/CloseAllable.javaPainterSt artup/com/javera/ui/actions/CloseAllable.javapackage com.javer a.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved. * @author David T. Smith */ publicinterfaceCloseAllable{ publicboolean closeAll(ActionEvent evt); publicboolean isCloseAllable(EventObject evt); } PainterStartup/com/javera/ui/actions/CloseAllAction.classpacka ge com.javera.ui.actions; publicsynchronizedclass CloseAllAction extends javax.swing.AbstractAction { privatestatic CloseAllAction saveAllAction;
  • 15. static void <clinit>(); private void CloseAllAction(); publicstatic CloseAllAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/CloseAllAction.javaPainte rStartup/com/javera/ui/actions/CloseAllAction.javapackage com .javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.AbstractAction; publicclassCloseAllActionextendsAbstractAction{ privatestaticCloseAllAction saveAllAction =newCloseAllAction (); privateCloseAllAction(){ super("Close All..."); putValue(javax.swing.Action.SHORT_DESCRIPTION,"Cl ose All"); } publicstaticCloseAllAction getAction(){ return saveAllAction; } publicvoid actionPerformed(ActionEvent e){ CloseAllable target = (CloseAllable)ActionUtilities.getCommandTarget(e,CloseAllabl e.class); if(target !=null&& target.isCloseAllable(e)){
  • 16. target.closeAll(e); } } publicboolean isTargetEnabled(EventObject evt){ CloseAllable target = (CloseAllable)ActionUtilities.getCommandTarget(evt,CloseAlla ble.class); if(target !=null){ return target.isCloseAllable(evt); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Copyable.classpackage com.javera.ui.actions; publicabstractinterface Copyable { publicabstract void copy(java.awt.event.ActionEvent); publicabstract boolean isCopyable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Copyable.javaPainterStartu p/com/javera/ui/actions/Copyable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * Components interested in interacting with CopyAction (e.g. h
  • 17. ave UI-level * Copy support) should implement this. */ publicinterfaceCopyable{ /** * Tells the Component to do the Copy. */ publicvoid copy(ActionEvent evt ); /** Return true if a Copy is current possible. */ publicboolean isCopyable(EventObject evt ); } PainterStartup/com/javera/ui/actions/CopyAction.classpackage com.javera.ui.actions; publicsynchronizedclass CopyAction extends ManagedStateAction implements java.awt.datatransfer.ClipboardOwner { privatestatic CopyAction copyAction; static void <clinit>(); private void CopyAction(); publicstatic CopyAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); public void lostOwnership(java.awt.datatransfer.Clipboard, java.awt.datatransfer.Transferable); } PainterStartup/com/javera/ui/actions/CopyAction.javaPainterSta rtup/com/javera/ui/actions/CopyAction.javapackage com.javera. ui.actions;
  • 18. import java.awt.Event; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; import com.javera.ui.IconManager; publicclassCopyActionextendsManagedStateActionimplementsC lipboardOwner{ privatestaticCopyAction copyAction =newCopyAction(); privateCopyAction(){ super("Copy",IconManager.getIcon("Copy.gif")); putValue(Action.MNEMONIC_KEY,newInteger('C')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Copy"); } publicstaticCopyAction getAction(){return copyAction;} publicvoid actionPerformed(ActionEvent e ){ Copyable copyable =(Copyable) ActionUtilities.getCommandTarget( e,Copyable.class); if( copyable !=null){ copyable.copy( e ); }
  • 19. } publicboolean isTargetEnabled(EventObject evt ){ Copyable copyable =(Copyable) ActionUtilities.getCommandTarget( evt,Copyable.class); if( copyable !=null){ return copyable.isCopyable( evt ); }else{ returnfalse; } } publicvoid lostOwnership(Clipboard clipboard,Transferable t ){ // no need to do anything here, but required to put data on Clipb oard } } PainterStartup/com/javera/ui/actions/Cutable.classpackage com.javera.ui.actions; publicabstractinterface Cutable { publicabstract void cut(java.awt.event.ActionEvent); publicabstract boolean isCutable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Cutable.javaPainterStartup /com/javera/ui/actions/Cutable.javapackage com.javera.ui.action s; import java.awt.event.ActionEvent;
  • 20. import java.util.EventObject; publicinterfaceCutable{ /** * Tells the component to do the Cut. */ publicvoid cut(ActionEvent evt ); /** Returns true if a Cut is currently possible. */ publicboolean isCutable(EventObject evt ); } PainterStartup/com/javera/ui/actions/CutAction.classpackage com.javera.ui.actions; publicsynchronizedclass CutAction extends ManagedStateAction implements java.awt.datatransfer.ClipboardOwner { privatestatic CutAction cutAction; static void <clinit>(); private void CutAction(); publicstatic CutAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); public void lostOwnership(java.awt.datatransfer.Clipboard, java.awt.datatransfer.Transferable); } PainterStartup/com/javera/ui/actions/CutAction.javaPainterStart up/com/javera/ui/actions/CutAction.javapackage com.javera.ui.a ctions;
  • 21. import java.awt.Event; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.ClipboardOwner; import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; import com.javera.ui.IconManager; publicclassCutActionextendsManagedStateActionimplementsCli pboardOwner{ privatestaticCutAction cutAction =newCutAction(); privateCutAction(){ super("Cut",IconManager.getIcon("Cut.gif")); putValue(Action.MNEMONIC_KEY,newInteger('t')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_X,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Cut"); } publicstaticCutAction getAction(){return cutAction;} publicvoid actionPerformed(ActionEvent e ){ Cutable cutable =(Cutable) ActionUtilities.getCommandTarget( e,Cutable.class); if( cutable !=null){ cutable.cut( e ); }
  • 22. } publicboolean isTargetEnabled(EventObject evt ){ Cutable cutable =(Cutable) ActionUtilities.getCommandTarget( evt,Cutable.class); if( cutable !=null){ return cutable.isCutable( evt ); }else{ returnfalse; } } publicvoid lostOwnership(Clipboard par1,Transferable par2 ){ // following a paste, cut should probably be disabled at least unt il // a new event re-enables it this.setEnabled(false); } } PainterStartup/com/javera/ui/actions/Deleteable.classpackage com.javera.ui.actions; publicabstractinterface Deleteable { publicabstract void delete(java.awt.event.ActionEvent); publicabstract boolean isDeleteable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Deleteable.javaPainterStart up/com/javera/ui/actions/Deleteable.javapackage com.javera.ui. actions;
  • 23. import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceDeleteable{ publicvoid delete(ActionEvent evt); publicboolean isDeleteable(EventObject evt); } PainterStartup/com/javera/ui/actions/DeleteAction.classpackage com.javera.ui.actions; publicsynchronizedclass DeleteAction extends ManagedStateAction { privatestatic DeleteAction deleteAction; static void <clinit>(); private void DeleteAction(); publicstatic DeleteAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/DeleteAction.javaPainterSt artup/com/javera/ui/actions/DeleteAction.javapackage com.jave ra.ui.actions; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke;
  • 24. import com.javera.ui.IconManager; publicclassDeleteActionextendsManagedStateAction{ privatestaticDeleteAction deleteAction =newDeleteAction(); privateDeleteAction(){ super("Delete",IconManager.getIcon("Delete.gif")); putValue(Action.MNEMONIC_KEY,newInteger('D')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0)); putValue(Action.SHORT_DESCRIPTION,"Delete"); } publicstaticDeleteAction getAction(){return deleteAction;} publicvoid actionPerformed(ActionEvent evt ){ Deleteable deletable =(Deleteable) ActionUtilities.getCommandTarget( evt,Deleteable.class); if( deletable !=null){ deletable.delete( evt ); } } publicboolean isTargetEnabled(EventObject evt ){ Deleteable deletable =(Deleteable) ActionUtilities.getCommandTarget( evt,Deleteable.class); if( deletable !=null){ return deletable.isDeleteable( evt ); }else{ returnfalse; } } }
  • 25. PainterStartup/com/javera/ui/actions/Exitable.classpackage com.javera.ui.actions; publicabstractinterface Exitable { publicabstract void exit(java.awt.event.ActionEvent); publicabstract boolean isExitable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Exitable.javaPainterStartu p/com/javera/ui/actions/Exitable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceExitable{ publicvoid exit(ActionEvent evt); publicboolean isExitable(EventObject evt); } PainterStartup/com/javera/ui/actions/ExitAction.classpackage com.javera.ui.actions; publicsynchronizedclass ExitAction extends javax.swing.AbstractAction { privatestatic ExitAction exitAction; static void <clinit>(); private void ExitAction(); publicstatic ExitAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); }
  • 26. PainterStartup/com/javera/ui/actions/ExitAction.javaPainterStar tup/com/javera/ui/actions/ExitAction.javapackage com.javera.ui .actions; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.KeyStroke; publicclassExitActionextendsAbstractAction{ privatestaticExitAction exitAction =newExitAction(); privateExitAction(){ super("Exit"); putValue(Action.MNEMONIC_KEY,newInteger('x')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F4,Event.ALT_MASK ) ); } publicstaticExitAction getAction(){return exitAction;} publicvoid actionPerformed(ActionEvent e ){ Exitable exitable =(Exitable) ActionUtilities.getCommandTarget( e,Exitable.class); if( exitable !=null){ exitable.exit( e ); }
  • 27. } publicboolean isTargetEnabled(EventObject evt ){ Exitable exitable =(Exitable) ActionUtilities.getCommandTarget( evt,Exitable.class); if( exitable !=null){ return exitable.isExitable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Exportable.classpackage com.javera.ui.actions; publicabstractinterface Exportable { publicabstract void export(java.awt.event.ActionEvent); publicabstract boolean isExportable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Exportable.javaPainterStar tup/com/javera/ui/actions/Exportable.java/* Generated by Toget her */ package com.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis
  • 28. h to work * with Export actions. */ publicinterfaceExportable{ /** * Performs the Export action. */ publicvoid export(ActionEvent evt ); /** * Implementing object should use this method to specify wh ether an Export * is currently performable. */ publicboolean isExportable(EventObject evt ); } PainterStartup/com/javera/ui/actions/ExportAction.classpackage com.javera.ui.actions; publicsynchronizedclass ExportAction extends ManagedStateAction { privatestatic ExportAction exportAction; static void <clinit>(); private void ExportAction(); publicstatic ExportAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/ExportAction.javaPainterS tartup/com/javera/ui/actions/ExportAction.java/* Generated by Together */ package com.javera.ui.actions;
  • 29. import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; publicclassExportActionextendsManagedStateAction{ privatestaticExportAction exportAction =newExportAction(); privateExportAction(){ super("Export..."); putValue(Action.MNEMONIC_KEY,newInteger('t')); putValue(Action.SHORT_DESCRIPTION,"Export"); } publicstaticExportAction getAction(){ return exportAction; } publicvoid actionPerformed(ActionEvent e ){ Exportable exportable =(Exportable) ActionUtilities.getCommandTarget( e,Exportable.class); if( exportable !=null) exportable.export( e ); } publicboolean isTargetEnabled(EventObject evt ){ Object target =ActionUtilities.getCommandTarget( evt, Exportable.class); if( target !=null){ if(((Exportable)target ).isExportable( evt )){ returntrue; } } returnfalse; }
  • 30. } PainterStartup/com/javera/ui/actions/Filterable.classpackage com.javera.ui.actions; publicabstractinterface Filterable { publicabstract void filter(java.awt.event.ActionEvent); publicabstract boolean isFilterable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Filterable.javaPainterStart up/com/javera/ui/actions/Filterable.javapackage com.javera.ui.a ctions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceFilterable{ publicvoid filter(ActionEvent evt); publicboolean isFilterable(EventObject evt); } PainterStartup/com/javera/ui/actions/FilterAction.classpackage com.javera.ui.actions; publicsynchronizedclass FilterAction extends ManagedStateAction { privatestatic FilterAction filterAction; static void <clinit>(); private void FilterAction(); publicstatic FilterAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); }
  • 31. PainterStartup/com/javera/ui/actions/FilterAction.javaPainterSta rtup/com/javera/ui/actions/FilterAction.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import com.javera.ui.IconManager; publicclassFilterActionextendsManagedStateAction{ privatestaticFilterAction filterAction =newFilterAction(); privateFilterAction(){ super("Filter...",IconManager.getIcon("filter.gif")); putValue(Action.MNEMONIC_KEY,newInteger('F')); putValue(Action.SHORT_DESCRIPTION,"Filter"); } publicstaticFilterAction getAction(){return filterAction;} publicvoid actionPerformed(ActionEvent e ){ Filterable filterable =(Filterable) ActionUtilities.getCommandTarget( e,Filterable.class); if( filterable !=null){ filterable.filter( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Filterable filterable =(Filterable) ActionUtilities.getCommandTarget( evt,Filterable.class);
  • 32. if( filterable !=null){ return filterable.isFilterable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Findable.classpackage com.javera.ui.actions; publicabstractinterface Findable { publicabstract void find(java.awt.event.ActionEvent); publicabstract boolean isFindable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Findable.javaPainterStartu p/com/javera/ui/actions/Findable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Find actions. */ publicinterfaceFindable{ /** Performs the Find action. */ publicvoid find(ActionEvent evt ); /**
  • 33. * Implementing object should use this method to specify wh ether a Find * is currently performable. */ publicboolean isFindable(EventObject evt ); } PainterStartup/com/javera/ui/actions/FindAction.classpackage com.javera.ui.actions; publicsynchronizedclass FindAction extends ManagedStateAction { privatestatic FindAction findAction; static void <clinit>(); private void FindAction(); publicstatic FindAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/FindAction.javaPainterStar tup/com/javera/ui/actions/FindAction.javapackage com.javera.ui .actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import com.javera.ui.IconManager; /** A managed state action for Find operations. */ publicclassFindActionextendsManagedStateAction{ privatestaticFindAction findAction =newFindAction();
  • 34. privateFindAction(){ super("Find...",IconManager.getIcon("search.gif")); putValue(Action.MNEMONIC_KEY,newInteger('F')); putValue(Action.SHORT_DESCRIPTION,"Find"); putValue(Action.LONG_DESCRIPTION,"Finds text value s"); } publicstaticFindAction getAction(){return findAction;} publicvoid actionPerformed(ActionEvent e ){ Findable findable =(Findable) ActionUtilities.getCommandTarget( e,Findable.class); if( findable !=null){ findable.find( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Findable findable =(Findable) ActionUtilities.getCommandTarget( evt,Findable.class); if( findable !=null){ return findable.isFindable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Groupable.classpackage com.javera.ui.actions;
  • 35. publicabstractinterface Groupable { publicabstract void group(java.awt.event.ActionEvent); publicabstract boolean isGroupable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Groupable.javaPainterStart up/com/javera/ui/actions/Groupable.javapackage com.javera.ui. actions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceGroupable{ /** * Tells the component to do the group. */ publicvoid group(ActionEvent evt ); /** Returns true if a group is currently possible. */ publicboolean isGroupable(EventObject evt ); } PainterStartup/com/javera/ui/actions/GroupAction.classpackage com.javera.ui.actions; publicsynchronizedclass GroupAction extends ManagedStateAction { privatestatic GroupAction groupAction; static void <clinit>(); private void GroupAction(); publicstatic GroupAction getAction(); public void actionPerformed(java.awt.event.ActionEvent);
  • 36. public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/GroupAction.javaPainterSt artup/com/javera/ui/actions/GroupAction.javapackage com.javer a.ui.actions; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; publicclassGroupActionextendsManagedStateAction{ privatestaticGroupAction groupAction =newGroupAction(); privateGroupAction(){ super("Group"); putValue(Action.MNEMONIC_KEY,newInteger('G')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_G,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Group"); } publicstaticGroupAction getAction(){return groupAction;} publicvoid actionPerformed(ActionEvent e ){ Groupable group =(Groupable) ActionUtilities.getCommandTarget( e,Groupable.class); if( group !=null){
  • 37. group.group( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Groupable group =(Groupable) ActionUtilities.getCommandTarget( evt,Groupable.class); if( group !=null){ return group.isGroupable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/ManagedStateAction.class package com.javera.ui.actions; publicabstractsynchronizedclass ManagedStateAction extends javax.swing.AbstractAction { privatestatic java.util.ArrayList managedActions; static void <clinit>(); public void ManagedStateAction(); public void ManagedStateAction(String); public void ManagedStateAction(String, javax.swing.Icon); publicabstract boolean isTargetEnabled(java.util.EventObject); publicstatic void setStateFor(java.util.EventObject); } PainterStartup/com/javera/ui/actions/ManagedStateAction.javaP
  • 38. ainterStartup/com/javera/ui/actions/ManagedStateAction.javapa ckage com.javera.ui.actions; import java.util.ArrayList; import java.util.EventObject; import java.util.Iterator; import javax.swing.AbstractAction; import javax.swing.Icon; publicabstractclassManagedStateActionextendsAbstractAction{ privatestaticArrayList managedActions =newArrayList(); publicManagedStateAction(){ super(); managedActions.add(this); this.setEnabled(true); } publicManagedStateAction(String label){ super(label); managedActions.add(this); this.setEnabled(true); } publicManagedStateAction(String label,Icon icon){ super(label, icon); managedActions.add(this); this.setEnabled(true); } publicabstractboolean isTargetEnabled(EventObject evt); publicstaticvoid setStateFor(EventObject evt){ for(Iterator iter = managedActions.iterator(); iter.hasNext();){ ManagedStateAction action =(ManagedStateAction) iter.next();
  • 39. action.setEnabled(action.isTargetEnabled(evt)); } } } PainterStartup/com/javera/ui/actions/Newable.classpackage com.javera.ui.actions; publicabstractinterface Newable { publicabstract javax.swing.JInternalFrame makeNew(java.awt.event.ActionEvent); publicabstract boolean isNewable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Newable.javaPainterStartu p/com/javera/ui/actions/Newable.javapackage com.javera.ui.acti ons; import javax.swing.JInternalFrame; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceNewable{ publicJInternalFrame makeNew(ActionEvent evt); publicboolean isNewable(EventObject evt); } PainterStartup/com/javera/ui/actions/NewAction.classpackage com.javera.ui.actions; publicsynchronizedclass NewAction extends javax.swing.AbstractAction { privatestatic NewAction newAction; static void <clinit>();
  • 40. private void NewAction(); publicstatic NewAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/NewAction.javaPainterStar tup/com/javera/ui/actions/NewAction.javapackage com.javera.ui .actions; import com.javera.ui.IconManager; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.AbstractAction; publicclassNewActionextendsAbstractAction{ privatestaticNewAction newAction =newNewAction(); privateNewAction(){ super("New...",IconManager.getIcon("New.gif")); putValue(Action.SHORT_DESCRIPTION,"New"); } publicstaticNewAction getAction(){ return newAction; } publicvoid actionPerformed(ActionEvent e ){ Newable newable =(Newable) ActionUtilities.getCommandTarget( e,Newable.class); if( newable !=null){ newable.makeNew( e );
  • 41. } } publicboolean isTargetEnabled(EventObject evt ){ Newable newable =(Newable) ActionUtilities.getCommandTarget( evt,Newable.class); if( newable !=null){ return newable.isNewable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Openable.classpackage com.javera.ui.actions; publicabstractinterface Openable { publicabstract void open(java.awt.event.ActionEvent); publicabstract boolean isOpenable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Openable.javaPainterStartu p/com/javera/ui/actions/Openable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceOpenable{ publicvoid open(ActionEvent evt); publicboolean isOpenable(EventObject evt); }
  • 42. PainterStartup/com/javera/ui/actions/OpenableSpecial.classpack age com.javera.ui.actions; publicabstractinterface OpenableSpecial { publicabstract javax.swing.JInternalFrame openSpecial(); publicabstract boolean isOpenableSpecial(java.util.EventObject); } PainterStartup/com/javera/ui/actions/OpenableSpecial.javaPaint erStartup/com/javera/ui/actions/OpenableSpecial.javapackage c om.javera.ui.actions; import java.util.EventObject; import javax.swing.JInternalFrame; publicinterfaceOpenableSpecial{ publicJInternalFrame openSpecial(); publicboolean isOpenableSpecial(EventObject evt); } PainterStartup/com/javera/ui/actions/OpenAction.classpackage com.javera.ui.actions; publicsynchronizedclass OpenAction extends ManagedStateAction { privatestatic OpenAction openAction; static void <clinit>(); private void OpenAction(); publicstatic OpenAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); }
  • 43. PainterStartup/com/javera/ui/actions/OpenAction.javaPainterSta rtup/com/javera/ui/actions/OpenAction.javapackage com.javera. ui.actions; import com.javera.ui.IconManager; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; publicclassOpenActionextendsManagedStateAction{ privatestaticOpenAction openAction =newOpenAction(); privateOpenAction(){ super("Open...",IconManager.getIcon("Open.gif")); putValue(Action.SHORT_DESCRIPTION,"Open"); } publicstaticOpenAction getAction(){ return openAction; } publicvoid actionPerformed(ActionEvent e ){ Openable openable =(Openable) ActionUtilities.getCommandTarget( e,Openable.class); if( openable !=null){ openable.open( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Openable openable =(Openable) ActionUtilities.getCommandTarget( evt,Openable.class);
  • 44. if( openable !=null){ return openable.isOpenable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/OpenSpecialAction.classpa ckage com.javera.ui.actions; publicsynchronizedclass OpenSpecialAction extends ManagedStateAction { privatestatic OpenSpecialAction openSpecialAction; static void <clinit>(); private void OpenSpecialAction(); publicstatic OpenSpecialAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/OpenSpecialAction.javaPai nterStartup/com/javera/ui/actions/OpenSpecialAction.javapacka ge com.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import com.javera.ui.IconManager; publicclassOpenSpecialActionextendsManagedStateAction{ privatestaticOpenSpecialAction openSpecialAction =newOpenS pecialAction();
  • 45. privateOpenSpecialAction() { super("Open Special...",IconManager.getIcon("Open.gif")); } publicstaticOpenSpecialAction getAction(){ return openSpecialAction; } publicvoid actionPerformed(ActionEvent e) { OpenableSpecial openable =(OpenableSpecial)ActionUtilities.g etCommandTarget(e,OpenableSpecial.class); if(openable !=null){ openable.openSpecial(); } } publicboolean isTargetEnabled(EventObject evt){ OpenableSpecial openable =(OpenableSpecial)ActionUtilities.g etCommandTarget(evt,OpenableSpecial.class); if(openable !=null){ return openable.isOpenableSpecial(evt); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/PageSetupable.classpackag e com.javera.ui.actions; publicabstractinterface PageSetupable {
  • 46. publicabstract void pageSetup(java.awt.event.ActionEvent); publicabstract boolean isPageSetupable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/PageSetupable.javaPainter Startup/com/javera/ui/actions/PageSetupable.javapackage com.j avera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Print actions. */ publicinterfacePageSetupable{ /** Performs the Print action. */ publicvoid pageSetup(ActionEvent evt ); /** * Implementing object should use this method to specify wh ether a Print * is currently performable. */ publicboolean isPageSetupable(EventObject evt ); } PainterStartup/com/javera/ui/actions/PageSetupAction.classpack age com.javera.ui.actions; publicsynchronizedclass PageSetupAction extends javax.swing.AbstractAction { privatestatic PageSetupAction pageSetupAction;
  • 47. static void <clinit>(); private void PageSetupAction(); publicstatic PageSetupAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/PageSetupAction.javaPaint erStartup/com/javera/ui/actions/PageSetupAction.javapackage c om.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.AbstractAction; import javax.swing.Action; publicclassPageSetupActionextendsAbstractAction { privatestaticPageSetupAction pageSetupAction =newPageSetup Action(); privatePageSetupAction(){ super("Page Setup..."); putValue(Action.SHORT_DESCRIPTION,"Page Setup"); } publicstaticPageSetupAction getAction(){ return pageSetupAction; } publicvoid actionPerformed(ActionEvent e){ PageSetupable pageSetupable = (PageSetupable)ActionUtilities.getCommandTarget(e,PageSetup able.class);
  • 48. if(pageSetupable !=null) pageSetupable.pageSetup(e); } publicboolean isTargetEnabled(EventObject evt){ Object target =ActionUtilities.getCommandTarget(evt,PageSetu pable.class); if(target !=null){ if(((PageSetupable) target).isPageSetupable(evt)){ returntrue; } } returnfalse; } } PainterStartup/com/javera/ui/actions/Pasteable.classpackage com.javera.ui.actions; publicabstractinterface Pasteable { publicabstract void paste(java.awt.event.ActionEvent); publicabstract boolean isPasteable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Pasteable.javaPainterStartu p/com/javera/ui/actions/Pasteable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * Components interested in interaction with PasteAction should * implement this.
  • 49. */ publicinterfacePasteable{ /** Hands the component the object that's been Pasted. */ publicvoid paste(ActionEvent evt); /** Returns true if a Paste is currently possible. */ publicboolean isPasteable(EventObject evt ); } PainterStartup/com/javera/ui/actions/PasteAction.classpackage com.javera.ui.actions; publicsynchronizedclass PasteAction extends ManagedStateAction { privatestatic PasteAction pasteAction; static void <clinit>(); private void PasteAction(); publicstatic PasteAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/PasteAction.javaPainterSta rtup/com/javera/ui/actions/PasteAction.javapackage com.javera. ui.actions; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action;
  • 50. import javax.swing.KeyStroke; import com.javera.ui.IconManager; publicclassPasteActionextendsManagedStateAction{ privatestaticPasteAction pasteAction =newPasteAction(); privatePasteAction(){ super("Paste",IconManager.getIcon("Paste.gif")); putValue(Action.MNEMONIC_KEY,newInteger('P')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Paste"); } publicstaticPasteAction getAction(){return pasteAction;} publicvoid actionPerformed(ActionEvent e ){ Pasteable pasteable =(Pasteable) ActionUtilities.getCommandTarget( e,Pasteable.class); if( pasteable !=null){ pasteable.paste( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Pasteable pasteable =(Pasteable) ActionUtilities.getCommandTarget( evt,Pasteable.class); if( pasteable !=null){ return pasteable.isPasteable( evt ); }else{
  • 51. returnfalse; } } } PainterStartup/com/javera/ui/actions/Printable.classpackage com.javera.ui.actions; publicabstractinterface Printable { publicabstract void print(java.awt.event.ActionEvent); publicabstract boolean isPrintable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Printable.javaPainterStartu p/com/javera/ui/actions/Printable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Print actions. */ publicinterfacePrintable{ /** Performs the Print action. */ publicvoid print(ActionEvent evt ); /** * Implementing object should use this method to specify wh ether a Print
  • 52. * is currently performable. */ publicboolean isPrintable(EventObject evt ); } PainterStartup/com/javera/ui/actions/PrintAction.classpackage com.javera.ui.actions; publicsynchronizedclass PrintAction extends ManagedStateAction { privatestatic PrintAction printAction; static void <clinit>(); private void PrintAction(); publicstatic PrintAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/PrintAction.javaPainterSta rtup/com/javera/ui/actions/PrintAction.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; import com.javera.ui.IconManager; publicclassPrintActionextendsManagedStateAction{ privatestaticPrintAction printAction =newPrintAction(); privatePrintAction(){ super("Print...",IconManager.getIcon("Print.gif")); putValue(Action.MNEMONIC_KEY,newInteger('i'));
  • 53. putValue(Action.SHORT_DESCRIPTION,"Print"); } publicstaticPrintAction getAction(){ return printAction; } publicvoid actionPerformed(ActionEvent e){ Printable printable = (Printable)ActionUtilities.getCommandTarget(e,Printable.class) ; if(printable !=null) printable.print(e); } publicboolean isTargetEnabled(EventObject evt){ Object target =ActionUtilities.getCommandTarget(evt,Printable. class); if(target !=null){ if(((Printable) target).isPrintable(evt)){ returntrue; } } returnfalse; } } PainterStartup/com/javera/ui/actions/Redoable.classpackage com.javera.ui.actions; publicabstractinterface Redoable { publicabstract void redo(java.awt.event.ActionEvent); publicabstract boolean isRedoable(java.util.EventObject); }
  • 54. PainterStartup/com/javera/ui/actions/Redoable.javaPainterStartu p/com/javera/ui/actions/Redoable.javapackage com.javera.ui.act ions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceRedoable{ publicvoid redo(ActionEvent evt); publicboolean isRedoable(EventObject evt); } PainterStartup/com/javera/ui/actions/RedoAction.classpackage com.javera.ui.actions; publicsynchronizedclass RedoAction extends ManagedStateAction { privatestatic RedoAction redoAction; static void <clinit>(); private void RedoAction(); publicstatic RedoAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/RedoAction.javaPainterSta rtup/com/javera/ui/actions/RedoAction.javapackage com.javera. ui.actions; import com.javera.ui.IconManager; import java.awt.Event; import java.awt.event.ActionEvent;
  • 55. import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; publicclassRedoActionextendsManagedStateAction{ privatestaticRedoAction redoAction =newRedoAction(); privateRedoAction(){ super("Redo",IconManager.getIcon("Redo.gif")); putValue(Action.MNEMONIC_KEY,newInteger('R')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK +Event.SHIFT_MASK )); putValue(Action.SHORT_DESCRIPTION,"Redo"); } publicstaticRedoAction getAction(){ return redoAction; } publicvoid actionPerformed(ActionEvent evt ){ Redoable redoable =(Redoable) ActionUtilities.getCommandTarget( evt,Redoable.class); if( redoable !=null) redoable.redo( evt ); } publicboolean isTargetEnabled(EventObject evt ){ Redoable redoable =(Redoable) ActionUtilities.getCommandTarget( evt,Redoable.class); if( redoable !=null){ return redoable.isRedoable( evt ); }else{
  • 56. returnfalse; } } } PainterStartup/com/javera/ui/actions/Refreshable.classpackage com.javera.ui.actions; publicabstractinterface Refreshable { publicabstract void refresh(java.awt.event.ActionEvent); publicabstract boolean isRefreshable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Refreshable.javaPainterSta rtup/com/javera/ui/actions/Refreshable.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by components that wis h to work * with Refresh actions. */ publicinterfaceRefreshable{ /** Performs the Find action. */ publicvoid refresh(ActionEvent evt ); /** * Implementing object should use this method to specify wh ether a Refresh * is currently performable. */ publicboolean isRefreshable(EventObject evt );
  • 57. } PainterStartup/com/javera/ui/actions/RefreshAction.classpackag e com.javera.ui.actions; publicsynchronizedclass RefreshAction extends ManagedStateAction { privatestatic RefreshAction refreshAction; static void <clinit>(); private void RefreshAction(); publicstatic RefreshAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/RefreshAction.javaPainter Startup/com/javera/ui/actions/RefreshAction.javapackage com.j avera.ui.actions; import com.javera.ui.IconManager; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; /** A managed state action for Refresh operations. */ publicclassRefreshActionextendsManagedStateAction{ privatestaticRefreshAction refreshAction =newRefreshAction(); privateRefreshAction(){ super("Refresh...",IconManager.getIcon("Refresh.gif")); putValue(Action.MNEMONIC_KEY,newInteger('F')); putValue(Action.SHORT_DESCRIPTION,"Refresh"); putValue(Action.LONG_DESCRIPTION,"Refresh"); }
  • 58. publicstaticRefreshAction getAction(){ return refreshAction; } publicvoid actionPerformed(ActionEvent e ){ Refreshable refreshable =(Refreshable) ActionUtilities.getCommandTarget( e,Refreshable.class); if( refreshable !=null) refreshable.refresh( e ); } publicboolean isTargetEnabled(EventObject evt ){ Refreshable refreshable =(Refreshable) ActionUtilities.getCommandTarget( evt,Refreshable.class); if( refreshable !=null){ return refreshable.isRefreshable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Saveable.classpackage com.javera.ui.actions; publicabstractinterface Saveable { publicabstract void save(java.awt.event.ActionEvent); publicabstract boolean isSaveable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Saveable.javaPainterStartu p/com/javera/ui/actions/Saveable.javapackage com.javera.ui.acti
  • 59. ons; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved. * @author David T. Smith */ publicinterfaceSaveable{ publicvoid save(ActionEvent evt); publicboolean isSaveable(EventObject evt); } PainterStartup/com/javera/ui/actions/SaveAction.classpackage com.javera.ui.actions; publicsynchronizedclass SaveAction extends ManagedStateAction { privatestatic SaveAction saveAction; static void <clinit>(); private void SaveAction(); publicstatic SaveAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAction.javaPainterSta rtup/com/javera/ui/actions/SaveAction.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject;
  • 60. import com.javera.ui.IconManager; publicclassSaveActionextendsManagedStateAction{ privatestaticSaveAction saveAction =newSaveAction(); privateSaveAction(){ super("Save",IconManager.getIcon("Save.gif")); putValue(javax.swing.Action.SHORT_DESCRIPTION,"Sa ve"); } publicstaticSaveAction getAction(){ return saveAction; } publicvoid actionPerformed(ActionEvent e){ Saveable target = (Saveable)ActionUtilities.getCommandTarget(e,Saveable.class); if(target !=null&& target.isSaveable(e)){ target.save(e); } } publicboolean isTargetEnabled(EventObject evt){ Saveable target = (Saveable)ActionUtilities.getCommandTarget(evt,Saveable.clas s); if(target !=null){ return target.isSaveable(evt); }else{ returnfalse; } } }
  • 61. PainterStartup/com/javera/ui/actions/SaveAllable.classpackage com.javera.ui.actions; publicabstractinterface SaveAllable { publicabstract void saveAll(java.awt.event.ActionEvent); publicabstract boolean isSaveAllable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAllable.javaPainterSta rtup/com/javera/ui/actions/SaveAllable.javapackage com.javera. ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved. * @author David T. Smith */ publicinterfaceSaveAllable{ publicvoid saveAll(ActionEvent evt); publicboolean isSaveAllable(EventObject evt); } PainterStartup/com/javera/ui/actions/SaveAllAction.classpackag e com.javera.ui.actions; publicsynchronizedclass SaveAllAction extends javax.swing.AbstractAction { privatestatic SaveAllAction saveAllAction; static void <clinit>(); private void SaveAllAction();
  • 62. publicstatic SaveAllAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAllAction.javaPainter Startup/com/javera/ui/actions/SaveAllAction.javapackage com.j avera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.AbstractAction; publicclassSaveAllActionextendsAbstractAction{ privatestaticSaveAllAction saveAllAction =newSaveAllAction() ; privateSaveAllAction(){ super("Save All..."); putValue(javax.swing.Action.SHORT_DESCRIPTION,"Sa ve All"); } publicstaticSaveAllAction getAction(){ return saveAllAction; } publicvoid actionPerformed(ActionEvent e){ SaveAllable target = (SaveAllable)ActionUtilities.getCommandTarget(e,SaveAllable. class); if(target !=null&& target.isSaveAllable(e)){ target.saveAll(e); }
  • 63. } publicboolean isTargetEnabled(EventObject evt){ SaveAllable target = (SaveAllable)ActionUtilities.getCommandTarget(evt,SaveAllabl e.class); if(target !=null){ return target.isSaveAllable(evt); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/SaveAsable.classpackage com.javera.ui.actions; publicabstractinterface SaveAsable { publicabstract void saveAs(java.awt.event.ActionEvent); publicabstract boolean isSaveAsable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAsable.javaPainterSta rtup/com/javera/ui/actions/SaveAsable.java//Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All rights reser ved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject;
  • 64. /** * This interface should be implemented by UI classes that want to allow some data they handle to be saved * as another entity. * @author David T. Smith */ publicinterfaceSaveAsable{ publicvoid saveAs(ActionEvent evt); publicboolean isSaveAsable(EventObject evt); } PainterStartup/com/javera/ui/actions/SaveAsAction.classpackag e com.javera.ui.actions; publicsynchronizedclass SaveAsAction extends javax.swing.AbstractAction { privatestatic SaveAsAction saveAsAction; static void <clinit>(); private void SaveAsAction(); publicstatic SaveAsAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SaveAsAction.javaPainter Startup/com/javera/ui/actions/SaveAsAction.java//Copyright 20 04, (c) Javera Software, LLC. as an unpublished work. All right s reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui.actions; import java.awt.event.ActionEvent;
  • 65. import java.util.EventObject; import javax.swing.AbstractAction; publicclassSaveAsActionextendsAbstractAction{ privatestaticSaveAsAction saveAsAction =newSaveAsAction(); privateSaveAsAction(){ super("Save As..."); } publicstaticSaveAsAction getAction(){ return saveAsAction; } publicvoid actionPerformed(ActionEvent e){ SaveAsable target = (SaveAsable)ActionUtilities.getCommandTarget(e,SaveAsable.c lass); if(target !=null&& target.isSaveAsable(e)){ target.saveAs(e); } } publicboolean isTargetEnabled(EventObject evt){ SaveAsable target = (SaveAsable)ActionUtilities.getCommandTarget(evt,SaveAsable .class); if(target !=null){ return target.isSaveAsable(evt); }else{ returnfalse; } } }
  • 66. PainterStartup/com/javera/ui/actions/Selectable.classpackage com.javera.ui.actions; publicabstractinterface Selectable { publicabstract Object getSelectedItem(); } PainterStartup/com/javera/ui/actions/Selectable.javaPainterStart up/com/javera/ui/actions/Selectable.javapackage com.javera.ui.a ctions; publicinterfaceSelectable{ publicObject getSelectedItem(); } PainterStartup/com/javera/ui/actions/Sortable.classpackage com.javera.ui.actions; publicabstractinterface Sortable { publicabstract void sort(java.awt.event.ActionEvent); publicabstract boolean isSortable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Sortable.javaPainterStartu p/com/javera/ui/actions/Sortable.javapackage com.javera.ui.acti ons; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceSortable{ publicvoid sort(ActionEvent e); publicboolean isSortable(EventObject evt);
  • 67. } PainterStartup/com/javera/ui/actions/SortAction.classpackage com.javera.ui.actions; publicsynchronizedclass SortAction extends ManagedStateAction { privatestatic SortAction filterAction; static void <clinit>(); private void SortAction(); publicstatic SortAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/SortAction.javaPainterStar tup/com/javera/ui/actions/SortAction.javapackage com.javera.ui .actions; import com.javera.ui.IconManager; import java.awt.event.ActionEvent; import java.util.EventObject; import javax.swing.Action; publicclassSortActionextendsManagedStateAction{ privatestaticSortAction filterAction =newSortAction(); privateSortAction(){ super("Sort...",IconManager.getIcon("sort.gif")); putValue(Action.MNEMONIC_KEY,newInteger('F')); putValue(Action.SHORT_DESCRIPTION,"Sort"); } publicstaticSortAction getAction(){
  • 68. return filterAction; } publicvoid actionPerformed(ActionEvent e ){ Sortable sortable =(Sortable) ActionUtilities.getCommandTarget( e,Sortable.class); if( sortable !=null) sortable.sort( e ); } publicboolean isTargetEnabled(EventObject evt ){ Sortable sortable =(Sortable) ActionUtilities.getCommandTarget( evt,Sortable.class); if( sortable !=null){ return sortable.isSortable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/actions/Undoable.classpackage com.javera.ui.actions; publicabstractinterface Undoable { publicabstract void undo(java.awt.event.ActionEvent); publicabstract boolean isUndoable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Undoable.javaPainterStart up/com/javera/ui/actions/Undoable.javapackage com.javera.ui.a ctions;
  • 69. import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceUndoable{ publicvoid undo(ActionEvent evt); publicboolean isUndoable(EventObject evt); } PainterStartup/com/javera/ui/actions/UndoAction.classpackage com.javera.ui.actions; publicsynchronizedclass UndoAction extends ManagedStateAction { privatestatic UndoAction undoAction; static void <clinit>(); private void UndoAction(); publicstatic UndoAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/UndoAction.javaPainterSta rtup/com/javera/ui/actions/UndoAction.javapackage com.javera. ui.actions; import com.javera.ui.IconManager; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke;
  • 70. publicclassUndoActionextendsManagedStateAction{ privatestaticUndoAction undoAction =newUndoAction(); privateUndoAction(){ super("Undo",IconManager.getIcon("Undo.gif")); putValue(Action.MNEMONIC_KEY,newInteger('U')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Z,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Undo"); } publicstaticUndoAction getAction(){ return undoAction; } publicvoid actionPerformed(ActionEvent evt ){ Undoable undoable =(Undoable) ActionUtilities.getCommandTarget( evt,Undoable.class); if( undoable !=null) undoable.undo( evt ); } publicboolean isTargetEnabled(EventObject evt ){ Undoable undoable =(Undoable) ActionUtilities.getCommandTarget( evt,Undoable.class); if( undoable !=null){ return undoable.isUndoable( evt ); }else{ returnfalse; } } }
  • 71. PainterStartup/com/javera/ui/actions/Ungroupable.classpackage com.javera.ui.actions; publicabstractinterface Ungroupable { publicabstract void ungroup(java.awt.event.ActionEvent); publicabstract boolean isUngroupable(java.util.EventObject); } PainterStartup/com/javera/ui/actions/Ungroupable.javaPainterSt artup/com/javera/ui/actions/Ungroupable.javapackage com.javer a.ui.actions; import java.awt.event.ActionEvent; import java.util.EventObject; publicinterfaceUngroupable{ /** * Tells the component to do the ungroup. */ publicvoid ungroup(ActionEvent evt ); /** Returns true if a ungroup is currently possible. */ publicboolean isUngroupable(EventObject evt ); } PainterStartup/com/javera/ui/actions/UngroupAction.classpacka ge com.javera.ui.actions; publicsynchronizedclass UngroupAction extends ManagedStateAction { privatestatic UngroupAction groupAction; static void <clinit>();
  • 72. private void UngroupAction(); publicstatic UngroupAction getAction(); public void actionPerformed(java.awt.event.ActionEvent); public boolean isTargetEnabled(java.util.EventObject); } PainterStartup/com/javera/ui/actions/UngroupAction.javaPainter Startup/com/javera/ui/actions/UngroupAction.javapackage com.j avera.ui.actions; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.util.EventObject; import javax.swing.Action; import javax.swing.KeyStroke; publicclassUngroupActionextendsManagedStateAction{ privatestaticUngroupAction groupAction =newUngroupAction() ; privateUngroupAction(){ super("Ungroup"); putValue(Action.MNEMONIC_KEY,newInteger('U')); putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_U,Event.CTRL_MASK )); putValue(Action.SHORT_DESCRIPTION,"Ungroup"); } publicstaticUngroupAction getAction(){return groupAction;} publicvoid actionPerformed(ActionEvent e ){
  • 73. Ungroupable ungroup =(Ungroupable) ActionUtilities.getCommandTarget( e,Ungroupable.class); if( ungroup !=null){ ungroup.ungroup( e ); } } publicboolean isTargetEnabled(EventObject evt ){ Ungroupable ungroup =(Ungroupable) ActionUtilities.getCommandTarget( evt,Ungroupable.class); if( ungroup !=null){ return ungroup.isUngroupable( evt ); }else{ returnfalse; } } } PainterStartup/com/javera/ui/CompleteEntry.classpackage com.javera.ui; publicabstractinterface CompleteEntry { publicabstract void completeEntry(); } PainterStartup/com/javera/ui/CompleteEntry.javaPainterStartup/ com/javera/ui/CompleteEntry.javapackage com.javera.ui; /** * @author dtsmith
  • 74. */ publicinterfaceCompleteEntry{ publicvoid completeEntry(); } PainterStartup/com/javera/ui/GetIcon.classpackage com.javera.ui; publicabstractinterface GetIcon { publicabstract javax.swing.Icon getIcon(); } PainterStartup/com/javera/ui/GetIcon.javaPainterStartup/com/ja vera/ui/GetIcon.java//Copyright 2004, (c) Javera Software, LLC . as an unpublished work. All rights reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; import javax.swing.Icon; /** * GetIcon interface provides access to the getIcon() method use d by * the various renderers to obtain an Icon for a given object * * @author David T. Smith */ publicinterfaceGetIcon{ /** * Get the icon to be displayed by the renderer * @ return the icon to be displayed */ publicIcon getIcon();
  • 75. } PainterStartup/com/javera/ui/GetObject.classpackage com.javera.ui; publicabstractinterface GetObject { publicabstract Object getObject(); } PainterStartup/com/javera/ui/GetObject.javaPainterStartup/com/ javera/ui/GetObject.java//Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All rights reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; /** * GetObject interface provides access to the getObject() metho d used by * the various renderers to obtain a contained object * * @author David T. Smith */ publicinterfaceGetObject{ /** * Get the contained object * @return the contained object */ publicObject getObject(); } PainterStartup/com/javera/ui/GetPopupMenu.classpackage com.javera.ui;
  • 76. publicabstractinterface GetPopupMenu { publicabstract javax.swing.JPopupMenu getPopupMenu(java.awt.event.MouseEvent); } PainterStartup/com/javera/ui/GetPopupMenu.javaPainterStartup /com/javera/ui/GetPopupMenu.java//Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All rights reserved wo rld-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; import java.awt.event.MouseEvent; import javax.swing.JPopupMenu; publicinterfaceGetPopupMenu{ publicJPopupMenu getPopupMenu(MouseEvent e); } PainterStartup/com/javera/ui/GetText.classpackage com.javera.ui; publicabstractinterface GetText { publicabstract String getText(); } PainterStartup/com/javera/ui/GetText.javaPainterStartup/com/ja vera/ui/GetText.java//Copyright 2004, (c) Javera Software, LLC . as an unpublished work. All rights reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms.
  • 77. package com.javera.ui; /** * GetText interface provides access to the getText() method us ed by * the default renderers for JvList and JvComboBox to get the te xt to be * displayed as an entry * * @author David T. Smith */ publicinterfaceGetText{ /** * Get the text to be displayed by the renderer * @ return the text to be displayed */ publicString getText(); } PainterStartup/com/javera/ui/GetTransferable.classpackage com.javera.ui; publicabstractinterface GetTransferable { publicabstract java.awt.datatransfer.Transferable getTransferable(); } PainterStartup/com/javera/ui/GetTransferable.javaPainterStartu p/com/javera/ui/GetTransferable.java// Copyright 2004, (c) Jave ra Software, LLC. as an unpublished work. All rights reserved world-wide. // This is a proprietary trade secret of Javera Software LLC. Us e restricted to licensing terms. package com.javera.ui;
  • 78. import java.awt.datatransfer.Transferable; /** * @author dtsmith */ publicinterfaceGetTransferable{ /** * @return */ Transferable getTransferable(); } PainterStartup/com/javera/ui/GetValue.classpackage com.javera.ui; publicabstractinterface GetValue { publicabstract Object getValue(); } PainterStartup/com/javera/ui/GetValue.javaPainterStartup/com/j avera/ui/GetValue.java//Copyright 2004, (c) Javera Software, L LC. as an unpublished work. All rights reserved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; /** * GetValue interface provides access to the getValue() method used * to obtain a value associated with an object *
  • 79. * @author David T. Smith */ publicinterfaceGetValue{ /** * Get the contained object * @return the contained object */ publicObject getValue(); } PainterStartup/com/javera/ui/GuiListDataListener.classpackage com.javera.ui; publicabstractinterface GuiListDataListener extends javax.swing.event.ListDataListener { } PainterStartup/com/javera/ui/GuiListDataListener.javaPainterSt artup/com/javera/ui/GuiListDataListener.java// Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All rights re served world-wide. // This is a proprietary trade secret of Javera Software LLC. Us e restricted to licensing terms. package com.javera.ui; import javax.swing.event.ListDataListener; /** * @author dtsmith */ publicinterfaceGuiListDataListenerextendsListDataListener{ }
  • 80. PainterStartup/com/javera/ui/IconManager.classpackage com.javera.ui; publicsynchronizedclass IconManager { static ClassLoader classLoader; static java.util.Hashtable iconTable; static void <clinit>(); public void IconManager(); publicstatic javax.swing.ImageIcon getIcon(String); publicstatic javax.swing.ImageIcon getImageIcon(String); } PainterStartup/com/javera/ui/IconManager.javaPainterStartup/c om/javera/ui/IconManager.java//Copyright 2004, (c) Javera Soft ware, LLC. as an unpublished work. All rights reserved world- wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui; import java.net.*; import java.util.Hashtable; import javax.swing.ImageIcon; /** * IconManager provides a convenience class to load icons. * * @author David T. Smith */ publicclassIconManager{ staticClassLoader classLoader =IconManager.class.getClassLoa der(); staticHashtable iconTable =newHashtable();
  • 81. publicstaticImageIcon getIcon(String iconName) { return getImageIcon("images/"+ iconName); } staticpublicImageIcon getImageIcon(String iconName) { ImageIcon icon =(ImageIcon) iconTable.get(iconName); if(icon ==null) { URL url = classLoader.getResource(iconName); if(url !=null) icon =newImageIcon(url); else icon =newImageIcon("x.gif"); iconTable.put(iconName, icon); } return icon; } } PainterStartup/com/javera/ui/JavaObjectTransferable.classpacka ge com.javera.ui; publicsynchronizedclass JavaObjectTransferable implements java.awt.datatransfer.Transferable, java.io.Serializable { privatetransient Object javaObject; private java.util.ArrayList dataFlavors; public void JavaObjectTransferable(Object); public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors(); public boolean
  • 82. isDataFlavorSupported(java.awt.datatransfer.DataFlavor); public boolean addDataFlavor(java.awt.datatransfer.DataFlavor); public Object getTransferData(java.awt.datatransfer.DataFlavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException; } PainterStartup/com/javera/ui/JavaObjectTransferable.javaPainte rStartup/com/javera/ui/JavaObjectTransferable.java// Copyright 2004, (c) Javera Software, LLC. as an unpublished work. All ri ghts reserved world-wide. // This is a proprietary trade secret of Javera Software LLC. Us e restricted to licensing terms. package com.javera.ui; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; /** * @author dtsmith */ publicclassJavaObjectTransferableimplementsTransferable,Seria lizable{ privatetransientObject javaObject; privateArrayList dataFlavors =newArrayList(); publicJavaObjectTransferable(Object javaObject){ this.javaObject = javaObject;
  • 83. } publicDataFlavor[] getTransferDataFlavors(){ return(DataFlavor[]) dataFlavors.toArray(newDataFlavor[dataFl avors.size()]); } publicboolean isDataFlavorSupported(DataFlavor flavor){ return dataFlavors.contains(flavor); } publicboolean addDataFlavor(DataFlavor flavor){ return dataFlavors.add(flavor); } publicObject getTransferData(DataFlavor flavor)throwsUnsuppo rtedFlavorException,IOException{ if(isDataFlavorSupported(flavor)){ return javaObject; }else{ returnnull; } } } PainterStartup/com/javera/ui/layout/JvBoxLayout$Filler.classpa ckage com.javera.ui.layout; publicsynchronizedclass JvBoxLayout$Filler extends java.awt.Component implements javax.accessibility.Accessible { private java.awt.Dimension dim; public void JvBoxLayout$Filler(int, int); public java.awt.Dimension getMinimumSize(); public java.awt.Dimension getPreferredSize(); public java.awt.Dimension getMaximumSize();
  • 84. } PainterStartup/com/javera/ui/layout/JvBoxLayout.classpackage com.javera.ui.layout; publicsynchronizedclass JvBoxLayout implements java.awt.LayoutManager2, com.javera.ui.LayoutPrintLayout, java.io.Serializable { publicstaticfinal int X_AXIS = 0; publicstaticfinal int Y_AXIS = 1; private int axis; private int gap; private int topMargin; private int bottomMargin; private int leftMargin; private int rightMargin; private java.util.Map weightMap; public void JvBoxLayout(int); public void JvBoxLayout(int, int, int, int, int, int); public int getGap(); public void setGap(int); public int getTopMargin(); public void setTopMargin(int); public int getLeftMargin(); public void setLeftMargin(int); public int getBottomMargin(); public void setBottomMargin(int); public int getRightMargin(); public void setRightMargin(int); public void addLayoutComponent(java.awt.Component, Object); public java.awt.Dimension maximumLayoutSize(java.awt.Container); public float getLayoutAlignmentX(java.awt.Container); public float getLayoutAlignmentY(java.awt.Container); public void invalidateLayout(java.awt.Container);
  • 85. public void addLayoutComponent(String, java.awt.Component); public void removeLayoutComponent(java.awt.Component); public java.awt.Dimension minimumLayoutSize(java.awt.Container); public java.awt.Dimension preferredLayoutSize(java.awt.Container); public void layoutContainer(java.awt.Container); publicstatic java.awt.Component createFiller(int, int); public int layoutPrint(java.awt.Container, int); } PainterStartup/com/javera/ui/layout/JvBoxLayout.javaPainterSt artup/com/javera/ui/layout/JvBoxLayout.java//Copyright 2004, ( c) Javera Software, LLC. as an unpublished work. All rights res erved world-wide. //This is a proprietary trade secret of Javera Software LLC. Use restricted to licensing terms. package com.javera.ui.layout; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Insets; import java.awt.LayoutManager2; import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.accessibility.Accessible; import com.javera.ui.LayoutPrintLayout; import com.javera.ui.LayoutPrint;
  • 86. //import com.javera.ui.panel.JvPanel; /** * A Javera box layout arranges components in a vertical or hori zontal format. * For vertical format all components are resized to have the sa me width of * the container, but have a height that is in proportion to their a ssigned * weights and such that the total height of all compoenents fills the height * of the container. Likewise a horizontal format will resize co mponents to * have the same width as the container and a height that is in pr oportion to * the assigned weights. If a component has an assigned weight of 0 then that * components is sized according to its preferred size. * * Weights are assigned using a Double as the second argument to the * containers add method. A null second argument will be inter preted as a * zero weight assignement. * * A Javera box layout is similar in function to a Box layout exc ept that the * assigned weights, not glue or preferred sizes are used to distr ibute space * over the row or column. Javera box layout also provides gap * separation and margins. * * @author David T. Smith */ publicclassJvBoxLayoutimplementsLayoutManager2,LayoutPrin tLayout,Serializable{
  • 87. /** * Horizontal axis orientation */ publicfinalstaticint X_AXIS =0; /** * Vertical axis orientation */ publicfinalstaticint Y_AXIS =1; /** * The axis orientation of the weighted layout. */ privateint axis; /** * The weighted layout manager allows a seperation of compo nents with * gaps. The gap will specify the space between components. * * @serial * @see getGap * @see setGap */ privateint gap; /** * The weighted layout manager allows specification of a top margin to be * reserved above laidout components. * * @serial * @see getTopMargin * @see setTopMargin */
  • 88. privateint topMargin; /** * The command button layout manager allows specification of a bottom * margin to be reserved below laidout components. * * @serial * @see getBottomMargin * @see setBottomMargin */ privateint bottomMargin; /** * The weighted layout manager allows specification of a left margin to be * reserved to the left of the leftmost component. * * @serial * @see getLeftMargin * @see setLeftMargin */ privateint leftMargin; /** * The weighted layout manager allows specification of a rig ht margin to * be reserved to the right of the rightmost component. * * @serial * @see getRightMargin * @see setRightMargin */ privateint rightMargin; /**
  • 89. * A Map of each component's weight, keyed on the compone nt * objects themselves. */ privateMap weightMap =newHashMap(); /** * Constructs a new Weighted Layout with specified axis, a d efault 5 pixel * gap, and a 5 pixel margins. * * @param axis X_AXIS or Y_AXIS */ publicJvBoxLayout(int axis){ this(axis,5,5,5,5,5); } /** * Constructs a new Weighted Layout with specified axis, gap , and margins. * * @param axis X_AXIS or Y_AXIS * @param gap the gap between components. * @param topMargin the top margin. * @param leftMargin the left margin. * @param bottomMargin the bottom margin. * @param rightMargin the right margin. */ publicJvBoxLayout( int axis, int gap, int topMargin, int leftMargin, int bottomMargin, int rightMargin){ this.axis = axis;
  • 90. this.gap = gap; this.topMargin = topMargin; this.leftMargin = leftMargin; this.bottomMargin = bottomMargin; this.rightMargin = rightMargin; } /** * Gets the gap between components. * * @return the gap between components. */ publicint getGap(){ return gap; } /** * Sets the gap between components. * * @param gap the gap between components */ publicvoid setGap(int gap){ this.gap = gap; } /** * Gets the top margin to be reserved above all components. * * @return the top margin. */ publicint getTopMargin(){ return topMargin; } /** * Sets the top margin to be reserve above components.
  • 91. * * @param topMargin the top margin. */ publicvoid setTopMargin(int topMargin){ this.topMargin = topMargin; } /** * Gets the left margin to be reserved to the left of the * leftmost component. * * @return the left margin. */ publicint getLeftMargin(){ return leftMargin; } /** * Sets the left margin to be reserved to the left of the * leftmost component. * * @param leftMargin the left margin. */ publicvoid setLeftMargin(int leftMargin){ this.leftMargin = leftMargin; } /** * Gets the bottom margin to be reserved below all componen ts. * * @return the bottom margin. */ publicint getBottomMargin(){ return bottomMargin; }
  • 92. /** * Sets the bottom margin to be reserve below components. * * @param bottomMargin the bottom margin. */ publicvoid setBottomMargin(int bottomMargin){ this.bottomMargin = bottomMargin; } /** * Gets the right margin to be reserved to the right of the * rightmost component. * * @return the right margin. */ COSC 210 - Object Oriented Programming Assignment 7 Due: Nov 18th The objectives of this assignment are to: 1) Gain further understanding and experience with inheritance. 2) Gain understanding and experience with polymorphism. 3) Gain further understanding and experience with interfaces. 4) Gain understanding and experience with low level graphics. 5) Modify an existing program to meet new requirements applying concepts of objectives 1 through 4. 6) Gain experience with medium-size Java program. 7) Continue to practice good programming techniques.
  • 93. AFTER YOU HAVE COMPLETED, create a zip file named [your name]Assignment7.zip containing your entire project. Upload the .zip file to Moodle. Printout all source files you created or modified. Include a screen shot of the editor with boxes, ellipses, lines and images shown in the editor. Turn-in all printouts. COSC 210 – Fundamentals of Computer Science Assignment 7 Problem Statement Updated On the tomcat drive in folder cosc210 you will find file named PainterStartup.zip. This file contains the source code for the start of a Painter program. In its current state, Painter can create boxes and text objects at given locations. Both boxes and text objects can be repositioned and resized using a mouse. The task is to add to the program the implementation for an ellipse, line, image, and group objects. Instructions: 1) Add an ellipse object. An ellipse is very similar in implementation as the box, except it renders an oval instead of a rectangle. The ellipse can be repositioned by dragging the object to a new location. The ellipse can be resized by first clicking over the ellipse to display grab handles and then dragging a grab handle to a new position. The grab handles are to be rendered at the same positions as the box. Likewise, clicking anywhere in the smallest rectangle that encloses the ellipse performs selection. 2) Add a Line object. A Line is to be created by selecting a Line tool and then click and drag over the canvas. The line is rendered from the point of the initial click to the mouse pointer. On releasing the mouse the construction of the line object is completed. Have the Line object inherit from
  • 94. PtrDrawAbstractAreaObject. Thus it will have only two grab handles. A Line is selected by clicking anywhere over the line. Right now if you click anywhere in the rectangular region hold the line, then the line is selected. To accomplish this task, override the isOver method in PtrDrawAbstractAreaObject. Given below is a partial solution to determine if a mouse click position (the x and y parameters to the isOver method) is over a line: double ratio = (double) getWidth() / (double) getHeight(); if (Math.abs((x - getX()) * ratio) - (y - getY()) <= 1) { return true; } You need to modify this code when the y to x ratio is less than - 1 or greater than 1. (Hint: Inverse the roles of width and height, and the roles of x and y) 3) Add an Image object. An Image object is created by selecting an Image tool and then clicking anywhere on the canvas. On clicking the canvas, a File Selection Dialog should be displayed. The dialog prompts for selection of .gif and .jpg files. On selecting a .gif or .jpg file and clicking “Open”, an Image object that renders the image of the selected file is created at the click position. Image selection and drag behaviors are the same as a Box object. The image object additionally renders lines at the edges of the image (as done in Box).
  • 95. The code for displaying a File Selection Dialog is: JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase().endsWith(".jpg") || f.getName().toLowerCase().endsWith(".gif"); } public String getDescription() { return "JPG & GIF Images"; } }); if (fileChooser.showOpenDialog(editor) == JFileChooser.APPROVE_OPTION) { ImageIcon image = new ImageIcon(fileChooser.getSelectedFile().getAbsolutePath()); /* you will need to do stuff with your image here */ /* note the Graphics object has a method drawImage() */
  • 96. } Make sure to import FileFilter from the javax.swing.filechooser. The above code is added to the PtrDrawImageTool 4) Add a group object. A group object represents a set of objects that have been grouped together. A partial implementation is provided. Your task is to fix the rendering. The group object should draw each of the objects in the groupedObjects list. Before drawing any object your will need to create a new graphics object that is transposed to the dimensions if the group object itself. To do this use: Graphics2D g2 = (Graphics2D) g.create(getX(), getY(), getWidth(), getHeight()); After drawing each of the objects in groupedObjects list, release the resources used by the created graphics object by calling dispose: g2.dispose(); One more item, after creating the new graphics context and before drawing each of the objects in the group, use scale as follows: g2.scale(getXScale(), getYScale()); This will insure that all objects get rendered as at the right scale when the group object itself is resized. 5) Have the box, ellipse, line, and image implement the Lineable and Colorable interface. Create instance variables as
  • 97. needed to hold the values of the parameters. Before doing any rendering of lines (e.g., any g.drawXXXX method) create a new graphics context as follows: Graphics2D g2 = (Graphics2D) g.create(); Then set the line width by: g2.setStroke(new BasicStroke(lineWidth)); Also set the color to the lineColor: g2.setColor(lineColor); Use g2 to do the rendering of the lines. After all line rendering, release the resources of the graphics context by calling dispose(); In the corresponding tool object (e.g., PtrDrawBoxTool for PtrDrawBox), after creating the draw object add the following calls in the object: box.setLineColor(editor.getLineColor()); box.setLineWidth(editor.getLineWidth()); 6) Have the box and ellipse, line implement the Colorable interface. Create instance variables as need to hold the value of the parameter (color). Before doing any rendering of filled areas (e.g., any g.fillXXXX method) set the graphics color to the color instance variable: g.setColor(color); // or use g2 if you have created a new graphics context In the corresponding tool object (e.g., PtrDrawBoxTool for PtrDrawBox), after creating the draw object add the following calls in the object:
  • 98. box.setColor(editor.getColor()); Warning: Your objects may not render correctly whenever they are resized such that either the height or width is negative. Bonus: 1) Bonus 5 points -The isInside method provides the implementation for determining if the line is inside a rectangular area as specified by the parameters. This code may not work right if the ending point of the line is to the left or above the starting point. Fix this to work in all cases for 3 bonus points. 2) Currently, if you click in the area where two objects overlap, the object on the bottom is selected. Change this so that the top object is selected. 3 bonus points. 3) On the Group object, clicking in anywhere in the bounding rectangle will select the object. Change this so that a group is only selected with clicking over an object in the group. 3 bonus points 4) The south east grab handle processing is broken. Fix this to behave as the other grab handles for 3 bonus points 5) Currently, if you drag the right hand side smaller than the left (likewise the bottom smaller that the top) the objects may not be displayed correctly (or even at all). Once in the bad display state, clicking over the object no longer works. Second, if you click in the region of overlapping object, the object on the bottom gets selected. It should be the top object. Fix these bugs. One possible solution is to add a normalizeRect method to PtrDrawRect. This will adjust the x, y, width, and height
  • 99. variables so that width and height are never negative. For example if width is negative then change x to be the value of x plus width and then change width to be the absolute value. Place a call to this method in the corresponding setter methods after updating the instance variables. (Note there may be problems with the grab handles). 3 points bonus.