/* * [FF.java] * * Summary: file find mockup. * * Copyright: (c) 2001-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.1 2006-03-05 */ package com.mindprod.ff; import com.mindprod.common18.FontFactory; import com.mindprod.common18.Hybrid; import com.mindprod.common18.VersionCheck; import java.applet.Applet; import java.awt.Button; import java.awt.Choice; import java.awt.Color; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Label; import java.awt.TextField; /** * file find mockup. *

* A basic extension of the java.applet.Applet class Just a demo of what a Fast File Find might look * like for projects.html * * @author Roedy Green, Canadian Mind Products * @version 1.1 2006-03-05 * @since 2001 */ public final class FF extends Applet { /** * height of Applet box in pixels. Does not include surrounding frame. */ private static final int APPLET_HEIGHT = 240; /** * Width of Applet box in pixels. */ private static final int APPLET_WIDTH = 360; private static final int FIRST_COPYRIGHT_YEAR = 2001; /** * undisplayed copyright notice */ private static final String EMBEDDED_COPYRIGHT = "Copyright: (c) 2001-2017 Roedy Green, Canadian Mind Products, http://mindprod.com"; private static final String RELEASE_DATE = "2006-03-06"; /** * title of Applet */ private static final String TITLE_STRING = "Fast File Find"; /** * embedded version string */ private static final String VERSION_STRING = "1.1"; private static final Color DARK_GREEN = new Color( 0x008000 ); private static final Color FOREGROUND_FOR_LABEL = new Color( 0x0000b0 ); /** * for titles */ private static final Color FOREGROUND_FOR_TITLE = new Color( 0xdc143c ); /** * for for titles and About buttons */ private static final Font FONT_FOR_TITLE = FontFactory.build( "Dialog", Font.BOLD, 16 ); /** * trigger search */ private Button go; /** * options of how to search for the extension */ private Choice exthow; /** * option for how to search for the file */ private Choice filehow; /** * label for extension */ private Label extlabel; /** * label for the filename to search for */ private Label filelabel; /** * title */ private Label title; /** * extension to search for */ private TextField extname; /** * filename to search for */ private TextField filename; /** * Allow this Applet to run as as application as well. * * @param args command line arguments are ignored. */ public static void main( String args[] ) { Hybrid.fireup( new FF(), TITLE_STRING + " " + VERSION_STRING, APPLET_WIDTH, APPLET_HEIGHT ); } // end main /** * Called by the browser or Applet viewer to inform * this Applet that it is being reclaimed and that it should destroy * any resources that it has allocated. */ public void destroy() { exthow = null; extlabel = null; extname = null; filehow = null; filelabel = null; filename = null; go = null; title = null; } /** * Called by the browser or Applet viewer to inform * this Applet that it has been loaded into the system. */ public void init() { if ( !VersionCheck.isJavaVersionOK( 1, 8, 0, this ) ) { return; } this.setVisible( false ); this.setBackground( Color.white ); GridBagLayout gridBagLayout; gridBagLayout = new GridBagLayout(); setLayout( gridBagLayout ); GridBagConstraints gbc; title = new Label( TITLE_STRING + " " + VERSION_STRING, Label.CENTER ); title.setFont( FONT_FOR_TITLE ); title.setForeground( FOREGROUND_FOR_TITLE ); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 10, 10, 10, 10 ); ( ( GridBagLayout ) getLayout() ).setConstraints( title, gbc ); add( title ); filelabel = new java.awt.Label( "Filename", Label.LEFT ); filelabel.setForeground( FOREGROUND_FOR_LABEL ); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 10, 10, 10 ); ( ( GridBagLayout ) getLayout() ).setConstraints( filelabel, gbc ); add( filelabel ); filehow = new java.awt.Choice(); filehow.add( "Contains" ); filehow.select( "Contains" ); filehow.add( "Starts With" ); filehow.add( "Ends With" ); filehow.add( "Matches" ); filehow.add( "Wildcard" ); filehow.add( "Regex" ); filehow.add( "Ignore" ); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 10, 10, 10 ); ( ( GridBagLayout ) getLayout() ).setConstraints( filehow, gbc ); add( filehow ); filename = new java.awt.TextField(); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 10, 10, 10 ); gbc.ipadx = 100; ( ( GridBagLayout ) getLayout() ).setConstraints( filename, gbc ); add( filename ); extlabel = new java.awt.Label( "Extension", Label.LEFT ); extlabel.setForeground( FOREGROUND_FOR_LABEL ); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 10, 10, 10 ); ( ( GridBagLayout ) getLayout() ).setConstraints( extlabel, gbc ); add( extlabel ); exthow = new java.awt.Choice(); exthow.add( "Contains" ); exthow.add( "Starts With" ); exthow.add( "Ends With" ); exthow.add( "Matches" ); exthow.select( "Matches" ); exthow.add( "Wildcard" ); exthow.add( "Regex" ); exthow.add( "Ignore" ); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 10, 10, 10 ); ( ( GridBagLayout ) getLayout() ).setConstraints( exthow, gbc ); add( exthow ); extname = new java.awt.TextField(); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 0, 10, 10, 10 ); gbc.ipadx = 50; ( ( GridBagLayout ) getLayout() ).setConstraints( extname, gbc ); add( extname ); go = new java.awt.Button( "GO" ); go.setFont( FontFactory.build( "Dialog", Font.BOLD, 14 ) ); go.setForeground( Color.white ); go.setBackground( DARK_GREEN ); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 4; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets = new Insets( 10, 10, 10, 10 ); gbc.ipadx = 20; ( ( GridBagLayout ) getLayout() ).setConstraints( go, gbc ); add( go ); this.validate();// calculate the layouts this.setVisible( true );// Lights, Camera, Action. } }