Help With adding a scrollbar to my applet

This is the source code of my applet.I wat to have an autoscroll on this applet
i think it is usefull if i put here all the code for my project.
======================================================
Class ConsolePanel:
The file defines a class ConsolePanel. Objects of type
ConsolePanel can be used for simple input/output exchanges with
the user. Various routines are provided for reading and writing
values of various types from the output. (This class gives all
the I/O behavior of another class, Console, that represents a
separate window for doing console-style I/O.)
This class is dependent on another class, ConsoleCanvas.
Note that when the console has the input focus, it is outlined with
a bright blue border. If, in addition, the console is waiting for
user input, then there will be a blinking cursor. If the console
is not outlined in light blue, the user has to click on it before
any input will be accepted.
This is an update an earlier version of the same class,
rewritten to use realToString() for output of floating point
numbers..
package myproj;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JScrollPane;
import javax.swing.JScrollBar;
import javax.swing.*;
public class ConsolePanel extends JTextArea{
static public JScrollPane scrollPane;
// ***************************** Constructors *******************************
public ConsolePanel() { // default constructor just provides default window title and size
setBackground(Color.white);
setLayout(new BorderLayout(0, 0));
canvas = new ConsoleCanvas(500,1000);
scrollPane = new JScrollPane(canvas);
scrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setPreferredSize( new Dimension( 1000,10000) );
add("Center", scrollPane);
//scrollPane.getVerticalScrollBar().setUnitIncrement(1);
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
public void clear() { // clear all characters from the canvas
canvas.clear();
// *************************** I/O Methods *********************************
// Methods for writing the primitive types, plus type String,
// to the console window, with no extra spaces.
// Note that the real-number data types, float
// and double, a rounded version is output that will
// use at most 10 or 11 characters. If you want to
// output a real number with full accuracy, use
// "con.put(String.valueOf(x))", for example.
public void put(int x) {
put(x, 0);
} // Note: also handles byte and short!
public void put(long x) {
put(x, 0);
public void put(double x) {
put(x, 0);
} // Also handles float.
public void put(char x) {
put(x, 0);
public void put(boolean x) {
put(x, 0);
public void put(String x) {
put(x, 0);
// Methods for writing the primitive types, plus type String,
// to the console window,followed by a carriage return, with
// no extra spaces.
public void putln(int x) {
put(x, 0);
newLine();
} // Note: also handles byte and short!
public void putln(long x) {
put(x, 0);
newLine();
public void putln(double x) {
put(x, 0);
newLine();
} // Also handles float.
public void putln(char x) {
put(x, 0);
newLine();
public void putln(boolean x) {
put(x, 0);
newLine();
public void putln(String x) {
put(x, 0);
newLine();
// Methods for writing the primitive types, plus type String,
// to the console window, with a minimum field width of w,
// and followed by a carriage return.
// If outut value is less than w characters, it is padded
// with extra spaces in front of the value.
public void putln(int x, int w) {
put(x, w);
newLine();
} // Note: also handles byte and short!
public void putln(long x, int w) {
put(x, w);
newLine();
public void putln(double x, int w) {
put(x, w);
newLine();
} // Also handles float.
public void putln(char x, int w) {
put(x, w);
newLine();
public void putln(boolean x, int w) {
put(x, w);
newLine();
public void putln(String x, int w) {
put(x, w);
newLine();
// Method for outputting a carriage return
public void putln() {
newLine();
// Methods for writing the primitive types, plus type String,
// to the console window, with minimum field width w.
public void put(int x, int w) {
dumpString(String.valueOf(x), w);
} // Note: also handles byte and short!
public void put(long x, int w) {
dumpString(String.valueOf(x), w);
public void put(double x, int w) {
dumpString(realToString(x), w);
} // Also handles float.
public void put(char x, int w) {
dumpString(String.valueOf(x), w);
public void put(boolean x, int w) {
dumpString(String.valueOf(x), w);
public void put(String x, int w) {
dumpString(x, w);
// Methods for reading in the primitive types, plus "words" and "lines".
// The "getln..." methods discard any extra input, up to and including
// the next carriage return.
// A "word" read by getlnWord() is any sequence of non-blank characters.
// A "line" read by getlnString() or getln() is everything up to next CR;
// the carriage return is not part of the returned value, but it is
// read and discarded.
// Note that all input methods except getAnyChar(), peek(), the ones for lines
// skip past any blanks and carriage returns to find a non-blank value.
// getln() can return an empty string; getChar() and getlnChar() can
// return a space or a linefeed ('\n') character.
// peek() allows you to look at the next character in input, without
// removing it from the input stream. (Note that using this
// routine might force the user to enter a line, in order to
// check what the next character.)
// Acceptable boolean values are the "words": true, false, t, f, yes,
// no, y, n, 0, or 1; uppercase letters are OK.
// None of these can produce an error; if an error is found in input,
// the user is forced to re-enter.
// Available input routines are:
// getByte() getlnByte() getShort() getlnShort()
// getInt() getlnInt() getLong() getlnLong()
// getFloat() getlnFloat() getDouble() getlnDouble()
// getChar() getlnChar() peek() getAnyChar()
// getWord() getlnWord() getln() getString() getlnString()
// (getlnString is the same as getln and is onlyprovided for consistency.)
public byte getlnByte() {
byte x = getByte();
emptyBuffer();
return x;
public short getlnShort() {
short x = getShort();
emptyBuffer();
return x;
public int getlnInt() {
int x = getInt();
emptyBuffer();
return x;
public long getlnLong() {
long x = getLong();
emptyBuffer();
return x;
public float getlnFloat() {
float x = getFloat();
emptyBuffer();
return x;
public double getlnDouble() {
double x = getDouble();
emptyBuffer();
return x;
public char getlnChar() {
char x = getChar();
emptyBuffer();
return x;
public boolean getlnBoolean() {
boolean x = getBoolean();
emptyBuffer();
return x;
public String getlnWord() {
String x = getWord();
emptyBuffer();
return x;
public String getlnString() {
return getln();
} // same as getln()
public String getln() {
StringBuffer s = new StringBuffer(100);
char ch = readChar();
while (ch != '\n') {
s.append(ch);
ch = readChar();
return s.toString();
public byte getByte() {
return (byte) readInteger( -128L, 127L);
public short getShort() {
return (short) readInteger( -32768L, 32767L);
public int getInt() {
return (int) readInteger((long) Integer.MIN_VALUE,
(long) Integer.MAX_VALUE);
public long getLong() {
return readInteger(Long.MIN_VALUE, Long.MAX_VALUE);
public char getAnyChar() {
return readChar();
public char peek() {
return lookChar();
public char getChar() { // skip spaces & cr's, then return next char
char ch = lookChar();
while (ch == ' ' || ch == '\n') {
readChar();
if (ch == '\n') {
dumpString("? ", 0);
ch = lookChar();
return readChar();
public float getFloat() { // can return positive or negative infinity
float x = 0.0F;
while (true) {
String str = readRealString();
if (str.equals("")) {
errorMessage("Illegal floating point input.",
"Real number in the range " + Float.MIN_VALUE +
" to " + Float.MAX_VALUE);
} else {
Float f = null;
try {
f = Float.valueOf(str);
} catch (NumberFormatException e) {
errorMessage("Illegal floating point input.",
"Real number in the range " + Float.MIN_VALUE +
" to " + Float.MAX_VALUE);
continue;
if (f.isInfinite()) {
errorMessage("Floating point input outside of legal range.",
"Real number in the range " + Float.MIN_VALUE +
" to " + Float.MAX_VALUE);
continue;
x = f.floatValue();
break;
return x;
public double getDouble() {
double x = 0.0;
while (true) {
String str = readRealString();
if (str.equals("")) {
errorMessage("Illegal floating point input",
"Real number in the range " + Double.MIN_VALUE +
" to " + Double.MAX_VALUE);
} else {
Double f = null;
try {
f = Double.valueOf(str);
} catch (NumberFormatException e) {
errorMessage("Illegal floating point input",
"Real number in the range " + Double.MIN_VALUE +
" to " + Double.MAX_VALUE);
continue;
if (f.isInfinite()) {
errorMessage("Floating point input outside of legal range.",
"Real number in the range " + Double.MIN_VALUE +
" to " + Double.MAX_VALUE);
continue;
x = f.doubleValue();
break;
return x;
public String getWord() {
char ch = lookChar();
while (ch == ' ' || ch == '\n') {
readChar();
if (ch == '\n') {
dumpString("? ", 0);
ch = lookChar();
StringBuffer str = new StringBuffer(50);
while (ch != ' ' && ch != '\n') {
str.append(readChar());
ch = lookChar();
return str.toString();
public boolean getBoolean() {
boolean ans = false;
while (true) {
String s = getWord();
if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("t") ||
s.equalsIgnoreCase("yes") || s.equalsIgnoreCase("y") ||
s.equals("1")) {
ans = true;
break;
} else if (s.equalsIgnoreCase("false") || s.equalsIgnoreCase("f") ||
s.equalsIgnoreCase("no") || s.equalsIgnoreCase("n") ||
s.equals("0")) {
ans = false;
break;
} else {
errorMessage("Illegal boolean input value.",
"one of: true, false, t, f, yes, no, y, n, 0, or 1");
return ans;
// ***************** Everything beyond this point is private *******************
// ********************** Utility routines for input/output ********************
private ConsoleCanvas canvas; // the canvas where I/O is displayed
private String buffer = null; // one line read from input
private int pos = 0; // position next char in input line that has
// not yet been processed
private String readRealString() { // read chars from input following syntax of real numbers
StringBuffer s = new StringBuffer(50);
char ch = lookChar();
while (ch == ' ' || ch == '\n') {
readChar();
if (ch == '\n') {
dumpString("? ", 0);
ch = lookChar();
if (ch == '-' || ch == '+') {
s.append(readChar());
ch = lookChar();
while (ch == ' ') {
readChar();
ch = lookChar();
} while (ch >= '0' && ch <= '9') {
s.append(readChar());
ch = lookChar();
if (ch == '.') {
s.append(readChar());
ch = lookChar();
while (ch >= '0' && ch <= '9') {
s.append(readChar());
ch = lookChar();
if (ch == 'E' || ch == 'e') {
s.append(readChar());
ch = lookChar();
if (ch == '-' || ch == '+') {
s.append(readChar());
ch = lookChar();
} while (ch >= '0' && ch <= '9') {
s.append(readChar());
ch = lookChar();
return s.toString();
private long readInteger(long min, long max) { // read long integer, limited to specified range
long x = 0;
while (true) {
StringBuffer s = new StringBuffer(34);
char ch = lookChar();
while (ch == ' ' || ch == '\n') {
readChar();
if (ch == '\n') {
dumpString("? ", 0);
ch = lookChar();
if (ch == '-' || ch == '+') {
s.append(readChar());
ch = lookChar();
while (ch == ' ') {
readChar();
ch = lookChar();
} while (ch >= '0' && ch <= '9') {
s.append(readChar());
ch = lookChar();
if (s.equals("")) {
errorMessage("Illegal integer input.",
"Integer in the range " + min + " to " + max);
} else {
String str = s.toString();
try {
x = Long.parseLong(str);
} catch (NumberFormatException e) {
errorMessage("Illegal integer input.",
"Integer in the range " + min + " to " + max);
continue;
if (x < min || x > max) {
errorMessage("Integer input outside of legal range.",
"Integer in the range " + min + " to " + max);
continue;
break;
return x;
private static String realToString(double x) {
// Goal is to get a reasonable representation of x in at most
// 10 characters, or 11 characters if x is negative.
if (Double.isNaN(x)) {
return "undefined";
if (Double.isInfinite(x)) {
if (x < 0) {
return "-INF";
} else {
return "INF";
if (Math.abs(x) <= 5000000000.0 && Math.rint(x) == x) {
return String.valueOf((long) x);
String s = String.valueOf(x);
if (s.length() <= 10) {
return s;
boolean neg = false;
if (x < 0) {
neg = true;
x = -x;
s = String.valueOf(x);
if (x >= 0.00005 && x <= 50000000 &&
(s.indexOf('E') == -1 && s.indexOf('e') == -1)) { // trim x to 10 chars max
s = round(s, 10);
s = trimZeros(s);
} else if (x > 1) { // construct exponential form with positive exponent
long power = (long) Math.floor(Math.log(x) / Math.log(10));
String exp = "E" + power;
int numlength = 10 - exp.length();
x = x / Math.pow(10, power);
s = String.valueOf(x);
s = round(s, numlength);
s = trimZeros(s);
s += exp;
} else { // constuct exponential form
long power = (long) Math.ceil( -Math.log(x) / Math.log(10));
String exp = "E-" + power;
int numlength = 10 - exp.length();
x = x * Math.pow(10, power);
s = String.valueOf(x);
s = round(s, numlength);
s = trimZeros(s);
s += exp;
if (neg) {
return "-" + s;
} else {
return s;
private static String trimZeros(String num) { // used by realToString
if (num.indexOf('.') >= 0 && num.charAt(num.length() - 1) == '0') {
int i = num.length() - 1;
while (num.charAt(i) == '0') {
i--;
if (num.charAt(i) == '.') {
num = num.substring(0, i);
} else {
num = num.substring(0, i + 1);
return num;
private static String round(String num, int length) { // used by realToString
if (num.indexOf('.') < 0) {
return num;
if (num.length() <= length) {
return num;
if (num.charAt(length) >= '5' && num.charAt(length) != '.') {
char[] temp = new char[length + 1];
int ct = length;
boolean rounding = true;
for (int i = length - 1; i >= 0; i--) {
temp[ct] = num.charAt(i);
if (rounding && temp[ct] != '.') {
if (temp[ct] < '9') {
temp[ct]++;
rounding = false;
} else {
temp[ct] = '0';
ct--;
if (rounding) {
temp[ct] = '1';
ct--;
// ct is -1 or 0
return new String(temp, ct + 1, length - ct);
} else {
return num.substring(0, length);
private void dumpString(String str, int w) { // output string to console
for (int i = str.length(); i < w; i++) {
canvas.addChar(' ');
for (int i = 0; i < str.length(); i++) {
if ((int) str.charAt(i) >= 0x20 && (int) str.charAt(i) != 0x7F) { // no control chars or delete
canvas.addChar(str.charAt(i));
} else if (str.charAt(i) == '\n' || str.charAt(i) == '\r') {
newLine();
private void errorMessage(String message, String expecting) {
// inform user of error and force user to re-enter.
newLine();
dumpString(" *** Error in input: " + message + "\n", 0);
dumpString(" *** Expecting: " + expecting + "\n", 0);
dumpString(" *** Discarding Input: ", 0);
if (lookChar() == '\n') {
dumpString("(end-of-line)\n\n", 0);
} else {
while (lookChar() != '\n') {
canvas.addChar(readChar());
dumpString("\n\n", 0);
dumpString("Please re-enter: ", 0);
readChar(); // discard the end-of-line character
private char lookChar() { // return next character from input
if (buffer == null || pos > buffer.length()) {
fillBuffer();
if (pos == buffer.length()) {
return '\n';
return buffer.charAt(pos);
private char readChar() { // return and discard next character from input
char ch = lookChar();
pos++;
return ch;
private void newLine() { // output a CR to console
canvas.addCR();
private void fillBuffer() { // Wait for user to type a line and press return,
// and put the typed line into the buffer.
buffer = canvas.readLine();
pos = 0;
private void emptyBuffer() { // discard the rest of the current line of input
buffer = null;
public void clearBuffers() { // I expect this will only be called by
// CanvasApplet when a program ends. It should
// not be called in the middle of a running program.
buffer = null;
canvas.clearTypeAhead();
private void jbInit() throws Exception {
this.setNextFocusableComponent(scrollPane);
this.setToolTipText("");
} // end of class Console
============================================================
Class ConsoleCanvas:
/* A class that implements basic console-oriented input/output, for use with
Console.java and ConsolePanel.java. This class provides the basic character IO.
Higher-leve fucntions (reading and writing numbers, booleans, etc) are provided
in Console.java and ConolePanel.java.
(This vesion of ConsoleCanvas is an udate of an earilier version, rewritten to
be compliand with Java 1.1. David Eck; July 17, 1998.)
(Modified August 16, 1998 to add the
a mousePressed method to ConsoleCanvas. The mousePressed method requests
the focus. This is necessary for Sun's Java implementation -- though not,
apparently for anyone else's. Also added: an isFocusTraversable() method)
MouseListener interface and
Minor modifications, February 9, 2000, some glitches in the graphics.
package myproj;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
public class ConsoleCanvas extends JTextArea implements FocusListener, KeyListener,
MouseListener {
// public interface, constructor and methods
public ConsoleCanvas(int u,int y) {
addFocusListener(this);
addKeyListener(this);
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
public final String readLine() { // wait for user to enter a line of input;
// Line can only contain characters in the range
// ' ' to '~'.
return doReadLine();
public final void addChar(char ch) { // output PRINTABLE character to console
putChar(ch);
public final void addCR() { // add a CR to the console
putCR();
public synchronized void clear() { // clear console and return cursor to row 0, column 0.
if (OSC == null) {
return;
currentRow = 0;
currentCol = 0;
OSCGraphics.setColor(Color.white);
OSCGraphics.fillRect(4, 4, getSize().width - 8, getSize().height - 8);
OSCGraphics.setColor(Color.black);
repaint();
try {
Thread.sleep(25);
} catch (InterruptedException e) {}
// focus and key event handlers; not meant to be called excpet by system
public void keyPressed(KeyEvent evt) {
doKey(evt.getKeyChar());
public void keyReleased(KeyEvent evt) {}
public void keyTyped(KeyEvent evt) {}
public void focusGained(FocusEvent evt) {
doFocus(true);
public void focusLost(FocusEvent evt) {
doFocus(false);
public boolean isFocusTraversable() {
// Allows the user to move the focus to the canvas
// by pressing the tab key.
return true;
// Mouse listener methods -- here just to make sure that the canvas
// gets the focuse when the user clicks on it. These are meant to
// be called only by the system.
public void mousePressed(MouseEvent evt) {
requestFocus();
public void mouseReleased(MouseEvent evt) {}
public void mouseClicked(MouseEvent evt) {}
public void mouseEntered(MouseEvent evt) {}
public void mouseExited(MouseEvent evt) {}
// implementation section: protected variables and methods.
protected StringBuffer typeAhead = new StringBuffer();
// Characters typed by user but not yet processed;
// User can "type ahead" the charcters typed until
// they are needed to satisfy a readLine.
protected final int maxLineLength = 256;
// No lines longer than this are returned by readLine();
// The system effectively inserts a CR after 256 chars
// of input without a carriage return.
protected int rows, columns; // rows and columns of chars in the console
protected int currentRow, currentCol; // current curson position
protected Font font; // Font used in console (Courier); All font
// data is set up in the doSetup() method.
protected int lineHeight; // height of one line of text in the console
protected int baseOffset; // distance from top of a line to its baseline
protected int charWidth; // width of a character (constant, since a monospaced font is used)
protected int leading; // space between lines
protected int topOffset; // distance from top of console to top of text
protected int leftOffset; // distance from left of console to first char on line
protected Image OSC; // off-screen backup for console display (except cursor)
protected Graphics OSCGraphics; // graphics context for OSC
protected boolean hasFocus = false; // true if this canvas has the input focus
protected boolean cursorIsVisible = false; // true if cursor is currently visible
private int pos = 0; // exists only for sharing by next two methods
public synchronized void clearTypeAhead() {
// clears any unprocessed user typing. This is meant only to
// be called by ConsolePanel, when a program being run by
// console Applet ends. But just to play it safe, pos is
// set to -1 as a signal to doReadLine that it should return.
typeAhead.setLength(0);
pos = -1;
notify();
protected synchronized String doReadLine() { // reads a line of input, up to next CR
if (OSC == null) { // If this routine is called before the console has
// completely opened, we shouldn't procede; give the
// window a chance to open, so that paint() can call doSetup().
try {
wait(5000);
} catch (InterruptedException e) {} // notify() should be set by doSetup()
if (OSC == null) { // If nothing has happened for 5 seconds, we are probably in
// trouble, but when the heck, try calling doSetup and proceding anyway.
doSetup();
if (!hasFocus) { // Make sure canvas has input focus
requestFocus();
StringBuffer lineBuffer = new StringBuffer(); // buffer for constructing line from user
pos = 0;
while (true) { // Read and process chars from the typeAhead buffer until a CR is found.
while (pos >= typeAhead.length()) { // If the typeAhead buffer is empty, wait for user to type something
cursorBlink();
try {
wait(500);
} catch (InterruptedException e) {}
if (pos == -1) { // means clearTypeAhead was called;
return ""; // this is an abnormal return that should not happen
if (cursorIsVisible) {
cursorBlink();
if (typeAhead.charAt(pos) == '\r' || typeAhead.charAt(pos) == '\n') {
putCR();
pos++;
break;
if (typeAhead.charAt(pos) == 8 || typeAhead.charAt(pos) == 127) {
if (lineBuffer.length() > 0) {
lineBuffer.setLength(lineBuffer.length() - 1);
eraseChar();
pos++;
} else if (typeAhead.charAt(pos) >= ' ' &&
typeAhead.charAt(pos) < 127) {
putChar(typeAhead.charAt(pos));
lineBuffer.append(typeAhead.charAt(pos));
pos++;
} else {
pos++;
if (lineBuffer.length() == maxLineLength) {
putCR();
pos = typeAhead.length();
break;
if (pos >= typeAhead.leng

Hi
I don't understand the exact need you want
you want to add Scrolling facility to your Entire Applet or only for the Textarea Class?
In first case
Create the ScrollPane and add it to the applet contentPane. and put entire components to a Panel and just add it to scroll pane.
Regards
Vinoth

Similar Messages

  • Help with adding image onclick

    Hey everyone,
    I am making a simple game in AS3 and need help with adding an image once they have click on something.
    On the left of the screen are sentences and on the right an image of a form. When they click each sentence on the left, writing appears on the form. Its very simple. With this said, what I would like to do is once the user click one of the sentences on the left, I would like a checkmark image to appear over the sentence so they know they have already clicked on it.
    How would I go about adding this to my code?
    var fields:Array = new Array();
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
        fields.push(new one_form());
        fields[fields.length-1].x = 141;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);   
        one_btn.removeEventListener(MouseEvent.CLICK, onClick1a);
        one_btn.buttonMode = false;
        //gotoAndStop("one")
    two_btn.addEventListener(MouseEvent.CLICK, onClick2a);
    two_btn.buttonMode = true;
    function onClick2a(event:MouseEvent):void
        fields.push(new two_form());
        fields[fields.length-1].x = 343.25;
        fields[fields.length-1].y = -85;
        this.addChild(fields[fields.length-1]);
        two_btn.removeEventListener(MouseEvent.CLICK, onClick2a);
        two_btn.buttonMode = false;
        //gotoAndStop("two")

    I don't know where you're positioning the button that should enable/disable the checkbox but for "one_btn" let's just say it's at position: x=100, y=200. Say you'd want the checkbox to be to the left of it, so the checkbox would be displayed at: x=50, y=200. Also say you have a checkbox graphic in your library, exported for actionscript with the name "CheckBoxGraphic".
    Using your code with some sprinkles:
    // I'd turn this into a sprite but we'll use the default, MovieClip
    var _checkBox:MovieClip = new CheckBoxGraphic();
    // add to display list but hide
    _checkBox.visible = false;
    // just for optimization
    _checkBox.mouseEnabled = false;
    _checkBox.cacheAsBitmap = true;
    // adding it early so make sure the forms loaded don't overlap the
    // checkbox or it will cover it, otherwise swapping of depths is needed
    addChild(_checkBox);
    // I'll use a flag (a reference for this) to know what button is currently pushed
    var _currentButton:Object;
    one_btn.addEventListener(MouseEvent.CLICK, onClick1a);
    one_btn.buttonMode = true;
    function onClick1a(event:MouseEvent):void
         // Check if this button is currently the pressed button
         if (_currentButton == one_btn)
              // disable checkbox, remove form
              _checkBox.visible = false;
              // form should be last added to fields array, remove
              removeChild(fields[fields.length - 1]);
              fields.pop();
              // clear any reference to this button
              _currentButton = null;
         else
              // enable checkbox
              _checkBox.visible = true;
              _checkBox.x = 50;
              _checkBox.y = 200;
              // add form
              fields.push(new one_form());
              fields[fields.length-1].x = 141;
              fields[fields.length-1].y = -85;
              this.addChild(fields[fields.length-1]);
              // save this button as last clicked
              _currentButton = one_btn;
         // not sure what this is
        //gotoAndStop("one")
    I'd also centralize all the click handlers into a single handler and use the buttons name to branch on what to do, but that's a different discussion. Just see if this makes sense to you.
    The jist is a graphic of a checkbox that is a MovieClip symbol in your library exported to actionscript with the class name CheckBoxGraphic() is created and added to the display list.
    I made a variable that points itself to the last clicked button, when the "on" state is desired. If I detect the last clicked button was this button, I remove the form I added and the checkbox. If the last clicked button is not this button, I enable and position the checkbox as well as add the form.
    What is left to do is handle the sitation where multiple buttons are on the screen. When a new button is pushed it should remove anything the previous button added. This code simply demonstrates clicking the same button multiple times to toggle it "on and off".

  • Help with adding a hyperlink to a button?

    We have a simple little site we built in Catalyst and everything works great. The only problem is that we cannot figure out how to add a hyperlink to one of the buttons in the animation. We simply want to be able to click on the button and go to another site (the client's Facebook page specifically). Can anyone provide some insight? Thanks!

    The message you sent requires that you verify that you
    are a real live human being and not a spam source.
    To complete this verification, simply reply to this message and leave
    the subject line intact.
    The headers of the message sent from your address are shown below:
    From [email protected] Tue Nov 03 19:08:07 2009
    Received: from mail.sgaur.hosted.jivesoftware.com (209.46.39.252:45105)
    by host.pdgcreative.com with esmtp (Exim 4.69)
    (envelope-from <[email protected]>)
    id 1N5TPy-0001Sp-J1
    for [email protected]; Tue, 03 Nov 2009 19:08:07 -0500
    Received: from sgaurwa43p (unknown 10.137.24.44)
         by mail.sgaur.hosted.jivesoftware.com (Postfix) with ESMTP id 946C5E3018D
         for <[email protected]>; Tue,  3 Nov 2009 17:08:03 -0700 (MST)
    Date: Tue, 03 Nov 2009 17:07:49 -0700
    From: Tvoliter <[email protected]>
    Reply-To: [email protected]
    To: Matthew Pendergraff <[email protected]>
    Message-ID: <299830586.358941257293283616.JavaMail.jive@sgaurwa43p>
    Subject: Help with adding a hyperlink to a button?
    MIME-Version: 1.0
    Content-Type: multipart/mixed;
         boundary="----=_Part_36702_1132901390.1257293269030"
    Content-Disposition: inline
    X-Spam-Status: No, score=-3.4
    X-Spam-Score: -33
    X-Spam-Bar: ---
    X-Spam-Flag: NO

  • Need help with adding emoji to my hubby's phone don't see it when I click on the keyboard tab

    I need help with adding emoji to my hubby's iPhone when I go to settings then the keyboard tab it's not there

    I did that bad it's not there and doesn't give me to option to click on it

  • Archive applet. Help with adding files to archive, then show.

    I need help with this applet: http://pastebin.com/589064
    The user is supposed to add, remove and open archives with text in it.
    My problem is now the highlited area in the code (the lines with the @@'s).
    This button should list all files i have added to the archive, however when i press the button, i only get a numberlisting. eg, if i have added 4 files to the archive I get: 0123
    However I want the Joptionpane to show a listing of the files in the archive.
    When I press "open" i can choose a file, press add, then open a new file, press add, and then when i click show archive, the filenames of the two files i added, should list through a Joptionpane..as you can see, i've tried, but i'm very unfamiliar with this.

    OK..i've done it
    check out http://pastebin.com/589268
    however, now i'd like to change the code, so that if i try to add to files with the same filename, the applet should show an error message..
    How do i do that, please? :-)

  • [CS3 JS] Help with adding textMacros

    I can get a textMacro added with the following.
    app.textMacros.add("myName", "this is some text")
    What I am having trouble with is having the Remember Text Attributes be grabed or set to true.
    Any one know what the syntax is for setting this during the add()
    also how do you insert a macro via a javascript?
    Mahalo
    David

    These forums are pointless. Adobe must believe that other users will cut the mustard. Absolutely a waste of effort for everyone. Adobe should PAY at least a junior developer involved in the projects to monitor and help with these posts. FLEX rules yeah and thousands more do scripting than develop plug ins...
    Come on Adobe, step up your better than this. Customer Service can be free to the customers ... we are not talking about GET IT ALL FREE, talking about buy it and create a community and support it, but then again LAYERS and INDESIGN SECRETS have people who actually want to help users rather than rabbit hole everything.
    Please join hands and SING...

  • Help With Adding Back Up of Songs & Lists on Re-Installed iTunes v 7.0.2

    I have a portable hard drive with a back up of my 10,000 songs. I have to get my Gateway PC laptop serviced as it continues to crash, and so I will need to re-install iTunes v 7.0.2 and then add back my songs from the portable hard drive.
    I need help with a couple of questions:
    1) Is there a quicker way to add the songs back on to iTunes rather than adding individual files (for songs) and individual folders (for albums)?
    2) I have several song lists (some used to make CD's). How can these lists be backed up as well so that I do not have to re-create these lists?
    Any advice very much appreciated.

    There is a good article on backup here:
    http://discussions.apple.com/thread.jspa?messageID=1522195&#1522195
    If all your music is in the iTunes Music folder and you have room, just copy the iTunes folder to your external drive.
    This will include both your music files and the iTunes library files.
    If you music is stored in other places, you need to backup those too. When you restore you need to ensure the full path name is the same.
    Life is also much easier if you can keep exactly the same account name if you reinsall windows as the account name is part of the path to My Documents.

  • Need help with adding images option

    I was using the add images option a few weeks ago just fine.. using my tablet and uploading the images via usb. then all of the sudden it stopped working.
    please help with this issue.
    Danny

    A few questions. What result are you experiencing? Did PS Touch crash? Have you tried to force quit-and restart PS Touch? -Guido

  • Help with adding new song to 2007 iPod shuffle

    I have an iPod shuffle from 2007 and just recently went to add new songs to it.  Itunes program keeps telling me I have to erase everything and reload w/ new playlist I've added??  Confused, don't remember it working like this last year when I added songs.  Any help??

    With the 1st and 2nd gen iPod shuffle, it can only be associated with one iTunes library at a time.  That has always been the design.  It is basically like a mobile playlist for iTunes the library.  The 3rd and 4th gen shuffles work more like the "bigger" iPods that have a screen, which is different from the very simple 1st and 2nd gen.
    If you previously used this shuffle with a different iTunes library, iTunes is asking if you want to associate the shuffle with the iTunes library you are now using.
    Any help??
    What do you want to do...?

  • Need help with adding a Key flex field to a seeded OAF page

    We have a seeded OAF page on which we already have Account Key Flex Field.
    Properties of this flex field are:
    The ApplShortName - SQLGL
    Name - GL#
    Type - Key
    As per the client requirement, in the KFF screen, we have disabled the seeded structure for Accounting Flexfield and created a custom structure.
    Our custom structure for the KFF is displayed correctly on the OAF page.
    But now the requirement is to add a new KFF on the OAF page which is duplicate of the existing KFF, along with the existing KFF field; the structure and segments are same. Only difference being the display name of the existing KFF field is Account; the new one needs to be Tax structure.
    Using personalization we added a new flex item and added the properties same as the existing KFF.
    ApplShortName - SQLGL
    Name - GL#
    Type - Key
    But the page is giving following error:
    The data that defines the flexfield on this field may be inconsistent. Inform your system administrator that the function: KeyFlexfieldDefinitionFactory.getStructureNumber could not find the structure definition for the flexfield specified by Application = SQLGL, Code = GL# and Structure number =
    We tried options like compiling the flexfield definition, but the error persists.
    Any help in this regard is highly appreciated.
    Regards,
    Kiranmayi.

    Hi,
    Please check whether your key flex structure is frozen or not. If now please freeze it and re compile and try.
    This may helps too
    error while developing KFF in oaf
    Thanks
    Bharat
    Edited by: Bharat on May 10, 2013 4:51 AM

  • Help with adding text please.

    Hi- Im new to the forum and even newer to Dreamweaver.
    Ive just started putting a site together using a youtube
    tutorial which has gone really well. Ive designed my layout in
    photoshop, then put it into imageready to edit/slice, saved as
    html- then opened with dreamweaver. I found it easy this way, and
    rollovers can be made within the html file in image ready.
    Anyway- heres where the problems started- Im trying to add
    text over on image. The tutorial I went off said to cut the image
    from the Src then paste it into the Bg field so that you can type
    over it- but it goes nuts! When you enter at the end of text lines
    the image begins to repeat itself underneath and white blocks show
    up at the side of the image!?
    Is there a way to just easily type over on image- i tried
    doing this in image ready which works, but saves the text as an
    image, but I want the text the be recognised by google- Im
    confused- please help.
    I was reading about tables and adding the image as a table
    background- but positioning the table in the correct place is
    confusing too- told you i was a newbie!
    Thanks in advance for any help!
    Claire

    Universal wisdom, except of course, at this NG. :-)
    Walt
    "Nancy O" <[email protected]> wrote in message
    news:[email protected]...
    > At YouTube, you get what you pay for. ;-)
    >
    > --Nancy O.
    > Alt-Web Design & Publishing
    > www.alt-web.com
    >
    >
    > "Walt F. Schaefer" <[email protected]> wrote
    in message
    > news:[email protected]...
    >> I confess I've never been to YouTube but I don't
    think it would be my
    > first
    >> choice for DW tuts.
    >>
    >> --
    >>
    >> Walt
    >>
    >>
    >> "Nancy O" <[email protected]> wrote in
    message
    >> news:[email protected]...
    >> > Walt is 100% correct. Image Ready code - yuck!
    >> >
    >> > To give you a basic idea of how to work with
    image slices in DW, have a
    >> > look
    >> > at this page:
    >> >
    http://alt-web.com/Image-slices-in-a-CSS-based-layout.html
    >> >
    >> > Also this: Taking a Fireworks (or Pshop) comp
    to a CSS based layout in
    > DW
    >> >
    >
    http://www.adobe.com/devnet/fireworks/articles/web_standards_layouts_pt1.html
    >> >
    >> > If none of this makes any sense to you, start
    here:
    >> > www.w3schools.com
    >> >
    >> >
    >> > --Nancy O.
    >> > Alt-Web Design & Publishing
    >> > www.alt-web.com
    >> >
    >> >
    >> > "claire 83"
    <[email protected]> wrote in message
    >> > news:[email protected]...
    >> >> Hi- Im new to the forum and even newer to
    Dreamweaver.
    >> >> Ive just started putting a site together
    using a youtube tutorial
    > which
    >> > has
    >> >> gone really well. Ive designed my layout in
    photoshop, then put it
    >> >> into
    >> >> imageready to edit/slice, saved as html-
    then opened with dreamweaver.
    > I
    >> > found
    >> >> it easy this way, and rollovers can be made
    within the html file in
    > image
    >> > ready.
    >> >> Anyway- heres where the problems started-
    Im trying to add text over
    > on
    >> > image.
    >> >> The tutorial I went off said to cut the
    image from the Src then paste
    > it
    >> > into
    >> >> the Bg field so that you can type over it-
    but it goes nuts! When you
    >> > enter at
    >> >> the end of text lines the image begins to
    repeat itself underneath and
    >> > white
    >> >> blocks show up at the side of the image!?
    >> >> Is there a way to just easily type over on
    image- i tried doing this
    > in
    >> > image
    >> >> ready which works, but saves the text as an
    image, but I want the text
    >> >> the
    >> > be
    >> >> recognised by google- Im confused- please
    help.
    >> >> I was reading about tables and adding the
    image as a table
    >> >> background-
    >> > but
    >> >> positioning the table in the correct place
    is confusing too- told you
    >> >> i
    >> > was a
    >> >> newbie!
    >> >> Thanks in advance for any help!
    >> >> Claire
    >> >>
    >> >
    >> >
    >>
    >>
    >
    >

  • Need help with adding formatted text and images to Crystal Report?

    Here's my scenario:
    I have a customer statement that's generated as a crystal report and that has a placeholder for advertisement. The advertisement is mixture of formatted text and images. Until now we only had one advertisement that was always used on the report. The new requirement is that we would have a pool of hundreds of advertisements and would need to display one specific advertisement on the customer statement based on various marketing criteria. They key is that the advertisement content will be determined programmatically and cannot be hardcoded into the report. I'm using Crystal2008 with .net SDK.
    Here are the solutions I thought of, but I'm still rather lost and would appreciate your help/opinion.
    1) Pass HTML or RTF to the report
    Not really sure if this is possible and how to get it done. Also how would I pass in images? Would display formatting be reliable when exporting to PDF?
    2) Create each add as a subreport and append it programatically
    I actually have this working, but I only know how to append a new section to the end of the report and then load the subreport to the section. I have no other controll of the placement. Is there a way to dynamically load a subreport to a predefined section in the main report? How about adding a dummy subreport in the main report as a placeholder and then replacing it with a different subreport? How could I do this?
    3) Pass an Image to the report
    I would create each advertisement as an image and then would somehow add the image to the report. How would I load the image and control the placement? Could I somehow define a placeholder for the image in the main report-maybe a dummy image to be replaced?
    Thank you.

    Hello Pavel,
    I would got the third way.
    You can use dynamic images in your report.
    Just by changing the URL to the image the image can be changed.
    Please see the [Crystal Manual|http://help.sap.com/businessobject/product_guides/cr2008/en/xir3_cr_usergde_en.pdf] and search for images.
    or directly here
    [Setting a Dynamic Graphic Location Path on an Image Object|https://boc.sdn.sap.com/node/506]
    [Dynamic image and HTTP://|https://boc.sdn.sap.com/node/3646]
    [codesample for .NET|https://boc.sdn.sap.com/node/6000]
    Please also use
    [Crystal Reports 2008 SDK Documentation and Sample Code|https://boc.sdn.sap.com/developer/library/CR2008SDK]
    [Crystal Reports 2008 .NET SDK Tutorial Samples|https://boc.sdn.sap.com/node/6203]
    Hope this helps
    Falk

  • I need help with adding fire to an existing picture in elements 8

    I'm a painting contractor and I'm trying to create a new picture for my buisness cards and tee shirts. What I want to do is put flames coming from a brush and work pot that I'm holding in my hands. I've looked everywhere on line, but I can't find exactly what I want. I'm hoping that someone in this forum will be able to help me. Thanks.

    Okay, I have been playing with for a few days. Warning, this is going to be loooong. I do this differently in Photoshop but couldn't get it to work with the elements workset as it doesn't have the curves tool that Photoshop has so I had to find an alternate method to pump up the flames. Luckily, I ran into a video that used a method other than curves to get me on track. I assumed you want realistic flames...so I was pushing for how real could I make flames using paint and blend mode operations.
    Edit: I should let you know that you can try to extract flames from other photos and composite them into your photo. First, need a good fire image. It works best if you can find a fire with a black background. Screen blend mode will drop out black. Try working with two copies of the image. Turn off the topmost copy of the flames. Leave the bottom flames in Normal blend mode. Mask or erase the outer edges of the flames with a soft brush so that only the interior of the flames are visible. Now, turn on the topmost version of the flames. Leave the topmost version of the intact...don't mask or erase anything. Change this topmost flame layer's blend mode to screen blend mode. If you see any problems with your flames, you can erase or mask any defects. You can duplicate the screen layer to brighten the effect. Use opacity to control the volume. This would be the easiest solution but you'll have to find some flames that trip your fancy. I haven't tried this out yet so can't say how much better or worse it would be than using a good set of flame brushes along with some blend mode tricks.
    Below shows how close I can get using paint. I only used options available in PSE. I used layer masks that if you had PSE 9 would be native. Since you have PSE 8, you'll need to either download an install an add on that adds the basic layer mask function or use clipping masking.
    Below is a link to a freeware set that includes layer masks. Install instructions are on that site.
    http://www.cavesofice.org/~grant/Challenge/Tools/Files.html
    If you want to go the clipping mask route, have a look at this tutorial:
    http://www.photokaboom.com/photography/learn/Photoshop_Elements/layers/layer_groups_clippi ng_masks/1_layer_groups_clipping_masks.htm
    Before and After the effect.
    I would have posted sooner but had to find a workable solution to making the flames look realistic in Elements as I can’t use the curves tool as it isn’t native to Elements.
    With the help of this YouTube video I came up with something…
    http://www.youtube.com/watch?v=cOIBkWvHOqk&feature=related
    I based this tutorial on the hue/sat numbers, blend modes, and blurs.
    First, I downloaded a flame brush set. This set in specific:
    http://luexo.deviantart.com/art/Scorching-Flames-Brushpack-92945924
    The above set is really nicely done and  has large high resolution brushes.
    One thing I do not agree with in the video is the color used. White is hard to change in the Hue/Saturation dialog. Instead I use 50% gray as my paint color. This is easy to set…either use the 50% color swatch or open the Color Picker and set H to 0, S to 0, and B to 50...hex number is 808080.
    Things to keep in mind include fire is gaseous, bright and the way it burns…it one direction, fire reflects and there is probably going to be some smoke.
    In my example, I am going to set a  lunch cake. Nice 4th of July theme. J
    Let’s start my scorching the item that will be burned. In this case the lunch cake will be scorched.
    Scorch the item…preparing to light it up.
    1. Duplicate image and put image into Linear burn blend mode; opacity 100%. Add layer mask or erase everything but the item to be scorched…the lunch cake.
    2. Duplicate layer you just made in step #1. Change the blend mode to Multiply 100%. Desaturate this layer.  Image Adjustments<Hue/Saturation…move Master Saturation slider to  -100. Take burn tool set to Range: Midtones; Exposure 35%; air brush on…and scorch the item. Make it kind of smudgy. You don’t want an even coat. Make it darker as you get closer to the flames.
    Note: Here I’ve jumped ahead. I already know where my flames are going to be. Either visualize where you want your flames or jump ahead and laid down the basic paint and transform into the correct position. Turn off flame layer (s) when done. So step #3 if you do any repair work isn’t affected.
    3. If you feel you need to do any clone repairs, create a composite image ctrl + shift + alt + e if on PC…cmd + shift + opt + e if on a Mac. Do the clone work on a blank layer over this. With clone tool selected, check the box in the options bar that says something like “All Layers”, “Use All Layers”, “Sample All Layers”…the box says one of those things beside it. I can’t recall which and not sure if it’s consistent between all versions of Elements.  Anyway, Leave layer in Normal blend mode 100% and likewise leave tool in Normal blend mode…opacity to taste. Fix any defects on this layer. You can do the same thing with the healing brush if you need to do any healing. I find it best to heal to a separate layer and not mix and match the healing tool and  clone stamp on the same layer.
    4. Turn off or trash the Clone Stamp comp layer when finished with step #3.
    Let’s Build a Fire…
    5. Create a blank layer in the layers palette….Normal blend mode; 100% opacity.  Make white your foreground color chip.  Grab the paint brush tool…normal blend mode; 100% opacity. Paint one flame on your layer. I have used the 1220 sized flame near the bottom of the brush set I linked earlier. Use the transform command …Ctrl + t (PC) or Cmd + t (Mac)…to size and position the flame. I used  also slightly warped the flame using transform warp. Since you don’t have that in Elements…slightly warp the flame in the liquefy dialog.
    Note: The above flame is pretty much backlighting…you are done with it.
    6. Change the color foreground color chip in your layers palette to 50% gray. Use the same brush tip you used in step #5. Size and position it so it closely matches the white flame in Step #5. Go to liquefy dialog and slightly warp it.
    Note: The goal is for the flames in step #5 and step #6 to be very similar but not exact.
    7.. Duplicate the 50% gray flame you made in step #6 twice. Turn off the top 50% gray flame for now.
    Fire is Bright...
    8. Now that video comes in that I linked.
    (1) Blur the 50% gray flame with Gaussian blur. I used 6 pixels. Go to menu and click Enhance or is it Adjustments<Hue/Saturation…check the box that says “colorize”; change master sliders to Hue 42; Saturation 100; Lightness 0.
    (2)Duplicate the flame you made above…step  (1). Go to the menu bar and click Enhance or is it Adjustment<Hue/Saturation…change master sliders to Hue -43; saturation 0; Lightness 0. Change this layers blend mode to Color Dodge blend mode and merge down…Ctrl + e on PC; cmd + e on Mac.
    Note: This layer will now say Normal blend mode; 100%.
    (3)I duplicated the merged layer I now have from step (2). I changed the blend mode of this layer to Screen and set the opacity to 100%.
    (4) I made a duplicate of the layer I have made in step (2)…the one that now says it’s in Normal blend mode; 100%… then blurred it with Gaussian blur. I used 46 pixels. I moved this layer down in my layers palette so that it rests beneath my other two colored flame layers. The white flame layer is directly below it. Leave this layer in Normal blend mode; 100% opacity.
    9. Go back to 50% gray flame you made in step #6...visibility eye should be off. You should have two of these gray layers if not duplicate one so that you do have tow 50% gray flame layers. (These were not blurred.)  These two layers need to be on the top of the stack. If they are not, move them up so that they are the top two layers. Turn on the visibility of the bottom 50% gray layer. Change the layer’s blend mode to Screen blend mode; opacity 100%. Grab the burn tool. Burn some of the flame base and randomly in the flame of the 50% gray.  Press and hold in the alt key (PC) or the opt key (Mac) and dodge the tops of the flames and do some random dodge work.
    10. Turn on the visibility for the top 50% gray layer. Leave this one alone…no dodge + burn. Set this layer to Screen blend mode; opacity 96%.
    11. Add layer masks to white and color flame layers…not the gray ones. Paint away any unattractive color spill. Bright orange edges…bright white distractions where flame edges don’t align.
    12. Make a composite layer of all layers up to date. Set this layer’s blend mode to multiply; opacity 47%. Add a layer mask and mask out everything but the flames. Tip: You can select the flames by ctrl + shift clicking on each flame layer thumbnail…the shift lets you add to a selection. On the Mac, cmd + shift click the layer thumbnails.
    Flames Reflect…
    13. Make a copy of one of your blurred color flames. Transform it so it rest over item that it should reflect on. In this case I have added a blurred flame onto my son’s eye. The flame is in Overlay blend mode; 33% opacity.
    14 Several steps Eye enhancements to my son’s eye…omitted because it’s off topic
    15. I used a gradient map with a fire like black/red/yellow/white gradient map set to Softlight blend mode; 17% to give my image a hint of a color cast. I masked it so only some skin, hair, and car areas have this slight color cast.
    Where there’s fire there is going to be some smoke...
    16. To make my smoke, I made a separate large document my photo size. I set my color chips to the default b/w. (Shortcut is D.) I went to menu bar and clicked Filter<Render<Clouds. Next I went back to my menu bar and clicked Filter<Render<Difference Clouds. I used Ctrl + f to repeat the Difference Cloud filter until I was happy with the effect…looking for swirled black lines…kind of like lightning. (If on a Mac, use Cmd + f to repeat a filter. I then used the transform command to enlarge the pattern I made. Be sure to scale it so that height and width both are enlarged equally. Next, go to the men bar and select<All ; Edit<Crop. You want to do to get rid of the excess. I think I transformed my patter to something like 200% which makes the file really big. You can do it on your image file but because of file size the transform will take a really long time. When happy copy/paste or drag/drop this pattern into your photo file.
    17. Now blur pattern really good using Gaussian blur. Now, add a layer mask to your pattern layer. Click the layer mask in the layers palette to target it and run the the clouds and difference clouds on the mask just as you do on the pattern layer. Just those filters…no blur.
    Basic smoke pattern final
    18. Duplicate this layer w mask twice. You should have three smoke copies. Turn off all but the bottom pattern copy. Use the paint brush and paint black in mask to hide the smoke everywhere but where you want to keep it. Set this layer’s blend mode to Multiply blend mode; opacity 15%.
    View of the inside one of the smoke layer masks
    19. Turn on the visibility of the next smoke pattern. Again use a black paint to paint where you don’t want paint. (Make this variable as you want the smoke to be varying opacity.)  Layer blend mode Multiply; opacity 15%.
    20. Turn on the visibility of the next smoke pattern…top one in stack. Again use black to paint where you don’t want the smoke. Set this layer’s blend mode to Multiply blend mode; opacity 1%.
    Fire is Gaseous...
    21. Make a composite of all layers by pressing ctrl + shift + alt + e if on PC. Use Cmd + shift + opt + e if on a Mac. Blur your composite image. I used 3 pixels. Set the blend mode to Normal; opacity 64%. Add a layer mask and fill it with black paint to hide the blur effect. Use the paint brush with white paint in the layer mask to blur any sharp edges and base of flames. Remember flame is gaseous.
    Above shows my layers for completed image. Notice the comp for clone layer is off. I did not need it after I did the clone to a blank layer to add some scorched cake around my son's fingers.

  • Need help with adding buttons.

    I thought I could do this without help but I was wrong. I had to add buttons to my program and before it ran fine with the first four buttons I added but know there are many errors and I believe I messed up the whole thing now. Any advice would be greatly appreciated. Here is my code:
    import java.util.*;
    import java.text.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JFrame.*;
    import java.io.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import javax.imageio.*;
    import java.awt.image.*;
    public class DVDInventory6
    public static void main(String[] args)
           Scanner input = new Scanner( System.in );
           int j;
          DVD_Genre [] inventory = new DVD_Genre[5]; // Size of the array
          // create DVD object
          inventory [ 0 ] = new DVD_Genre( "Rocky", "Action/Drama", 01, 15, 9.95 );
          inventory [ 1 ] = new DVD_Genre( "RockyII", "Action/Drama", 02, 13, 14.95 );
          inventory [ 2 ] = new DVD_Genre( "Matrix", "Action/Sci-Fi", 03, 23, 14.95 );
          inventory [ 3 ] = new DVD_Genre( "MatrixII", "Action/Sci-Fi", 04, 17, 19.95 );
          inventory [ 4 ] = new DVD_Genre( "Bambi", "Family", 05, 33, 12.95 );
          // Print out a screen title
          System.out.println();
          System.out.printf("Welcome to DVD Inventory:\n\n");
       GUI gui = new GUI();
          for(j=0; j<5; ++j)
               gui.add(inventory[j]);   
         double total = 0;
         for ( j=0; j<inventory.length; j++ )
             total += inventory[j].getvalueofdvds ();
    } // end for
             gui.setTotal(total);
       gui.display();
    public static void sortDVD(DVD[] inventory)
         //DVD_Genre temp[] =  new DVD_Genre[1];
          int i, j;
          for (i=1; i <inventory.length; i++)
             for (j=0; j < inventory.length-i; j++)
                if (inventory[j].getdvdName().compareTo(inventory[j+1].getdvdName())>0)
                   // exchange elements
                   DVD  temp = inventory[j]; //new DVD_Genre [1];
                   inventory[j] = inventory[j+1];
                   inventory[j+1] = temp; //temp [0];
       }//end method main
    }//end DVDInventory6
          class DVD
          protected String dvdName; //  DVD title
          protected String dvdGenre; // DVD genre
          protected int productnumber;  // DVD product number
          protected int numberofproducts; // the number of products in stock
          protected double price; // the price of the products in stock
            public DVD (String name, String genre, int productnumber, int numberofproducts,
    double price ) // class dvd constructor
            this.dvdName = name;
            this.productnumber = productnumber;
            this.numberofproducts = numberofproducts;
            this.price = price;
    this.dvdGenre = genre;
           public DVD( String name, int productnumber, int numberofproducts, double price ) //
    class dvd constructor
            this.dvdName = name;
            this.productnumber = productnumber;
            this.numberofproducts = numberofproducts;
            this.price = price;
          public void setdvdName( String name ) // method to set dvd name
          this.dvdName = name; // store the dvd name
          public String getdvdName()// method to get dvd name
          return dvdName;
          public void setproductnumber( int productnumber )  // method to set productnumber
          this.productnumber = productnumber; // store productnumber
          public int getproductnumber()// method to get productnumber
          return productnumber;
          public void setnumberofproducts( int numberofproducts )// method to set
    numberofproducts
          this.numberofproducts = numberofproducts; // store numberofproducts
          public int getnumberofproducts()// method to get numberofproducts
          return numberofproducts;
          public void setprice( double price )// method to set price
          this.price = price; // price of the products in stock
          public double getprice()// method to get price
          return price;
          public double getvalueofdvds()// method to get valueofdvds
          return numberofproducts * price;
    } // end class DVD
    class DVD_Genre extends DVD
             private String genre; // genre of DVD
      private double restockingFee; // percentage added to inventory value
       //constructor
    public DVD_Genre(String name, String genre, int productnumber, int numberofproducts, double
    price)
       super(name, genre, productnumber, numberofproducts, price);
      this.genre = genre;
                    this.restockingFee = restockingFee;
          public void setdvdGenre( String genre ) // method to set dvd genre
          this.dvdGenre = genre; // store the dvd genre
          public String getdvdGenre()// method to get dvd genre
          return dvdGenre;     
    // Calculates restocking fee based on previous data.
        public double restockFee() {
         double total = 0;
         double restock = 0;
         total = numberofproducts * price;
         restock = total * .05;
                return restock;
        public String toString()
       DecimalFormat Currency = new DecimalFormat("$0.00");
       return "\nDVD Title: " +  dvdName + "\nDVD Genre: " +  dvdGenre + "\nProduct number: " +
    productnumber +
              "\nNumber of products: " + numberofproducts + "\nPrice: " + price + "\nValue of
    DVD's: " +  Currency.format(numberofproducts * price) + "\nRestock Fee: "  +
    Currency.format(numberofproducts * price * .05);
    }// End class DVD_Genre
    class GUI {
    private DVD[] dvds;
        private int nCount;
    private double total;
    // Creates array DVD[]
        GUI() {
            dvds = new DVD[5];
            nCount = 0;
        public void add(DVD dvd) {
            dvds[nCount] = dvd;
            ++nCount;
    public void setTotal(double total)
      this.total = total;
        DecimalFormat Currency = new DecimalFormat("$0.00");
    //Displays the arrays contents element by element into a GUI pane
           public void display() {
      GUIDisplay(dvds, 5);
    public void GUIDisplay(DVD[] products, int numOfProducts)
              PanelFrame frame = new PanelFrame(products, numOfProducts);
              frame.pack();
              frame.setVisible(true);
              frame.setSize(600, 450);
    } // end class GUI
            class PanelFrame extends JFrame
            private JButton first;
            private JButton next;
            private JButton previous;
            private JButton last;
            private JButton add;
            private JButton delete;
            private JButton modify;
            private JButton search;
            private JButton save;
            JTextField dvdName;
            JTextField productnumber;
            JTextField numberofproducts;
            JTextField price;
            private DVD[] products;
            private int numOfProducts;
            private int currentIndex = 0;
    /** Creates a new instance of PanelFrame */
      public PanelFrame(DVD[] products, int numOfProducts)
            super("Welcome to the DVD Inventory");
            this.products = products;
            this.numOfProducts = numOfProducts;
            setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            setLayout(new GridLayout(6,1,5,5));
            showLogo();
            showLabels();
            showInputFields();
            showButtons();
    public class MovieGraphics extends Component
            private BufferedImage image;
            private boolean imageFound = true;
      public MovieGraphics()
           super();
       try
           image = ImageIO.read(new File("logo.jpg"));
      catch (IOException x)
          x.printStackTrace();
          imageFound = false;
      public void paint(Graphics g)
      if (imageFound)
         g.drawImage(image,
         0, 0, 200, 100,
         0, 0, image.getWidth(null), image.getHeight(null),
    null);
      else
         g.drawString("Gary's DVD Krypt", 30, 30);
    } // end of class MovieGraphics
      public void showLogo()
            MovieGraphics myLogo = new MovieGraphics();
            this.add(myLogo);
      public void showLabels()
            JPanel panel = new JPanel();
            panel.add(new JLabel("DVD Title"));
            panel.add(new JLabel("Product number"));
            panel.add(new JLabel("Number of products"));
            panel.add(new JLabel("Price"));
            this.add(panel);
      public void showInputFields()
            JPanel panel = new JPanel();
            dvdName = new JTextField(10);
            productnumber = new JTextField(10);
            numberofproducts = new JTextField(10);
            price = new JTextField(10);
            dvdName.setEditable(false);
            productnumber .setEditable(false);
            numberofproducts.setEditable(false);
            price.setEditable(false);
            panel.add(dvdName);
            panel.add(productnumber );
            panel.add(numberofproducts);
            panel.add(price);
        this.add(panel);
      public void showButtons()
            JPanel panel = new JPanel();
            first = new JButton("First");
            next = new JButton("Next");
            previous = new JButton("Previous");
            last = new JButton("Last");
            add = new JButton("Add");
            delete = new JButton("Delete");
            modify = new JButton("Modify");
            search = new JButton("Search");
            save = new JButton("Save");
            panel.add(first);
            panel.add(next);
            panel.add(previous);
            panel.add(last);
            panel.add(add);
            panel.add(delete);
            panel.add(modify);
            panel.add(search);
            panel.add(save);
            ButtonActionHandler handler = new ButtonActionHandler();
              first.addActionListener(handler);
              next.addActionListener(handler);
              previous.addActionListener(handler);
              last.addActionListener(handler);
              add.addActionListener(handler);
              delete.addActionListener(handler);
              modify.addActionListener(handler);
              search.addActionListener(handler);
              save.addActionListener(handler);
              this.add(panel);
              setFields(0);
      protected void paintComponent(Graphics g)
      public void setFields(int i)
         setdvdName(i);
         setproductnumber(i);
         setnumberofproducts(i);
         setPrice(i);
      public void setdvdName(int i)
      dvdName.setText(products.getdvdName());
    public void setproductnumber(int i)
    productnumber.setText(String.valueOf(products[i].getproductnumber()));
    public void setnumberofproducts(int i)
    numberofproducts.setText(String.valueOf(products[i].getnumberofproducts()));
    public void setPrice(int i)
    price.setText(String.valueOf(products[i].getprice()));
    private class ButtonActionHandler implements ActionListener
    public void actionPerformed(ActionEvent event)
    if (event.getSource() == first)
    addClicked = false;
    currentIndex = 0;
    setFields(currentIndex);
    makeFieldsEditable(false);
    else if (event.getSource() == next)
    addClicked = false;
    currentIndex++;
    if (currentIndex == numOfProducts)
    currentIndex --;
    setFields(currentIndex);
    makeFieldsEditable(false);
    else if (event.getSource() == previous)
    addClicked = false;
    currentIndex--;
    if (currentIndex < 0)
    currentIndex = 0;
    setFields(currentIndex);
    makeFieldsEditable(false);
    else if (event.getSource() == last)
    addClicked = false;
    currentIndex = numOfProducts - 1;
    if (currentIndex < 0)
    currentIndex = 0;
    setFields(currentIndex);
    makeFieldsEditable(false);
    else if(event.getSource() ==add)
    //add actions for add here
    if (!addClicked)
    resetFields();
    makeFieldsEditable(true);
    int itemNum = incrementItemNumber();
    System.out.println(itemNum);
    itemNumber.setText(String.valueOf(itemNum));
    currentIndex = numOfProducts;
    addClicked = true;
    else if(event.getSource() ==save)
    //add actions for save here
    //we need to call SaveToFile.java
    // SaveToFile.save;
    addClicked = false;
    System.out.println(currentIndex);
    if (!updateProduct(currentIndex))
    JOptionPane.showMessageDialog(null, "You have reached maximum number of products!");
    currentIndex --;
    setFields(currentIndex);
    else
    saveProduct();
    makeFieldsEditable(false);
    else if(event.getSource() == edit)
    //add actions for edit here
    // Inventory.edit;
    addClicked = false;
    makeFieldsEditable(true);
    else if(event.getSource() == search)
    //add actions for search here
    // Inventory.findIndex;
    addClicked = false;
    String name = JOptionPane.showInputDialog("Enter Product Name: ");
    int index = searchName(name);
    System.out.println(index);
    if (index == -1)
    JOptionPane.showMessageDialog(null, "No matching product found! ");
    else
    currentIndex = index;
    setFields(index);
    Here are my errors:
    C:\java>javac DVDInventory6.java
    DVDInventory6.java:460: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    addClicked = false;
    ^
    DVDInventory6.java:463: cannot find symbol
    symbol : method makeFieldsEditable(boolean)
    location: class PanelFrame.ButtonActionHandler
    makeFieldsEditable(false);
    ^
    DVDInventory6.java:467: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    addClicked = false;
    ^
    DVDInventory6.java:474: cannot find symbol
    symbol : method makeFieldsEditable(boolean)
    location: class PanelFrame.ButtonActionHandler
    makeFieldsEditable(false);
    ^
    DVDInventory6.java:478: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    addClicked = false;
    ^
    DVDInventory6.java:485: cannot find symbol
    symbol : method makeFieldsEditable(boolean)
    location: class PanelFrame.ButtonActionHandler
    makeFieldsEditable(false);
    ^
    DVDInventory6.java:489: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    addClicked = false;
    ^
    DVDInventory6.java:496: cannot find symbol
    symbol : method makeFieldsEditable(boolean)
    location: class PanelFrame.ButtonActionHandler
    makeFieldsEditable(false);
    ^
    DVDInventory6.java:501: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    if (!addClicked)
    ^
    DVDInventory6.java:503: cannot find symbol
    symbol : method resetFields()
    location: class PanelFrame.ButtonActionHandler
    resetFields();
    ^
    DVDInventory6.java:504: cannot find symbol
    symbol : method makeFieldsEditable(boolean)
    location: class PanelFrame.ButtonActionHandler
    makeFieldsEditable(true);
    ^
    DVDInventory6.java:505: cannot find symbol
    symbol : method incrementItemNumber()
    location: class PanelFrame.ButtonActionHandler
    int itemNum = incrementItemNumber();
    ^
    DVDInventory6.java:507: cannot find symbol
    symbol : variable itemNumber
    location: class PanelFrame.ButtonActionHandler
    itemNumber.setText(String.valueOf(itemNum));
    ^
    DVDInventory6.java:510: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    addClicked = true;
    ^
    DVDInventory6.java:517: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    addClicked = false;
    ^
    DVDInventory6.java:519: cannot find symbol
    symbol : method updateProduct(int)
    location: class PanelFrame.ButtonActionHandler
    if (!updateProduct(currentIndex))
    ^
    DVDInventory6.java:527: cannot find symbol
    symbol : method saveProduct()
    location: class PanelFrame.ButtonActionHandler
    saveProduct();
    ^
    DVDInventory6.java:529: cannot find symbol
    symbol : method makeFieldsEditable(boolean)
    location: class PanelFrame.ButtonActionHandler
    makeFieldsEditable(false);
    ^
    DVDInventory6.java:531: cannot find symbol
    symbol : variable edit
    location: class PanelFrame.ButtonActionHandler
    else if(event.getSource() == edit)
    ^
    DVDInventory6.java:535: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    addClicked = false;
    ^
    DVDInventory6.java:536: cannot find symbol
    symbol : method makeFieldsEditable(boolean)
    location: class PanelFrame.ButtonActionHandler
    makeFieldsEditable(true);
    ^
    DVDInventory6.java:542: cannot find symbol
    symbol : variable addClicked
    location: class PanelFrame.ButtonActionHandler
    addClicked = false;
    ^
    DVDInventory6.java:544: cannot find symbol
    symbol : method searchName(java.lang.String)
    location: class PanelFrame.ButtonActionHandler
    int index = searchName(name);
    ^
    23 errors

    and many more errors
    such as;
    * you need to declare a method called makeFieldsEditable that takes a boolean value
    eg private void makeFieldsEditable(boolean editable){
       // add your implememntation
    }* you need to declare a method called resetFields
    eg private void resetFields(){
       // add your implememntation
    }* you need to declare a method called updateProduct
    eg private void updateProduct(int index){
       // add your implememntation
    }etc

  • Help with adding rows to JTable

    Could any body help me with the following problem:
    I have created form where I use JTable.Initially I should show 5 rows in JTable. User can enter data into the cells.And commit I should store the data in database.
    My problem is how to dynamically add rows to JTable as user is entering the data. And how to retain the data in the cells when it is entered.
    Right now when user edits a cell and tabs to next one the data in previous cell disappears.
    Its Urgent can anybody help me
    Thanks in advance
    Babu

    The number of rows, number of columns, etc, are all determined by the TableModel used in the JTable.
    What is the easiest solution is to subclass AbstractTableModel adding methods to support your dynamic row adding/deleting/etc that you need. If you go to the javadoc for JTable, there's a link to a tutorial which contains most of what you need to know.
    - David

Maybe you are looking for

  • What are the steps would liket take using AR,AP,GL Datasource in R/3

    Hi, When i would like to use SAP content data source Like ,AR,AP,GL data source what are all the master data need to activate for this. Ex: for AR we need to activate the Customer master data what abt AP,GL what are the master data need to be activat

  • Import error any suggestions?

    Hi, I have dump file which i got it from the client and need to import in our local server for testing purpose. when i start import i am hitting the following error: my oracle account is not having DBA privelege. any way out? Export file created by E

  • IPod touch not appearing in iTunes

    My ipod touch is not being recognised by itunes whenever i plug it into a usb port. I've tried retsarting computer& ipod, reinstalling itunes and it still won't recognise it! any ideas anyone?

  • VIDX Has taken over my browser. How do I get rid of it?

    Hello - I have been trying to get rid of this VidX virus that has seem to take over my browsers... Pop ups all the time - Re-directing me to SPAM pages.. its a mess!! The way I think I got it, was by downloading some "update" I thought I needed to ge

  • Galaxy S4 free after rebate and trade in? apparently not

    In February there were ads on TV and on Verizon website about Getting S4 free after rebate and trade in. Purchase online for $150 and get $50 rebate and automatically get $100 trade in value on smartphone in working order.(mine was)  I only got the $