alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
** Copyright (c) 1998 by Timothy Gerard Endres
** <mailto:time@ice.com>  
** 
** This program is free software.
** 
** You may redistribute it and/or modify it under the terms of the GNU
** General Public License as published by the Free Software Foundation.
** Version 2 of the license should be included with this distribution in
** the file LICENSE, as well as License.html. If the license is not
** included	with this distribution, you may find a copy at the FSF web
** site at 'www.gnu.org' or 'www.fsf.org', or you may write to the
** Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA.
**
** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,
** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY
** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR
** REDISTRIBUTION OF THIS SOFTWARE. 
** 
*/

package com.ice.sqlclient;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;

import com.ice.util.AWTUtilities;


public class
MainPanel extends JPanel
		implements ActionListener
	{
	private HostInfoPanel		hostPanel;
	private QueryPanel			qPanel;
	private QueryTextPanel		qTextPanel;
	private QueryTablePanel		qTblPanel;
	private UpdatePanel			updPanel;
	private CommandPanel		cmdPanel;
	private TablesPanel			tblPanel;
	private TableDefsPanel		defsPanel;
	private AboutPanel			aboutPanel;
	private MainFrame			mainFrame;

	private JTabbedPane			tabbedPane;


	public
	MainPanel( MainFrame mainFrame )
		{
		super();

		this.mainFrame = mainFrame;

		JPanel			panel;
		JButton			button;

		this.setLayout( new GridBagLayout() );

		// Create a tab pane
		this.tabbedPane = new JTabbedPane();
		AWTUtilities.constrain(
			this, this.tabbedPane,
			GridBagConstraints.BOTH,
			GridBagConstraints.CENTER,
			0, 0, 1, 1, 1.0, 1.0 );

		this.aboutPanel = new AboutPanel();
		this.tabbedPane.addTab( "About", null, this.aboutPanel );

		this.hostPanel = new HostInfoPanel( this );
		this.tabbedPane.addTab( "Connection", null, this.hostPanel );
		
		this.tblPanel = new TablesPanel();
		this.tabbedPane.addTab( "Tables", null, this.tblPanel );
		
		this.defsPanel = new TableDefsPanel();
		this.tabbedPane.addTab( "Columns", null, this.defsPanel );

		this.qTblPanel = new QueryTablePanel();
		this.tabbedPane.addTab( "Query Table", null, this.qTblPanel );

		this.qPanel = new QueryPanel();
		this.tabbedPane.addTab( "Query", null, this.qPanel );

		this.qTextPanel = new QueryTextPanel();
		this.tabbedPane.addTab( "Query Text", null, this.qTextPanel );

		this.updPanel = new UpdatePanel();
		this.tabbedPane.addTab( "Update", null, this.updPanel );

		this.adjustConnectedTabs( false );

		this.tabbedPane.setSelectedIndex( 1 );

		this.tabbedPane.addChangeListener( this.tblPanel );
		this.tabbedPane.addChangeListener( this.defsPanel );
		}

	public void
	dbHasChanged( String dbName )
		{
		this.tblPanel.refresh();
		this.defsPanel.refresh();
		}

	public void
	adjustConnectedTabs( boolean show )
		{
		this.tabbedPane.setEnabledAt( 2, show );
		this.tabbedPane.setEnabledAt( 3, show );
		this.tabbedPane.setEnabledAt( 4, show );
		this.tabbedPane.setEnabledAt( 5, show );
		this.tabbedPane.setEnabledAt( 6, show );
		this.tabbedPane.setEnabledAt( 7, show );
		}

	public void
	actionPerformed( ActionEvent event )
		{
		String command = event.getActionCommand();

		if ( command.equals( "QUIT" ) )
			{
			System.exit(0);
			}
		else
			{
			System.err.println
				( "UNKNOWN Command '" + command + "'" );
			}
		}

	public void
	showDatabaseMenu( String[] dbList, String currDb )
		{
		this.mainFrame.showDatabaseMenu( dbList, currDb );
		}

	public void
	hideDatabaseMenu()
		{
		this.mainFrame.hideDatabaseMenu();
		}

	}

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.