Impossible to save an image in applet?
I have been working on saving an image in Java applet for a week. But I failed to generate new image file on the disk. I'm using Java SDK1.4.0_03 and JAI 1_1_1_01. I found a topic "JAI TIFF Encoding Problem" mentioned that it should give permission to the Applet. I'm wondering if my problem is caused by the permission of Applet. But how to change the permissio of Applet? Otherwise is it impossible to save the image in Applet? Thanks your replay.
Re : Thanks your replay.
I have been working on saving an image in Java applet
for a week. But I failed to generate new image file on
the disk. I'm using Java SDK1.4.0_03 and JAI 1_1_1_01.
I found a topic "JAI TIFF Encoding Problem" mentioned
that it should give permission to the Applet. I'm
wondering if my problem is caused by the permission of
Applet. But how to change the permissio of Applet?
Otherwise is it impossible to save the image in
Applet? Thanks your replay. You're welcome :)
Similar Messages
-
i used the following code to save a image it displays from applet.it works fine in appletviewer
BufferedImage expImage = new BufferedImage( (int)this.getWidth(), (int)this.getHeight(), BufferedImage.TYPE_INT_RGB );
Graphics g2d = expImage.getGraphics();
// draftGrid.update(g2d);
this.update(g2d);
g2d.dispose();
OutputStream out = new FileOutputStream( "guru.jpg");
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(expImage);
out.flush();
out.close();
expImage.flush();
but when i run it in html through my web server the image does' get saved and it the exception i go is
Status code:404 request:R( j
ava/awt/image/BufferedImage.class + null) msg:null
what should i go to save a image from applet throgh browserHello,
This is what I am doing through a servlet call.
If you are just going to let the user download the image you could try the following:
// This works if we are just going to download the image as is
URL url = new URL(request.getParameter("imageURL"));
response.setContentType("image/gif");
response.setHeader("Content-Disposition", "attachment; "+
"filename=\"image.gif\"");
byte buf[] = new byte[1024];
InputStream inputStream = url.openStream();
ServletOutputStream out = response.getOutputStream();
//Read and Write
while(inputStream.read(buf) != -1)
out.write(buf);
out.flush();
out.close();
Or if you are going to manipulate the image a bit before they download it you could try the following:
URL url = new URL(request.getParameter("imageURL"));
response.setContentType("image/gif");
response.setHeader("Content-Disposition", "attachment; "+
"filename=\"image.gif\"");
// use ImageIcon because we are getting the image from a
// URL which might be slow - it has the MediaTracker built right in
javax.swing.ImageIcon ii = new javax.swing.ImageIcon(url);
Image image = ii.getImage(); // now the pixel data is in memory
// get the height and width of the loaded image
int width = image.getWidth(null);
int height = image.getHeight(null);
// create a rectangle as big as the image
Rectangle drawRect = new Rectangle(10, 10, width, height);
BufferedImage bufImage = new BufferedImage(width,
height, BufferedImage.TYPE_INT_RGB);
// get the graphics so you can draw on it
Graphics2D g = bufImage.createGraphics();
// create a nicce white background for the image
g.setColor(Color.white);
g.fillRect(0, 0, width, height);
// reset the color
g.setColor(Color.black);
// add the image
g.drawImage(image, 0, 0, null);
// add any other things you want as well
g.drawString("Just a string", 10, 10);
// create the output stream
ServletOutputStream out = response.getOutputStream();
JPEGImageEncoder jpegImageEncoder = JPEGCodec.createJPEGEncode(out);
// encode it
jpegImageEncoder.encode(bufImage);
out.flush();
out.close();
Hope that this helps.
Mike -
Save an image from interactive form to R/3 system table
Hi to all,
my scenario is this: Web AS 7.0 (probably patched to the last available patch), NWDS 7.0 and, at the moment, a 4.6c R/3 backend system (within some months we will upgrade to ECC 6.0). I have an online interactive form with some input fields and a user, logged in, fills these fields and pressing the "Submit to SAP" button will save the datas to a custom table on 4.6c backend. All this is simple and is working, but my problem is that one of these fields is an image. The purpose is that the user click on the image field and load an image from local PC and then, pressing submit to SAP button, will save the image on the custom table.
How can I make this? Which kind of context I have to bind to the image field? I have to add a java script/form calc code to image field? And to backend side, how can I do?
Thank you very much in advance,
EnricoHi,
In your forms you got the image or a link to the image ? If it's the image the field is define as an XSTRING is supposed. If yes you can add it easily in a database table.
If it's a link, your SAP system ( 4.6 C ) need to the the repository where the image is and then you can add it in the database.If you SAP system doesn't see the repository it's impossible to do so.
Hope this help you.
Best regards -
Saving images from applet back to the host
Hi,
I am trying to save an image (or a buffered image) from an applet back to its original host . Is there a way to do this without using a servlet at the server's end?
An earliest response would be appreciated.
Thanks in advance.Thanks to all of you for your help. Your replies have been helpful to me.
Atlast I'm done with my problem. I am able to write my image to the host.
I have converted the Image(buffered image) into a byte stream
ImageIO.write(bimg,imgType,bos);
converted the stream to byte array:
byte[] b=bos.toByteArray();
and used HttpURLConnection to write the byte array to the host.
Thank you. -
Save an Image ??? Possible ?? Oo
Hello,
I create a website but my problem is that it is impossible de save images : right click doesn't work on it .... Oo How can I do to save the image on my computer ?
Thanks !
ByHi,
Generally if you want a highly dynamic site with features that flash offer like page transitions etc... its nice to do it as a flex/flash RIA. Overhead can be an issue but this is becoming less important these days.
One thing I would recommend is that you have a look at preloaders, you website brings up the standard preloader progressbar but then there is a big delay between when the preloader (progress bar) completes and the site displays. With custom preloaders you can have a better representation of the load of objects before they are displayed.
David -
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);
} -
In an eMail message, when I attempt to save two photos by clicking the 'Save 2 Images' link, not the 'Save Image' link, the images are not saved. (I use I I apologize for the late notice, butOS7 on IPhone5). Is this feature broken?
Please don't post the same question multiple times!
-
In the new iphoto app, why can't i save multiple images to camera roll at once?
why can't i save multiple images to camera roll at once? it seems i can only save one at a time and its very frustrating..
the options seem to be there, they are just greyed out and i cant click on them.
at first i thought its because the images were too big, so i tried it with smaller images but same thing.
APPLE HELP!I can confirm @khaniff's original post the option in iPhoto for iOS is greyed out in conflict with the referenced article that follows:
Save to the Camera Roll
Tap a photo, album, or event and tap .
Tap Camera Roll.
Confirm or change the photos you want to share by tapping an option.
Select all the photos in an album or event: Tap All.
Select a range of photos: Tap Choose, tap Range, tap the first and last photos in the range, and tap Next.
To use your photo in another app, open the app and select the Camera Roll album. -
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. -
I get an error message when I try to save my images in Photoshop CS6
I get an error message when I'm trying to save my images. It reads as follows:
"Could not save because file is locked, you do not have necessary access permissions or another file is using it"
The file is not locked (I unlocked the image as a layer), I am the administrator, and it wasn't being used elsewhere.
This has happened with all the images I've worked on in the past 90 minutes. Has anyone got a solution? I've never gotten this message beforeCheck that you actually have write permissions on the drive you are trying to save to. They can an do get changed.
-
How can I save the images to the iPhone anywhere
Hello I own Time capsule 3 tb. How can I save the images to the iPhone anywhere in Time capsule
note i used fileexplorer when Outside the home isee Outside Message " error connection failed with the error operation time out "
ThanksMost Simple Back Up:
Drag the iPhoto Library from your Pictures Folder to another Disk. This will make a copy on that disk.
Slightly more complex: Use an app that will do incremental back ups. This is a very good way to work. The first time you run the back up the app will make a complete copy of the Library. Thereafter it will update the back up with the changes you have made. That makes subsequent back ups much faster. Many of these apps also have scheduling capabilities: So set it up and it will do the back up automatically.
Example of such apps: Chronosync - but there are many others. Search on MacUpdate or the App Store
If you want to back up the Photos only:
Export them using the File -> Export command.
This User Tip
https://discussions.apple.com/docs/DOC-4921
has details of the options in the Export dialogue. -
When I try to save an image under the command 'save as' it will only let me save as file types 'firefox document' or 'all files' and when I try to look at them later they dont work. How can I save an image as the same file type it is on the web site?!
== This happened ==
Every time Firefox opened
== I updated to one of the firefox versions (Not sure which one it was)Thanks Alex, but sadly I already tried that. Neither .docx or .xlsx files show up in the content list. They both show as a Chrome HTML document so changing how Firefox addresses those doesn't help since it thinks its the same type of file. I don't think I can manually add files into the "Content Type" left side nav.
-
Is there a way to save an image file as a jpeg and add -web or -print to the file name?
I am trying to find a way to save my image file as a jpeg and add -web or -print to the existing file name. This way I can easily see which files are lower resolution for web posting or high resolution for printing.
Jason,
I helped somebody do a very similar thing about a week ago.
The trick is to use the Batch command's ability to construct a file name.
Tell the batch to append, e.g. "-x" without quotes, to the name of each saved file.
The batch runs an Action which does a save as JPEG, resize image, add logo, save as JPEG, then close document.
The output is "<document name>-x.jpg" and "<document name>-x-x.jpeg".
Then use Windows Explorer to rename "*-x-x.jpg" to "*-print.jpg".
Then rename "*-x.jpg" to "*-web.jpg".
See http://forums.adobe.com/thread/1038992?start=32
The name construction that I used there was just an "x" appended to the document name. Use whatever you like. Also juliew subsequently referred to the method as a "double-batch" run, although it is not. One run of the batch will output two JPEGs for each input document.
I hope the disagreements in that thread don't cause too much disruption.
If you want, the Batch command itself can be recorded in another Action which would store the parameters of the batch, then you could run that Action anytime without having to set up the details of the batch each time. It would always output to one specific folder, though. -
Ever since I had updated my phone to ios 6, i noticed that it no longer saved photos to my camera roll. If I take a picture on Instagram, it will not automatically save it to my camera roll as it used to do, nor does it save any image, I just want it fixed.
To gdgmacguy your a f****** idiot for one I'm having the same problem as pennymar. And you tell me to quit whinning. You got more problems then the iOS 6 you did not answer my question nor the other 13 or whatever you replied to within a 30 min time frame. You must got nothing better to do then to harass people and to pretend you know something about apple products. Which you don't from what I've read the other advices you should have gave to other people. But you didn't you replied a question back to the people asking a question. So if your not gonna use these community forums the right way don't use them at all.
-
How can i save an image in DB ?
Hi ..
I am trying to save an image in SQL plus DB. In database, i created "upload" table with values
UPN number(6)
UPF blob
In this below given code, AttchingFile.jsp, is to display the fileds, when u click the upload button, UploadAttach.jsp will be called.
but UploadAttach.jsp is giving "File does not uploaded" as a result.
DB connection is working properly.
Can anyone solve this issue. it will be appreciated.
AttachingFile.jsp :
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
</script>
<title>Attach</title>
</head>
<body>
<br><br><br>
<center>
<form name="attach" action="http://localhost/intro/UploadAttach.jsp" method="post" ENCTYPE="multipart/form-data">
<p><b>Upload No:</b><input type="text" name=num size&H30> </p>
<p><input type="file" name=attach size&H30> </p>
<br><br>
<input type="submit" name="upl" value="UPLOAD">
</form>
</center>
</body>
</html>
Uploadattach.jsp :
<%@ page import="com.maxil.util.*" %>
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import ="java.sql.*" %>
<%@ page import ="javax.sql.*" %>
<%@ page import ="javax.naming.InitialContext" %>
<%@ page import ="java.sql.PreparedStatement.*" %>
<%@ page import="java.io.*" %>
<html>
<form name="upload1" method=post>
<%
DBUtil db = new DBUtil();
Connection conn= db.getConnection();
try
int up1=Integer.parseInt(request.getParameter("num"));
String up2=request.getParameter("attach");
java.io.File f=new java.io.File("up2");
Statement stmt = conn.createStatement();
InputStream is = new FileInputStream(f);
System.out.println("4 "+is);
byte b[]=new byte[is.available()];
is.read(b);
String sql = "INSERT into upload values('"+up1+"','" + b + "')";
System.out.println("sql is " +sql);
stmt.execute(sql);
stmt.close();
%>
<center><h3>File Uploaded Successfull</h3></center>
<%
catch(Exception e)
e.printStackTrace();
%>
<center><h3>File Does not Uploaded</h3></center>
<%
%>
</form>
</html>1. Use code tags when you post code.
2. Post java, not whatever that is that you posted.
3. Your database/jdbc code should be in its own class/layer. Nothing else. Other layers use that.
4. Post SQL exceptions not messages from your own code.
5. I believe the stream needs to be closed.
6. I know the connection needs to be closed
Maybe you are looking for
-
Application server file values getting truncated
Hi, I'm sending a file to Application server with minimun 1800 characters in a singlw row. The file is getting uploaded into the server but with only 255 chars in the same row. All others are getting truncated. Can anyone please suggest on this? Than
-
Images in Safari are not good quality
I've recently switched over to a MacBook Pro from my iBook G4 and one thing that is really annoying me and that I can't find a solution to the quality of images whilst internet browsing with Safari. It basically gives information of Shift + R improve
-
Throwing a fault from an asynchronous bpel process
Hi, can anyone please let me know how i can throw a fault to the calling client from an asynchronous bpel process? (synchronous bpel uses the fault of the reply activity to do the same - i want a similar thing in a callback-invoke of an asynchronous
-
I was awaiting for the success kit, certificate of Oracle Pl/Sql Developer Certified Associate. It arrived when I was not present at the given address, and it was not delivered to me and sent back to Oracle. Now, I will be highly obliged if you pleas
-
I have a situation where I have to use RF guns for GR , GI and Physical Inventory using multiple guns. Have any one encountered such a situation.If so please throw some light on this issue. thanks in advance Kaushik