Showing Image on applet
I have a question about showing an image in an Image class.
Actually, I'm preparing the program with JBuilder. I was going to show an image as follow,
logo = parent.getImage(parent.getCodeBase(), "http://10.1.100.120/png/DEV123_1_1.png");
if(logo!= null)
panelCCDImage.setImage(logo);
panelCCDImage.refresh();
where panelCCDImage is of class Image. Actually, the image can be display on IE if the URL is pasted on the address. And the image can also be shown when I debug the program under JBuilder. However, the image can't be displayed when I run the program in servlet/applet mode.
Would you please kindly help? Thanks!
Regards,
Devin
You're not supposed to supply the http:// part when using codebase.
Codebase would be the directory where your jar/class file is stored, so let's say you have your applet in directory "applet" and all the images are in "applet/images" you would use:
Image foo = getImage(getCodeBase(), "images/myimage.png");
Similar Messages
-
HELP My image doesn't show in IE (APPLET)
I'm trying to view a gif-file. It only shows in the Applet viewer of JBuilder7 and I can't make it work in IE. Can somebody help me? With the code below I can only see the buttons.
It consist of 2 classes
Class 1: VIEWER
package javaclient2;
import java.awt.Graphics.*;
import java.awt.image.*;
import java.awt.event.*;
import java.applet.*;
import java.net.*;
import java.awt.*;
import com.borland.jbcl.layout.*;
* <p>Title: JavaClient</p>
* <p>Description: JavaClient met Applet</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: Joto</p>
* @author Tom & Jochen
* @version 1.0
public class Viewer extends Applet {
private boolean isStandalone = false;
private Panel jPanel1 = new Panel();
private Button button1 = new Button();
private Button button2 = new Button();
private Button button3 = new Button();
private Button button4 = new Button();
private URL location;
//private Image image=null;
private MediaTracker tracker;
private String mapURL;
private ImagePanel imgPanel = new ImagePanel();
private BorderLayout borderLayout1 = new BorderLayout();
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
//Construct the applet
public Viewer() {
//Initialize the applet
public void init() {
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
imgPanel= new ImagePanel(mapURL);
this.add(imgPanel,BorderLayout.CENTER);
catch(Exception e)
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception {
this.setLayout(borderLayout1);
button1.setLabel("button1");
button2.setLabel("button2");
button3.setLabel("button3");
button4.setLabel("button4");
button4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
button4_actionPerformed(e);
this.add(jPanel1, BorderLayout.NORTH);
jPanel1.add(button4, null);
jPanel1.add(button3, null);
jPanel1.add(button2, null);
jPanel1.add(button1, null);
//Get Applet information
public String getAppletInfo() {
return "Applet Information";
//Get parameter info
public String[][] getParameterInfo() {
return null;
void button4_actionPerformed(ActionEvent e)
Class 2: IMAGEPANEL
package javaclient2;
import java.awt.*;
import java.net.*;
import com.borland.jbcl.util.*;
import java.awt.Graphics.*;
import java.awt.Image.*;
import java.awt.event.*;
* <p>Title: JavaClient</p>
* <p>Description: JavaClient voor GIS toepassingen</p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: Joto</p>
* @author Demets Tom & Vanhoe Jochen
* @version 1.0
public class ImagePanel extends Panel{
private URL location;
private Image image;
public ImagePanel(String mURL) {
System.out.println(mURL);
try
location=new URL(mURL);
catch(MalformedURLException e)
System.err.println("Invalid URL for image");
this.makeImage(location);
public void paint(Graphics g)
g.drawImage(image,0,0,this);
public ImagePanel() {
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
private void jbInit() throws Exception {
public void setURL(String mURL)
try
location=new URL(mURL);
catch(MalformedURLException e)
System.err.println("Invalid URL for image");
this.makeImage(location);
private void makeImage(URL location)
Toolkit toolkit = Toolkit.getDefaultToolkit();
image = toolkit.getImage(location);
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(image,0);
try
tracker.waitForID(0);
catch(InterruptedException e)
System.err.println("Invalid URL for image");
System.exit(1);
}Some further inspection of this forum has given me the impression that you have just added some duke dollars to it. If this is the case I shall offer to provide some working code if indeed my previous case is true.
Place this code within the ImagePanel file:Dimension d = new Dimension();
private void makeImage(URL location)
Toolkit toolkit = Toolkit.getDefaultToolkit();
image = toolkit.getImage(location);
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(image,0);
try
tracker.waitForID(0);
d.width = image.getWidth(this);
d.height = image.getHeight(this);
catch(InterruptedException e)
System.err.println("Invalid URL for image");
System.exit(1);
public Dimension getMinimumSize() {
return d;
public Dimension getPreferredSize() {
return d;
} -
Problem with display of images in applets
Hi all,
When I run this program, the appletviewer window is showing no output (i.e. no image). I'm using the netbeans IDE 5.0.
Blue hills.jpg is present in both the src folder and build folder.
* <applet code="image" width =800 height=600>
* <param name="img" value="Blue hills.jpg">
* <\applet>
import java.awt.*;
import java.applet.*;
public class image extends Applet {
Image img;
public void init() {
img=getImage(getDocumentBase(), getParameter("img"));
public void paint(Graphics g){
g.drawImage(img,0,0,this);
Please help in figuring out the problem....It will be looking for it in the folder with the HTML that invokes the applet.
If you want to pack the image in with the applet then use getResource instead.
And spaces in the name are probably not the best idea. -
Buttons doesnt show on the applet
I wrote a code which takes coordinates of buttons from another class and set it to buttons bounds and then add it to contentpane but the problem is buttons doesnt show on the applet.
Here is my code
any help would be usefull
package applet;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.ImageIcon;
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import images.*;
import hareket.*;
public class backgammon extends JApplet
public Icon puls_icon,bgicon,pulk_icon;
private Image pul_s,background,pul_k;
private JLabel bg;
private JButton[] butonlar;
private sari sariplayer;
private kahverengi kahveplayer;
private kareler board;
public void init()
getContentPane().setLayout(null);
this.setSize(744, 536);
butonlar = new JButton[31];
board = new kareler();
sariplayer = new sari(board);
kahveplayer = new kahverengi(board);
sariplayer.setkahverengi(kahveplayer);
kahveplayer.setsari(sariplayer);
kahveplayer.baslangic("kahverengi");
sariplayer.baslangic("sari");
pul_s = getImage(getCodeBase(),"images/pul_sari.gif");
pul_k = getImage(getCodeBase(),"images/pul_kahverengi.gif");
background = getImage(getCodeBase(),"images/background.jpg");
puls_icon = new ImageIcon(pul_s);
pulk_icon = new ImageIcon(pul_k);
bgicon = new ImageIcon(background);
bg=new JLabel(bgicon);
bg.setBounds(0,0,getWidth(),getHeight());
getContentPane().add(bg);
butoninitialize();
public void butoninitialize()
for (int i=1;i<31;i++)
if (i<16)
butonlar[i] = new JButton(pulk_icon);
butonlar.setBounds(kahveplayer.pullar_x[i],kahveplayer.pullar_y[i],42,42);
else
butonlar[i] = new JButton(puls_icon);
butonlar[i].setBounds(sariplayer.pullar_x[i],sariplayer.pullar_y[i],42,42);
butonlar[i].setContentAreaFilled(false);
butonlar[i].setBorderPainted(false);
this.getContentPane().add(butonlar[i]);
ThanksThe second method will not work unless you have JDK 1.5.
I simplified your code a bit to make it compilable.
This solution should work:
package applet;
import javax.swing.*;
import java.awt.*;
public class backgammon_1 extends JApplet {
public Icon puls_icon,bgicon,pulk_icon;
private Image pul_s,background,pul_k;
private JLabel bg;
private JButton[] butonlar;
public void init() {
getContentPane().setLayout(null);
this.setSize(744, 536);
butonlar = new JButton[31];
pul_s = getImage(getCodeBase(),"images/pul_sari.gif");
pul_k = getImage(getCodeBase(),"images/pul_kahverengi.gif");
background = getImage(getCodeBase(),"images/background.jpg");
puls_icon = new ImageIcon(pul_s);
pulk_icon = new ImageIcon(pul_k);
butoninitialize();
bgicon = new ImageIcon(background);
bg=new JLabel(bgicon);
bg.setBounds(0,0,getWidth(),getHeight());
getContentPane().add(bg);
public void butoninitialize() {
for (int i=0;i<butonlar.length;i++) {
if (i<16) {
butonlar[i] = new JButton(pulk_icon);
butonlar.setBounds(50*i,50,50,50);
} else {
butonlar[i] = new JButton(puls_icon);
butonlar[i].setBounds(50*(i-16),100,50,50);
butonlar[i].setContentAreaFilled(false);
butonlar[i].setBorderPainted(false);
this.getContentPane().add(butonlar[i]); -
Looking for Image Button Applet
I'm looking for a simple image button applet (normal state, mouse-over and mouse-click) which can refer to a HTML or start a Javascript function. Can anyone help?
KippieHi,
This is the source code. I don't quite understand what I should do with the tokens. I hope this is allright. Thanks for your help
Kippie.
import java.net.URL;
import java.awt.Color;
import java.util.Vector;
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.applet.Applet;
import java.applet.AudioClip;
Program Name: ImageURLButtonBar
Author: Paul Whitelock
Version: 1.1
Copyright: (c) 1997 by Paul Whitelock and Modern Minds, Inc.
Requires: ImageURLButtonBar.class
ButtonBar.class
ButtonBarObserver.class (Interface definition)
ButtonRegion.class
ButtonAnimate.class
Modifications: v1.01 (15 April 97)
* Added "sticky" button behavior (controlled
by applet "stick" parameter)
v1.03 (25 June 97)
* Added applet parameter "useCodeBase". If useCodeBase
is true, then image file locations will be based on the directory
in which the Java class files are located. If useCodeBase is false, then
the locations will be based on the HTML directory. Note that audio
file locations are always based on the Java directory. The default
for useCodeBase is false (use HTML directory for base).
* The "stick" parameter will now accept a button number in
addition to the value of "true" or "false". If a button number
is specified, then that button will be "stuck" down
when the button bar initializes.
* Added the capability of loading multiple URLs for each button
with an optional target for each URL.
v1.1 (25 September 97)
* Added "baseBrighten" and "baseBrightenTint" parameters to control
highlighting for base button bar.
* Added "mouseOverBrighten" and "moBrightenTint" parameters to control
highlighting for base button bar.
* Added "mdBrightenTint" and "mdBrightenAll" parameters to control
highlighting for base button bar. Previous versions of the applet
supported "mouseDownBrighten," but only if button borders were not
drawn for the button-down button bar (the "mdBrightenAll" can be set
to "true" to override the this default behavior).
* An "appletBGColor" parameter has been added to set the
applet background color. The applet background color is
sometimes visible during scrolling or during a page repaint.
NOTE: This source code was composed using Microsoft Visual J++
with tab stops of 4. Text may not be formatted correctly
if another editor is used.
******************************** PARAMETERS ********************************
Applet Parm ButtonBar Class Parm Default Value
================== ======================= ==================
appletBGColor
disableBadURL true
mouseEnterAudio null (audio disabled)
mouseClickAudio null (audio disabled)
buttonDownAudio null (audio disabled)
stick false
* useCodeBase base false (i.e., use getDocumentBase())
orient barHorizontal horizontal if applet width > height
base baseBarName none - parameter REQUIRED
mouseOver mouseOverBarName null
mouseOver2 mouseOverBar2Name null
mouseDown mouseDownBarName null
mouseDownOver mouseDownOverBarName null
buttonsDisabled buttonsDisabledBarName null
background backgroundImageName null
barXPos barXBackgroundPos 0
barYPos barYBackgroundPos 0
buttonBorders drawButtonBorders ButtonBar.BORDERS_NONE
borderColorTL borderColorTopLeft null (Color.white if error)
borderColorBR borderColorBottomRight null (Color.gray if error)
borderIntensity borderIntensityPercent 50 (used only if borders)
borderSize buttonBorderSize 1 (used only if borders)
downShift downShift false
downShiftAmt downShiftAmt buttonBorderSize
baseBrighten baseBrightenPct
baseBrightenTint baseBrightenTint
mouseOverBrighten mouseOverBrightenPct
moBrightenTint mouseOverBrightenTint
mouseDownBrighten mouseDownBrightenPct
mdBrightenTint mouseDownBrightenTint
mdBrightenAll mouseDownBrightenAll
buttonsDisabledDim buttonsDisabledDimPct 25 (used only if no buttonsDisabled)
grayBarBrighten grayBarBrighten 0
frameRate frameRate 150 (used only if mouseOver2)
* If useCodeBase is true, then all file locations are based on the Java class file
directory (i.e., use getCodeBase()).
public class ImageURLButtonBar extends Applet implements ButtonBarObserver {
// Instance Variables
ButtonBar buttonBar;
Vector buttonURL = new Vector(10, 10);
Vector buttonURLTarget = new Vector(10, 10);
Vector buttonDescription = new Vector(10, 10);
AudioClip mouseEnterAudio = null;
AudioClip mouseClickAudio = null;
AudioClip buttonDownAudio = null;
// Applet Initialization
public void init() {
// =================================================================
// Applet ImageURLButtonBar specific parameters
// =================================================================
// appletBGColor
// Set applet background color
String parm = getParameter("appletBGColor");
if (parm != null) {
try {
setBackground(new Color(Integer.parseInt(parm, 16)));
catch (Exception e) {
reportError("appletBGColor");
// disableBadURL
// If true, then any button with an invalid URL will be disabled
parm = getParameter("disableBadURL");
boolean disableBadURL;
if (parm == null || !parm.equals("false")) disableBadURL = true;
else disableBadURL = false;
// mouseEnterAudio
// Sound to play each time the mouse enters any of the buttons
parm = getParameter("mouseEnterAudio");
if (parm != null) {
mouseEnterAudio = getAudioClip(getCodeBase(), parm);
if (mouseEnterAudio == null) reportError("Can't load " + parm);
// mouseClickAudio
// Sound to play each time a mouse down click occurs in a button
parm = getParameter("mouseClickAudio");
if (parm != null) {
mouseClickAudio = getAudioClip(getCodeBase(), parm);
if (mouseClickAudio == null) reportError("Can't load " + parm);
// buttonDownAudio
// Sound to play each time a mouse up occurs in a button (i.e, the
// button has be toggled through it's "down" position)
parm = getParameter("buttonDownAudio");
if (parm != null) {
buttonDownAudio = getAudioClip(getCodeBase(), parm);
if (buttonDownAudio == null) reportError("Can't load " + parm);
// stickyBar
// If the "stick" applet parameter is "true", then buttons will stay
// "stuck" in the down position until another button is clicked.
// If the "stick" applet parameter is the number of a button in the
// button bar, then that button will be "stuck" down when the
// button bar initializes.
int stickyBar = -1;
parm = getParameter("stick");
if (parm != null && !parm.toLowerCase().equals("false")) {
try {
stickyBar = Integer.parseInt(parm);
catch (Exception e) {
stickyBar = 0;
// =================================================================
// Class ButtonBar specific parameters
// =================================================================
// orient (barHorizontal)
// If this parameter = 'h' then the button bar is horizontal
// If this parameter = 'v' then the button bar is vertical
// If this parameter is not specified, then the button bar is
// horizontal if the applet width is greater than the applet height
boolean horizontal;
parm = getParameter("orient");
if (parm == null) horizontal = size().width > size().height;
else horizontal = parm.equals("h") ? true : false;
// base (baseBarName)
// The base image file for the buttons. This is the only image
// file that MUST be specified.
String baseBar = getParameter("base");
if (baseBar == null) {
reportError("Parameter 'base' REQUIRED!");
return;
// barXPos (barXBackgroundPos)
// barYPos (barYBackgroundPos)
// If a background image is specified then these to parameters
// represent the top-left corner location where the button bar
// should be placed on the background
int barXPos = 0, barYPos = 0;
try {
parm = getParameter("barXPos");
if (parm != null) barXPos = Integer.parseInt(parm);
parm = getParameter("barYPos");
if (parm != null) barYPos = Integer.parseInt(parm);
catch (Exception e) {
reportError("barXPos or barYPos");
barXPos = barYPos = 0;
// buttonBorders (drawButtonBorders)
// "none" = do not draw any button borders
// "all" = draw borders around all button bar buttons
// "base" = draw borders only around buttons on base button bar
// "other" = draw borders around all button bar buttons EXCEPT base button bar buttons
parm = getParameter("buttonBorders");
int drawButtonBorders = ButtonBar.BORDERS_NONE;
if (parm != null) {
if (parm.equals("base")) drawButtonBorders = ButtonBar.BORDERS_BASE;
else if (parm.equals("other")) drawButtonBorders = ButtonBar.BORDERS_OTHER;
else if (parm.equals("all")) drawButtonBorders = ButtonBar.BORDERS_ALL;
// borderColorTL (borderColorTopLeft)
// borderColorBR (borderColorBottomRight)
// Normally, borders are drawn around buttons by lightening or darkening
// the image in the border region. A specific color can be used instead
// for the top and left borders and/or the bottom and right borders. The
// value specified for either of these two parameters should be a hexadecimal
// number (e.g., "FF0000" for red, "888888" for medium gray, etc.).
Color borderColorTopLeft = null;
Color borderColorBottomRight = null;
try {
parm = getParameter("borderColorTL");
if (parm != null) borderColorTopLeft = new Color(Integer.parseInt(parm, 16));
parm = getParameter("borderColorBR");
if (parm != null) borderColorBottomRight = new Color(Integer.parseInt(parm, 16));
catch (Exception e) {
reportError("borderColorTL or borderColorBR");
borderColorTopLeft = Color.white;
borderColorBottomRight = Color.gray;
// borderIntensity (borderIntensityPercent)
// If borders are drawn for buttons, and if a border color is not specified
// (see above), then the image in the border region will be lightened or
// darkened by this percentage to create the borders.
int borderIntensityPercent = 50;
try {
parm = getParameter("borderIntensity");
if (parm != null) borderIntensityPercent = Integer.parseInt(parm);
catch (Exception e) {
reportError("borderIntensity");
borderIntensityPercent = 50;
// borderSize (buttonBorderSize)
// The size of borders, if borders are specified.
int buttonBorderSize = 1;
try {
parm = getParameter("borderSize");
if (parm != null) buttonBorderSize = Integer.parseInt(parm);
catch (Exception e) {
reportError("borderSize");
// downShift
// If true, then the button image is shift down and right downShiftAmt
// (see below) pixels when the mouse is clicked on the button.
parm = getParameter("downShift");
boolean downShift = (parm == null || !parm.equals("true")) ? false : true;
// downShiftAmt
// If downShift is true, then the button image is shift down and right
// downShiftAmt (see above) pixels when the mouse is clicked on the button.
int downShiftAmt = buttonBorderSize;
try {
parm = getParameter("downShiftAmt");
if (parm != null) downShiftAmt = Integer.parseInt(parm);
catch (Exception e) {
reportError("downShiftAmt");
// baseBrighten (baseBrightenPct)
// The base bar will be lightened by this percentage
int baseBrightenPct = 0;
try {
parm = getParameter("baseBrighten");
if (parm != null) baseBrightenPct = Integer.parseInt(parm);
catch (Exception e) {
reportError("baseBrighten");
// mouseOverBrighten (mouseOverBrightenPct)
// A button will be lightened by this percentage when the mouse
// moves over a button.
int mouseOverBrightenPct = 0;
try {
parm = getParameter("mouseOverBrighten");
if (parm != null) mouseOverBrightenPct = Integer.parseInt(parm);
catch (Exception e) {
reportError("mouseOverBrighten");
// mdBrightenAll (mouseDownBrightenAll)
// A button will be lightened by this percentage when the mouse
// moves over a button.
boolean mouseDownBrightenAll = false;
parm = getParameter("mdBrightenAll");
if (parm != null && parm.charAt(0) == 't') mouseDownBrightenAll = true;
// mouseDownBrighten (mouseDownBrightenPct)
// A button will be lightened by this percentage when it is
// clicked.
int mouseDownBrightenPct = 0;
try {
parm = getParameter("mouseDownBrighten");
if (parm != null) mouseDownBrightenPct = Integer.parseInt(parm);
catch (Exception e) {
reportError("mouseDownBrighten");
// baseBrightenTint (mouseOverBrightenTint)
// moBrightenTint (mouseOverBrightenTint)
// mdBrightenTint (mouseDownBrightenTint)
Color baseBrightenTint = null;
Color mouseOverBrightenTint = null;
Color mouseDownBrightenTint = null;
try {
parm = getParameter("baseBrightenTint");
if (parm != null) baseBrightenTint = new Color(Integer.parseInt(parm, 16));
parm = getParameter("moBrightenTint");
if (parm != null) mouseOverBrightenTint = new Color(Integer.parseInt(parm, 16));
parm = getParameter("mdBrightenTint");
if (parm != null) mouseDownBrightenTint = new Color(Integer.parseInt(parm, 16));
catch (Exception e) {
reportError("baseBrightenTint, moBrightenTint or mdBrightenTint");
// buttonsDisabledDim (buttonsDisabledDimPct)
// If a button is disabled and if there is no buttonsDisabled image,
// then the button will be dimmed by this percentage.
int buttonsDisabledDimPct = 25;
try {
parm = getParameter("buttonsDisabledDim");
if (parm != null) buttonsDisabledDimPct = Integer.parseInt(parm);
catch (Exception e) {
reportError("buttonsDisabledDim");
// grayBarBrighten
// If there is no mouseOver image, then the base image will be used for
// the mouseOver image, and a grayscale version of the base image will
// be used for base button images. This parameter can be used to lighten
// COLORS (not grays) in the image before it is converted to grayscale.
// This can help if the standard conversion produces buttons that are
// too dark.
int grayBarBrighten = 0;
try {
parm = getParameter("grayBarBrighten");
if (parm != null) grayBarBrighten = Integer.parseInt(parm);
catch (Exception e) {
reportError("grayBarBrighten");
// frameRate
// If a mouseOver2 image is specified, then this parameter controls
// how quickly animation will be performed (using mouseOver and mouseOver2
// images) in milliseconds when the mouse is moved over a button.
int frameRate = 150;
try {
parm = getParameter("frameRate");
if (parm != null) frameRate = Integer.parseInt(parm);
catch (Exception e) {
reportError("frameRate");
// =================================================================
// Instantiate the button bar
// =================================================================
try {
// Allow the use of documentBase (default) or codeBase for image file
// base directory.
URL documentBase;
parm = getParameter("useCodeBase");
if (parm == null || parm.equals("false")) documentBase = getDocumentBase();
else documentBase = getCodeBase();
// Create the button bar
buttonBar = new ButtonBar(
horizontal, /* barHorizontal */
documentBase, /* base */
baseBar, /* baseBarName */
getParameter("mouseOver"), /* mouseOverBarName */
getParameter("mouseOver2"), /* mouseOverBar2Name */
getParameter("mouseDown"), /* mouseDownBarName */
getParameter("mouseDownOver"), /* mouseDownOverBarName */
getParameter("buttonsDisabled"),/* buttonsDisabledBarName */
getParameter("background"), /* backgroundImageName */
barXPos, /* barXBackgroundPos */
barYPos, /* barYBackgroundPos */
drawButtonBorders, /* drawButtonBorders */
borderColorTopLeft, /* borderColorTopLeft */
borderColorBottomRight, /* borderColorBottomRight */
borderIntensityPercent, /* borderIntensityPercent */
buttonBorderSize, /* buttonBorderSize */
downShift, /* downShift */
downShiftAmt, /* downShiftAmt */
baseBrightenPct, /* baseBrightenPct */
baseBrightenTint, /* baseBrightenTint */
mouseOverBrightenPct, /* mouseOverBrightenPct */
mouseOverBrightenTint, /* mouseOverBrightenTint */
mouseDownBrightenAll, /* mouseDownBrightenAll */
mouseDownBrightenPct, /* mouseDownBrightenPct */
mouseDownBrightenTint, /* mouseDownBrightenTint */
buttonsDisabledDimPct, /* buttonsDisabledDimPct */
grayBarBrighten, /* grayBarBrighten */
frameRate /* frameRate */
// =================================================================
// Add buttons to the button bar
// =================================================================
ButtonRegion buttonToAdd;
String buttonNbr, urlString;
URL urlForButton;
int nbr = 0;
int buttonStart, buttonSize;
// Initialize button on bar flag (used to determine if at least one button
// was successfully added to the button bar)
boolean buttonOnBar = false;
// This loop will be exited when no more buttons can be found in the HTML
while (true) {
// Construct the prefix for the button parameters
buttonNbr = "button" + ++nbr;
// Find the starting offset and the size of the button
// If null is returned as the starting offset parameter value for the
// button, then all buttons should have been read so the loop can
// be exited.
try {
parm = getParameter(buttonNbr + "Start");
if (parm == null) break;
buttonStart = Integer.parseInt(parm);
buttonSize = Integer.parseInt(getParameter(buttonNbr + "Size"));
catch (Exception e) {
reportError("Button" + nbr + " start or size in error or missing");
buttonStart = 0;
buttonSize = 0;
// Create a ButtonRegion for the button
// The button ID will be set to the number of the button (this will
// be converted to an integer later when a buttonBarEvent is received).
buttonToAdd = new ButtonRegion("" + nbr, buttonStart, buttonSize);
// If the buttons on this button bar are "sticky" buttons, then
// enable "sticky" behavior for this button. The button will always
// "pop-up" whenever another button is clicked.
if (stickyBar >= 0) {
buttonToAdd.stickyButton(true, ButtonRegion.POPUP_ALWAYS, false);
// If the current button number matches the value of stickyBar, then the
// current button should be "stuck" down for its initial state.
if (stickyBar == nbr) buttonToAdd.setStuck(true);
// Try to add the button (i.e., the ButtonRegion) to the buttonBar
if (buttonBar.addButton(buttonToAdd)) {
// Set flag to indicate that at least one button has been added
buttonOnBar = true;
// The button was successfully added, so save the button's description
// (which will be displayed in the status bar) and the target frame
// for the button URL in the appropriate Vector.
buttonDescription.addElement(getParameter(buttonNbr + "Desc"));
buttonURLTarget.addElement(getParameter(buttonNbr + "Target"));
// Try to create a URL for the button.
// If the URL is invalid, then place an error message in the
// buttonURLTarget Vector (this will be used to warn the user
// when the button is clicked). Also, if disableBadURL is true, then
// disable the button.
String theURL;
urlString = getParameter(buttonNbr + "URL");
if (urlString != null) {
Enumeration urls = new StringTokenizer(urlString);
while (urls.hasMoreElements()) {
theURL = (String)urls.nextElement();
try {
urlForButton = new URL(theURL);
catch (Exception e) {
try {
urlForButton = new URL(getDocumentBase(), theURL);
catch (Exception e2) {
reportError("Button" + nbr + " has invalid URL");
buttonURLTarget.setElementAt("Invalid URL", nbr - 1);
urlString = null;
break;
else {
reportError("Button" + nbr + " has no URL");
buttonURLTarget.setElementAt("No URL", nbr - 1);
buttonURL.addElement(urlString);
// Remove any unused elements in the Vectors
buttonURL.trimToSize();
buttonURLTarget.trimToSize();
buttonDescription.trimToSize();
// If no buttons were added, throw exception
if (!buttonOnBar) throw new IllegalArgumentException("No buttons on bar");
// Let the buttonBar know that all buttons have been defined. This is
// really only necessary if downShift is true, but it won't hurt calling
// the method in either case.
buttonBar.allButtonsDefined();
// Add the applet as an observer so that the applet will be notified
// when button events occur.
buttonBar.addButtonObserver(this);
// Enable the button bar now that all buttons have been defined.
// (the buttonBar is disabled when it is created and must be
// specifically enabled).
buttonBar.enable(true);
// Add the buttonBar to the applet
setLayout(null);
add(buttonBar);
catch (Exception e) {
reportError("Can't create ButtonBar\n" + e);
// buttonBarEvent
// This method is called by the ButtonBar whenever a button event occurs
// It provides the ButtonBar that the event occurred for, the button ID
// that the event occurred for, and the event type.
public void buttonBarEvent(ButtonBar barID, String buttonID, int buttonEvent) {
String description;
// The buttonBar will send an IMAGES_READY event when all button bar images
// have been prepared. We are not interested in this event, but only in
// certain "action" events that occur for a button.
if (buttonEvent != ButtonBar.IMAGES_READY) {
// A number in String format was assigned as the buttonID when each
// ButtonRegion was created. The buttonID String will now be converted
// back into a number that can be used as a Vector index to retrieve
// button specific information (i.e., URL, target frame, and description).
int buttonNbr = Integer.parseInt(buttonID) - 1;
switch (buttonEvent) {
// If a mouseDown event has occurred for the button, and if an
// AudioClip is available for this event, play the AudioClip.
case ButtonBar.MOUSE_CLICK:
if (mouseClickAudio != null) mouseClickAudio.play();
break;
// If the mouse has been moved over a button, display the button's
// description in the browser's status area. If the button that the mouse
// is over is an active button, and if there is an AudioClip available
// for this event, then play the audio clip.
case ButtonBar.MOUSE_ENTER:
case ButtonBar.MOUSE_ENTER_DISABLED:
description = (String)buttonDescription.elementAt(buttonNbr);
if (description != null) showStatus(description);
if (mouseEnterAudio != null && buttonEvent == ButtonBar.MOUSE_ENTER) {
mouseEnterAudio.play();
break;
// If the mouse has been moved off of a button and if the button has
// description text associated with it, then clear the browser's
// browser's status area.
case ButtonBar.MOUSE_EXIT:
case ButtonBar.MOUSE_EXIT_DISABLED:
description = (String)buttonDescription.elementAt(buttonNbr);
if (description != null) showStatus("");
break;
// If the button has been depressed (i.e., a mouseDown followed by
// a mouseUp for the same button) then load the URL(s) for the button
// in the target frame(s), if specified. If the URL is null, then the
// URL was found to be missing or invalid, so display the text stored in
// the buttonURLTarget Vector in the brower's status area. If there is
// an AudioClip for the event, play the audio.
case ButtonBar.BUTTON_DOWN:
// Get the string of URLs and Targets for the button
String urlString = (String)buttonURL.elementAt(buttonNbr);
String targetString = (String)buttonURLTarget.elementAt(buttonNbr);
// If there is at least one URL for the button
if (urlString != null) {
URL urlForButton;
String theURL;
String theTarget;
Enumeration urls = new StringTokenizer(urlString);
Enumeration targets = null;
if (targetString != null) targets = new StringTokenizer(targetString);
// While there is another URL for the button
while (urls.hasMoreElements()) {
// Get the next String token that represents a URL
theURL = (String)urls.nextElement();
// Convert the String to a URL
try {
urlForButton = new URL(theURL);
catch (Exception e) {
try {
urlForButton = new URL(getDocumentBase(), theURL);
catch (Exception e2) {
urlForButton = null;
break;
// If the String was successfully convert to a URL
if (urlForButton != null) {
// If there is a target for this URL
if (targets != null && targets.hasMoreElements()) {
// Get the String that represents the target
theTarget = (String)targets.nextElement();
// If the target String does NOT begin with a "-",
// then load the URL in the target
if (theTarget.charAt(0) != '-') {
getAppletContext().showDocument(urlForButton, theTarget);
// Else a target for this URL should not be used
else {
getAppletContext().showDocument(urlForButton);
// Else there is no target for this URL, so just show
// the URL.
else {
getAppletContext().showDocument(urlForButton);
// Else URL is missing or invalid
else showStatus((String)buttonURLTarget.elementAt(buttonNbr));
if (buttonDownAudio != null) buttonDownAudio.play();
break;
// Error reporting
private void reportError(String message) {
message = "[ImageURLButtonBar] Error - " + message;
System.out.println(message);
showStatus(message);
} -
Pop up a window to show images
Hi, I am trying to show images when the user rolls the mouse
over the image but I want to show them as a pop up window only when
the user is on the image.
Any ideas how can I handle this? I will have variety of
images and want the same behavior for all of them.mouseOver and mouseOut event functions for the images.
-
My mac will not show images when on the internet?
My mac will not show images when on the internet? I think I have inadvertently changed some settings but nor sure which one.
I am going to assume you are using Safari here. If so then go to the Apple menu bar and hit Safari-> Preferences. Under the Apperance tab there is a check box that is called "Display images when the page opens". Check if that is unticked.
-
How can i show images from different folders in image gallery
Hi All,
i have downloaded and executed photo viewer image gallery application.
in that we r showing images sequentially what we have defined in xml file.
but i want show images randomly or i want show images from different gallary.
Can any one help me.
thanks
Raghu.WaqarLFC7 wrote:
On Windows:
Ctrl + click on the songs you want to group - then right click and click get info and it will ask you if you want to get info for multiple items click YES then under album name it whatever you want and them songs will be grouped into 1 album.
Mac:
Same procedure but hit SHIFT instead of CTRL.
Actually, it's right click or ctrl click, same as windows. -
My iphone 4 only shows image to connect to itunes. It will not come up in itunes and does not appear to be connecting to my computer. I have attempted to restart my phone numerous times but it just keeps going back to this same screen. Please help.
Did you make a backup because you can't recover what's on our phone. Follow these steps to resotre your phone (the phone has to be plugged into your computer):
1) On your phone, press your sleep button for 2 seconds
2) After the two seconds, don't release the sleep and press the home button for 10 seconds
3) Release the sleep button and keep the home buttton pressed untill your computer detects your phone.
4) A window should pop up and you should have the restore button. Press it. -
CRS 10.1 with Endeca 3.1.1 -home page doesn't show image and promo products
Thanks to this forum and especially cmore I'm close to setting up my local dev environment, but still have something to resolve.
I have ATG 10.1.2 + CRS + Endeca 3.1.1. I installed BCC with Staging and Production (switchable) stores.
The problem is with Production CRS - both US Store and Home Store don't show image and promoted products on Home page.
What I see below Top Category pane is empty square. Unlike Production, home page on Stage works fine - I see homepage_promo_storeSiteUS_en_anonymous.png and promoted products.
I think the problem is not related to Endeca, as I currently connect both Stage and Prod to the same Endeca CRS, I also believe that issue is not related to configuration - I tried to run production with Stage configuration, and it changed nothing. I believe the issue is somewhere in data (DB) - but I did full deployment for Prod and it didn't help. I verified targeters and slots on Prod through ACC, and they looks fine. So don't know at this point what to do next.
While doing full deploy I see some errors in the log which might be related to the issue, But the same errors I see on Stage as well and still Stage works without issues:
10:17:41,805 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/HomeTheme in scope global. It is defined in scope request
10:17:41,811 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/PromotedProduct1 in scope global. It is defined in scope request
10:17:41,816 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/PromotedProduct2 in scope global. It is defined in scope request
10:17:41,819 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/PromotedProduct3 in scope global. It is defined in scope request
10:17:41,822 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/FeaturedProduct2 in scope global. It is defined in scope request
10:17:41,826 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/FeaturedProduct3 in scope global. It is defined in scope request
10:17:41,829 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/FeaturedProduct4 in scope global. It is defined in scope request
10:17:41,832 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/FeaturedProduct5 in scope global. It is defined in scope request
10:17:41,836 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/FeaturedProduct1 in scope global. It is defined in scope request
10:17:41,839 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/CategoryPromotionContent2 in scope global. It is defined in scope request
10:17:41,842 ERROR [nucleusNamespace.] Invalid attempt to resolve component /atg/registry/Slots/CategoryPromotionContent1 in scope global. It is defined in scope request
Last update: I compared Stage and Prod home pages HTML code, and notice that the first difference between two pages is absence of endeca-slot Div, the below code present on Stage, and is Not present on Prod:
It is the first difference only , there are a bunch more.
<div class="endeca-slot" zone="/content/Shared/Global Search Configuration/Search Box">
<script type="text/javascript">
if(Endeca.Site) {
Endeca.Site.Audit.contents["/content/Shared/Global Search Configuration/Search Box"] = [{"@type":"SearchBox","endeca.internal.created.by":"admin","rule.msg":"Fired","endeca.internal.last.modified.by":"admin","rule.msgcode":"13","rule.state":"fired","endeca.internal.resource.path":"\/sites-live\/NYCoCRS\/content\/Shared\/Global Search Configuration\/Search Box\/Search Box","endeca.internal.workflow.state":"ACTIVE","type":"DGraph.MerchDebug","Title":"Search Box","rule.id":"1","endeca.internal.last.modified":"2013-03-20T11:43","endeca.internal.date.created":"2013-03-20T11:43","Zone":"\/content\/Shared\/Global Search Configuration\/Search Box"}
</script>
Edited by: PKU on Apr 1, 2013 8:32 AM
Edited by: PKU on Apr 1, 2013 8:35 AMAfter some analysis and experiments:
Most likely the issue is with Scenarios. HomeTheme Slot is populated by Theme scenario.
For some reason the slot remains empty on "bad" environment. On "good" environment the slot contain promo content item after the first call of the slot. I checked respective targeter and promo content item, and they look OK, so I believe something wrong with Scenarios. -
How to show image in oracle adf if i have data in byte[] ?
For first time I am using <af:inputFile> to get file of image type from any location on my system and convert the data in "byte[]" and store it in database...
When i visit page again i need to show uploaded file which is coming to me "byte[ ] ".
To show image i am using <af:image> component.
Help will be appreciated.Check this blog post: http://tompeez.wordpress.com/2011/12/16/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-3/
Dario -
How to move multiple images in applet
Hi,how to move multiple images in applet or random images in applet .
Means moving images.gif around the applet with different starting point ,help me to create that move method ..why don't you check the tumbling duke applet as provided free in this site? :-)
-
How to show image in a Transperent form ?? screen shots attached
Hi
Help me in making Images appearing as Transperent . Screen shots attached
I am having a TextInput and a Search Button (The Functionality is that user can enter something in this TextInput and makes a Search Operation by pressing Search Button .)
At the Initail screen display i need to show Some Image in transperent Inside this TextInput , when Mouse is focused on this TextInput , the Image will be completely Invisible .
Now the question i want to ask is , how to show image in a Transperent form ??
Please find the screen shots attached with this Thread .Thanks for specifying the alpha property of an Image .
-
Apache: showing images in ascending order by name
hi:
i have several detail pages where i show images contained in
a folder:
$folder = dir($path);
while ($folderEntry = $folder->read()){
if ($folderEntry <> "." && $folderEntry
<> ".." &&
substr($folderEntry, -6, 2) <> "00") {
echo '<li><img src="'.$path.$folderEntry.'"
/></li>';
$folder->close();
in the local server they appear in the way i want, in
ascending order by
name (img_01.jpg, img_02.jpg, img_03.jpg, ...) but in the
remote server
they appear in, apparently, random order
i activated FancyIndexing in the httpd.conf file but it
doesn't solved
the problem:
# Directives controlling the display of server-generated
directory
listings.
# FancyIndexing is whether you want fancy directory indexing
or
standard
IndexOptions FancyIndexing
# End of indexing directives.
i know i can store the filenames names in an array an sort it
but i
prefer to control it in the server
local (OS X 10.4.10)
Apache/1.3.33 (Darwin) PHP/5.1.6
remote (Red Hat Linux 2.6.9-34.ELsmp)
Apache/2.0.52
tia,
jdoeTempleton's suggestion is best if needing help with Microsoft Entourage. Since I know the answer is "not possible" I can at least steer you toward an AppleScript that will give you a workaround. Have a look here <http://www.barryw.net/weblog/files/category-5.html>.
Further questions about this script should be directed either to its author or to Microsoft's Entourage newsgroup <http://groups.google.com/group/microsoft.public.mac.office.entourage>.
Hope this helps! bill
1 GHz Powerbook G4 Mac OS X (10.4.9) -
hi every body.
I want to display images in an applet when i invoke it from the jsp page . it is not working. the code is as follows.
<html>
<body>
<jsp:plugin type = "applet"
code ="Welcome.class"
width="475" height = "350" >
</jsp:plugin>
</body>
</html>
while the code of "Welcome.java" is as follows.
ImageIcon image = new ImageIcon("aa.gif");
JButton button = new JButton(image);
i have placed the aa.gif file in the same directory where i placed the Welcome.class and the jsp file.
when i run this program the i recieve the message that the applet is not loaded.
can some body help me how to place images in applets.
thanks.You should be able to test that applet on you hard drive first. If it works check the case of the image file.
Web servers look for case. If you are asking for ImageIcon img = new ImageIcon("abc.gif") and what is loaded on your web server is "abc.GIF" it won't find it. Same goes for basic HTML tags like
<Img src=abc.gif>. But it will find it on you hard drive when you run the applet there.
Maybe you are looking for
-
How to see the items attached to a bom in sales order
hi, i have created a sales order with a BOM. i mainitained the few materials in CS01. but i dont see the items attached to that bom ... how can i see them in the sales order? ( order type OR and item category - tac) rewards for sure thanks
-
Need help setting up airport express as bridge (Any help is appreciated)
Hello so before my wifi was switched I was able to use my 802.11g airport express as a wifi card for the xbox 360. I then decided to upgrade my main base station from an 802.11g base station to and airport extreme 802.11n. My problem is that my airpo
-
Why are my bills much much higher then I was told ?
On Dec 8th 2011 I was on line with Verizon and ordered a triple play for $54.99 which included Internet phone and DirectTV with 210 channels and DVR all for $54.99 And they said that my forst bill would be $115.48 and ther after it will be $73.99 s
-
How do i stop ads coming up every time i click on website links?
Everytime im in Safari some particular works are hyperlinked to ads, or ads come up on whatever website I'm on. It also happens when i click a link on any website. Just wondering if its something i can fix myself or need to take my Macbook to someone
-
MPEG2 playback on PC version of QuickTime
Whenever I try and play back ANY Mpeg2 file the first (approx) 5 seconds of playback is real bad with dropped frames jittering, then everything plays just fine. However if you pause the MPG2 and then resume it does exactly the same. This makes the co