import diamondedge.util.*;
import diamondedge.ado.*;
import diamondedge.vb.*;
import java.awt.*;
import javax.swing.*;
import diamondedge.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
/**
* Use database order for string comparisons.
* Requires variables to be declared before they are used.
*/
public class Main_Switchboard extends JForm
implements ActionListener
{
public CommandButton Suppliers = new CommandButton();
public CommandButton Orders = new CommandButton();
public CommandButton DisplayDatabaseWindow = new CommandButton();
public CommandButton Categories = new CommandButton();
public VbLabel Label8 = new VbLabel();
public CommandButton Products = new CommandButton();
public VbImage Logo = new VbImage();
public diamondedge.vb.Shape Box14 = new diamondedge.vb.Shape();
public diamondedge.vb.Shape Box7 = new diamondedge.vb.Shape();
public CommandButton ExitMicrosoftAccess = new CommandButton();
public CommandButton Sales_Reports_Dialog = new CommandButton();
public Main_Switchboard()
{
}
public void initialize()
{
if( initialized )
return;
try
{
setLayout( null );
setName( "Main_Switchboard" );
setTitle( "Main Switchboard" );
// unsup HelpContextID = 430;
setFocusTraversalPolicy( TAB_ORDER_FOCUS_TRAVERSAL_POLICY );
setFormLocation( 65, 84 );
setSize( 413, 242 );
setFormSize( 413, 242 );
ExitMicrosoftAccess.setName( "ExitMicrosoftAccess" );
add( ExitMicrosoftAccess );
ExitMicrosoftAccess.setVisible( true );
ExitMicrosoftAccess.setEnabled( true );
ExitMicrosoftAccess.setRequestFocusEnabled( true );
ExitMicrosoftAccess.setTabOrder( 6 );
//unsup ExitMicrosoftAccess.FontUnderline = false;
ExitMicrosoftAccess.setToolTipText( "Close the Northwind database and exit Microsoft Access." );
//unsup ExitMicrosoftAccess.HelpContextID = 0;
ExitMicrosoftAccess.setText( "E&xit Microsoft Access" );
ExitMicrosoftAccess.setDefaultButton( false );
//unsup ExitMicrosoftAccess.Cancel = false;
ExitMicrosoftAccess.setLocation( 38, 192 );
ExitMicrosoftAccess.setSize( 143, 29 );
ExitMicrosoftAccess.setFont( new Font("SansSerif", Font.PLAIN, 10) );
DisplayDatabaseWindow.setName( "DisplayDatabaseWindow" );
add( DisplayDatabaseWindow );
DisplayDatabaseWindow.setVisible( true );
DisplayDatabaseWindow.setEnabled( true );
DisplayDatabaseWindow.setRequestFocusEnabled( true );
DisplayDatabaseWindow.setTabOrder( 5 );
//unsup DisplayDatabaseWindow.FontUnderline = false;
DisplayDatabaseWindow.setToolTipText( "Close this switchboard and display the Database window." );
//unsup DisplayDatabaseWindow.HelpContextID = 0;
DisplayDatabaseWindow.setText( "&Display Database Window" );
DisplayDatabaseWindow.setDefaultButton( true );
//unsup DisplayDatabaseWindow.Cancel = false;
DisplayDatabaseWindow.setLocation( 226, 192 );
DisplayDatabaseWindow.setSize( 143, 29 );
DisplayDatabaseWindow.setFont( new Font("SansSerif", Font.PLAIN, 10) );
Sales_Reports_Dialog.setName( "Sales_Reports_Dialog" );
add( Sales_Reports_Dialog );
Sales_Reports_Dialog.setVisible( true );
Sales_Reports_Dialog.setEnabled( true );
Sales_Reports_Dialog.setRequestFocusEnabled( true );
Sales_Reports_Dialog.setTabOrder( 4 );
//unsup Sales_Reports_Dialog.FontUnderline = false;
Sales_Reports_Dialog.setToolTipText( "Open the Print Sales Reports dialog box and select a report to print." );
//unsup Sales_Reports_Dialog.HelpContextID = 0;
Sales_Reports_Dialog.setText( "Print Sales &Reports" );
Sales_Reports_Dialog.setDefaultButton( false );
//unsup Sales_Reports_Dialog.Cancel = false;
Sales_Reports_Dialog.setLocation( 226, 147 );
Sales_Reports_Dialog.setSize( 143, 29 );
Sales_Reports_Dialog.setFont( new Font("SansSerif", Font.PLAIN, 10) );
Categories.setName( "Categories" );
add( Categories );
Categories.setVisible( true );
Categories.setEnabled( true );
Categories.setRequestFocusEnabled( true );
Categories.setTabOrder( 0 );
//unsup Categories.FontUnderline = false;
Categories.setToolTipText( "Open the Categories form." );
//unsup Categories.HelpContextID = 0;
Categories.setText( "&Categories" );
Categories.setDefaultButton( false );
//unsup Categories.Cancel = false;
Categories.setLocation( 222, 48 );
Categories.setSize( 68, 29 );
Categories.setFont( new Font("SansSerif", Font.PLAIN, 10) );
Products.setName( "Products" );
add( Products );
Products.setVisible( true );
Products.setEnabled( true );
Products.setRequestFocusEnabled( true );
Products.setTabOrder( 1 );
//unsup Products.FontUnderline = false;
Products.setToolTipText( "Open the Products form." );
//unsup Products.HelpContextID = 0;
Products.setText( "&Products" );
Products.setDefaultButton( false );
//unsup Products.Cancel = false;
Products.setLocation( 222, 89 );
Products.setSize( 68, 29 );
Products.setFont( new Font("SansSerif", Font.PLAIN, 10) );
Suppliers.setName( "Suppliers" );
add( Suppliers );
Suppliers.setVisible( true );
Suppliers.setEnabled( true );
Suppliers.setRequestFocusEnabled( true );
Suppliers.setTabOrder( 2 );
//unsup Suppliers.FontUnderline = false;
Suppliers.setToolTipText( "Open the Suppliers form." );
//unsup Suppliers.HelpContextID = 0;
Suppliers.setText( "&Suppliers" );
Suppliers.setDefaultButton( false );
//unsup Suppliers.Cancel = false;
Suppliers.setLocation( 308, 48 );
Suppliers.setSize( 68, 29 );
Suppliers.setFont( new Font("SansSerif", Font.PLAIN, 10) );
Orders.setName( "Orders" );
add( Orders );
Orders.setVisible( true );
Orders.setEnabled( true );
Orders.setRequestFocusEnabled( true );
Orders.setTabOrder( 3 );
//unsup Orders.FontUnderline = false;
Orders.setToolTipText( "Open the Orders form." );
//unsup Orders.HelpContextID = 0;
Orders.setText( "&Orders" );
Orders.setDefaultButton( false );
//unsup Orders.Cancel = false;
Orders.setLocation( 308, 89 );
Orders.setSize( 68, 29 );
Orders.setFont( new Font("SansSerif", Font.PLAIN, 10) );
Box7.setName( "Box7" );
add( Box7 );
Box7.setVisible( true );
Box7.setBackStyle( 0 );
Box7.setBordered( true );
Box7.setBorderColor( Color.black );
Box7.setBorderWidth( 1 );
Box7.setBordered( true );
Box7.setLocation( 211, 32 );
Box7.setSize( 173, 98 );
Label8.setName( "Label8" );
add( Label8 );
Label8.setVisible( true );
//unsup Label8.FontUnderline = false;
Label8.setText( "View Product and Order Information:" );
Label8.setForeground( SystemColor.controlText );
Label8.setOutline3D( false );
Label8.setOutlined( false );
Label8.setOpaque( false );
Label8.setHorizontalAlignment( SwingConstants.LEFT );
//unsup Label8.WordWrap = true;
Label8.setLocation( 211, 16 );
Label8.setSize( 176, 14 );
Label8.setFont( new Font("SansSerif", Font.PLAIN, 10) );
Logo.setName( "Logo" );
add( Logo );
Logo.setVisible( true );
Logo.setImage( Screen.loadImage(this, "resources/Main_Switchboard_Logo_Picture.jpg") );
//unsup Logo.Appearance = 0;
Logo.setOutlined( false );
Logo.setLocation( 34, 22 );
Logo.setSize( 157, 151 );
Box14.setName( "Box14" );
add( Box14 );
Box14.setVisible( true );
Box14.setBackStyle( 0 );
Box14.setBordered( true );
Box14.setBorderColor( Color.black );
Box14.setBorderWidth( 1 );
Box14.setBordered( true );
Box14.setLocation( 32, 22 );
Box14.setSize( 157, 151 );
}
catch(Exception _e_) { Err.set(_e_,"Main_Switchboard"); }
if( !unloaded )
enableEvents();
super.initialize();
initializeForm(1);
}
// methods
public int OpenForms( String strFormName )
{
int OpenForms = 0;
// This function is used in the Click event of command buttons that
// open forms on the Main Switchboard. Using a function is more efficient
// than repeating the same code in multiple event procedures.
try
{
// Open specified form.
AC_Util.GetForm( strFormName ).showForm();
Exit_OpenForms:
return OpenForms;
}
catch( Exception _e_ )
{
Err.set( _e_ );
try
{
JOptionPane.showMessageDialog( Screen.getActiveControl(), Err.getError().getDescription() );
//unsup Resume Exit_OpenForms
Err.clear();
}
catch( Exception _e2_ )
{
}
}
return OpenForms;
}
// events
private void Suppliers_Click()
{
try
{
OpenForms( "Suppliers" );
}
catch(Exception _e_) { Err.set(_e_,"Suppliers_Click"); }
}
private void Orders_Click()
{
try
{
OpenForms( "Orders" );
}
catch(Exception _e_) { Err.set(_e_,"Orders_Click"); }
}
public void DisplayDatabaseWindow_Click()
{
String strDocName = "";
// This code created in part by Command Button Wizard.
try
{
strDocName = "Categories";
// Close Main Switchboard form.
Application.getCurrent().unload( this );
// Give focus to Database window; select Categories table (first
// form in list).
//unsup DoCmd.SelectObject acTable, strDocName, True
Exit_DisplayDatabaseWindow_Click:
return;
}
catch( Exception _e_ )
{
Err.set( _e_ );
try
{
JOptionPane.showMessageDialog( Screen.getActiveControl(), Err.getError().getDescription() );
//unsup Resume Exit_DisplayDatabaseWindow_Click
Err.clear();
}
catch( Exception _e2_ )
{
}
}
}
private void Categories_Click()
{
try
{
OpenForms( "Categories" );
}
catch(Exception _e_) { Err.set(_e_,"Categories_Click"); }
}
private void Products_Click()
{
try
{
OpenForms( "Products" );
}
catch(Exception _e_) { Err.set(_e_,"Products_Click"); }
}
public void ExitMicrosoftAccess_Click()
{
// This code created by Command Button Wizard.
try
{
// Exit Microsoft Access.
if( Application.getCurrent().getApplet() == null ) System.exit(0);
Exit_ExitMicrosoftAccess_Click:
return;
}
catch( Exception _e_ )
{
Err.set( _e_ );
try
{
JOptionPane.showMessageDialog( Screen.getActiveControl(), Err.getError().getDescription() );
//unsup Resume Exit_ExitMicrosoftAccess_Click
Err.clear();
}
catch( Exception _e2_ )
{
}
}
}
private void Sales_Reports_Dialog_Click()
{
try
{
OpenForms( "Sales Reports Dialog" );
}
catch(Exception _e_) { Err.set(_e_,"Sales_Reports_Dialog_Click"); }
}
// implementation of Listener interfaces
public void actionPerformed( ActionEvent e )
{
if( e.getSource() == Suppliers )
{
Suppliers_Click();
}
else if( e.getSource() == Orders )
{
Orders_Click();
}
else if( e.getSource() == DisplayDatabaseWindow )
{
DisplayDatabaseWindow_Click();
}
else if( e.getSource() == Categories )
{
Categories_Click();
}
else if( e.getSource() == Products )
{
Products_Click();
}
else if( e.getSource() == ExitMicrosoftAccess )
{
ExitMicrosoftAccess_Click();
}
else if( e.getSource() == Sales_Reports_Dialog )
{
Sales_Reports_Dialog_Click();
}
}
public void enableEvents()
{
Suppliers.addActionListener( this );
Orders.addActionListener( this );
DisplayDatabaseWindow.addActionListener( this );
Categories.addActionListener( this );
Products.addActionListener( this );
ExitMicrosoftAccess.addActionListener( this );
Sales_Reports_Dialog.addActionListener( this );
}
}