Class MainFrame4k

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--MainFrame4k
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class MainFrame4k
extends java.applet.Applet
implements java.lang.Runnable

Yep. here it is. the source code for a simple java 4k I wrote for the demoparty "Mainframe". It competed in the 4k compo, and also in the "GNU demo award" where it's source code was judged. So that is why I have tried to comment this code a little :)

And yes... The song used in this intro (it is made by zantac btw, http://www.zantac.tk) has been used before... BUT I could not make it fit in less than 4k then, so it's ok anyway ;)

Also this intro uses sun-classes for audioplayer (notice the "import sun.audio.*" above). these are not standard so it is possible that this intro does not work with your java-version

It does however work with

  • Internet Explorer 3 and up
  • Netscape version ????

    OH! the compo version was compiled with Microsofts java compiler and then obfuscated with Retroguard

    Hello to everyone I know. (what? I'm lazy... ;))

    See Also:
    Serialized Form

    Inner Class Summary
    private  class MainFrame4k.AudioInput
              This class takes care of everything regarding audio.
     
    Inner classes inherited from class java.applet.Applet
    java.applet.Applet.AccessibleApplet
     
    Inner classes inherited from class java.awt.Panel
    java.awt.Panel.AccessibleAWTPanel
     
    Inner classes inherited from class java.awt.Container
    java.awt.Container.AccessibleAWTContainer
     
    Inner classes inherited from class java.awt.Component
    java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
     
    Field Summary
    private  int[] CHANNELintensity
              How loud the instrument for the channels are beeing played.
    private  MainFrame4k.AudioInput data
              this object plays all the music
    private  java.awt.Image doubleBuffer
              doublebuffer image
    private  java.awt.Graphics graphics
              The graphics object used when drawing to the doublebuffer
    private  long lastNote
              The time for when the last note was played.
     
    Fields inherited from class java.applet.Applet
    accessibleContext, serialVersionUID, stub
     
    Fields inherited from class java.awt.Panel
    base, nameCounter
     
    Fields inherited from class java.awt.Container
    component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
     
    Fields inherited from class java.awt.Component
    actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, width, windowClosingException, windowListenerK, visible, x, y
     
    Fields inherited from interface java.awt.image.ImageObserver
    ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
     
    Constructor Summary
    MainFrame4k()
               
     
    Method Summary
     void init()
               
     void paint(java.awt.Graphics g)
               
     void run()
               
     void start()
               
     void update(java.awt.Graphics g)
               
     
    Methods inherited from class java.applet.Applet
    destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, stop
     
    Methods inherited from class java.awt.Panel
    , addNotify, constructComponentName
     
    Methods inherited from class java.awt.Container
    add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, setLayout, transferFocus, validate, validateTree, writeObject
     
    Methods inherited from class java.awt.Component
    action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
     

    Field Detail

    data

    private MainFrame4k.AudioInput data
    this object plays all the music

    doubleBuffer

    private java.awt.Image doubleBuffer
    doublebuffer image

    graphics

    private java.awt.Graphics graphics
    The graphics object used when drawing to the doublebuffer

    CHANNELintensity

    private int[] CHANNELintensity
    How loud the instrument for the channels are beeing played. We use this to fade everything in the intro (if you do not know what I mean; watch the intro damn it!)

    lastNote

    private long lastNote
    The time for when the last note was played. If it has not been played yet it has a value of -1
    Constructor Detail

    MainFrame4k

    public MainFrame4k()
    Method Detail

    init

    public void init()
    Overrides:
    init in class java.applet.Applet

    start

    public void start()
    Overrides:
    start in class java.applet.Applet

    update

    public void update(java.awt.Graphics g)
    Overrides:
    update in class java.awt.Container

    paint

    public void paint(java.awt.Graphics g)
    Overrides:
    paint in class java.awt.Container

    run

    public void run()
    Specified by:
    run in interface java.lang.Runnable