Problem with indexOf ()
Hi, I have a strange problem with this method.
I have a some String like this:
":8547:Yog.Mora 200g:5123:0.4:0.5:123456789"
":8548:Yog.Mora 220g:5123:0.8:0.9:123456789"
":8549:Yog.Mora 250g:5123:1.0:1.2:123456789"
ok now I use indexOf to find when other Strings like this ones has a certaing substring on it. for example the substring "Yog." and works, but the problem is:
Searching for: "8547" works perfectly.
Searching for: "547" doesnt works.
how can this be posible if it finds 8547 it should find 547 but it doesnt, any clue?
how can this be posible if it finds 8547 it should find 547 but it doesnt, any clue? Your code is wrong, maybe you aren't searching from the start of the String. Anyway, we are wasting time guessing.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.
Similar Messages
-
Problems with indexOf reading from an updating string
String[][] shapeArray = new String[5][2];
int isCol;
int isCom;
String outputsub1 = finoutput; // finoutput is holding text imported from a file
String outputsub2;
for (int y = 0; y < 2; y++)
for (int x = 0; x < 5; x++)
isCol = outputsub1.indexOf(":");
isCom = outputsub1.indexOf(",");
if (x == 4 && y == 1)
shapeArray[x][y] = outputsub1.substring((isCol+2));
else
shapeArray[x][y] = outputsub1.substring((isCol+2),isCom);
outputsub2 = outputsub1.substring(isCom+2);
outputsub1 = (outputsub2);
}the text imported looks like this...
Shape: Circle, Position: 100, 250, Size: 130, 130, Colour: Blue, Fill: yes
Shape: Rectangle, Position: 300, 250, Size: 110, 110, Colour: Red, Fill: no
i would use a string tokeniser, but i need to use this method. im trying to shorten the string each time so that the indexOf will find the next ":" each time. However when i try and update the string holding the updated data (outputsub1) i get the following error:
java.lang.StringindexOutOfBoundsException: String index out of range: -8
at java.lang.String.substring(String.java:144)
at ReadFile.init(ReadFile.java:52)
at sun.applet.AppletPanel.run(AppletPanel.java:353)
at java.lang.Thread.run(Thread.java:534)
i hope that makes sense to someone, it only occurs when i add the line..
outputsub1 = (outputsub2);
and works fine when i comment it out (although doesnt give the right response obviously.)
thankyou for any help you can offerString index out of range: -8 simply means that you try to access the String at position "-8", which obviously makes no sense. There must be some mistake either in your code or your algorithm. Keep in mind that indexOf returns -1 in case the argument wasn't found - maybe that's the reason for that error.
-
Help with add file name problem with Photoshop CS4
Frustrating problem: Help with add file name problem with Photoshop CS4. What happens is this. When I am in PS CS4 or CS3 and run the following script it runs fine. When I am in Bridge and go to tools/photoshop/batch and run the same script it runs until it wants interaction with preference.rulerunits. How do I get it to quit doing this so I can run in batch mode? Any help is appreciated. HLower
Script follows:
// this script is another variation of the script addTimeStamp.js that is installed with PS7
//Check if a document is open
if ( documents.length > 0 )
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.INCHES;
try
var docRef = activeDocument;
// Create a text layer at the front
var myLayerRef = docRef.artLayers.add();
myLayerRef.kind = LayerKind.TEXT;
myLayerRef.name = "Filename";
var myTextRef = myLayerRef.textItem;
//Set your parameters below this line
//If you wish to show the file extension, change the n to y in the line below, if not use n.
var ShowExtension = "n";
// Insert any text to appear before the filename, such as your name and copyright info between the quotes.
//If you do not want extra text, delete between the quotes (but leave the quotes in).
var TextBefore = "Lower© ";
// Insert any text to appear after the filename between the quotes.
//If you do not want extra text, delete between the quotes (but leave the quotes in).
var TextAfter = " ";
// Set font size in Points
myTextRef.size = 10;
//Set font - use GetFontName.jsx to get exact name
myTextRef.font = "Arial";
//Set text colour in RGB values
var newColor = new SolidColor();
newColor.rgb.red = 0;
newColor.rgb.green = 0;
newColor.rgb.blue = 0;
myTextRef.color = newColor;
// Set the position of the text - percentages from left first, then from top.
myTextRef.position = new Array( 10, 99);
// Set the Blend Mode of the Text Layer. The name must be in CAPITALS - ie change NORMAL to DIFFERENCE.
myLayerRef.blendMode = BlendMode.NORMAL;
// select opacity in percentage
myLayerRef.opacity = 100;
// The following code strips the extension and writes tha text layer. fname = file name only
di=(docRef.name).indexOf(".");
fname = (docRef.name).substr(0, di);
//use extension if set
if ( ShowExtension == "y" )
fname = docRef.name
myTextRef.contents = TextBefore + " " + fname + " " + TextAfter;
catch( e )
// An error occurred. Restore ruler units, then propagate the error back
// to the user
preferences.rulerUnits = originalRulerUnits;
throw e;
// Everything went Ok. Restore ruler units
preferences.rulerUnits = originalRulerUnits;
else
alert( "You must have a document open to add the filename!" );you might want to try the scripting forum howard:
http://www.adobeforums.com/webx?13@@.ef7f2cb -
Problems with the Proxy Programme--Please help
Hi All,
I have written a simple proxy server in the form of a servlet. I changed the proxy config of my browser to connect to this servlet hosted on the default context(http://localhost:8080) of the Tomcat 5.0.25 . Well , this servlet internally connects to the proxy of the corporate LAN . The logic that I have applied is as follows. The servlet gets the request from the client (ie the browser in this case) , extracts the headers and contents from the request, sets them to a new request that it forms and finally send this new request to the proxy. When the proxy responds, the servlet collects the response headers and contents adn writes them in its response. To sum up , this servlet transparently carries the requests and responses between the client(browser) and the corporate LAN proxy. Now the problem is this. Let's say , now I am accessing http://www.google.com.The browser sends a request to my servlet with the following headers as they are extracted by my servlet.
ProxyServer:::>posting request
ProxyServer:::>headerValue::> headerName = accept : headerValue=*/*
ProxyServer:::>headerValue::> headerName = referer : headerValue=http://www.google.com/
ProxyServer:::>headerValue::> headerName = accept-language : headerValue=en-us
ProxyServer:::>headerValue::> headerName = proxy-connection : headerValue=Keep-Alive
ProxyServer:::>headerValue::> headerName = user-agent : headerValue=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; UB1.4_IE6.0_SP1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)
ProxyServer:::>headerValue::> headerName = host : headerValue=www.google.com
ProxyServer:::>headerValue::> headerName = cookie : headerValue=PREF=ID=1be27c0a74f198ca:TM=1082058853:LM=1082058853:S=bu6ORrygzm8AUkm8
ProxyServer:::>postRequest
I set these headers into a new connection opened to the proxy and post a fresh request to the proxy,which, in turn responds with the following headers.
ProxyServer:::>posted request successfully
ProxyServer:::>writing response
ProxyServer:::>writeResponse-->headerName = Proxy-Connection : headerValue = [close]
ProxyServer:::>writeResponse-->headerName = Content-Length : headerValue = [257]
ProxyServer:::>writeResponse-->headerName = Date : headerValue = [Tue, 13 Jul 2004 14:01:40 GMT]
ProxyServer:::>writeResponse-->headerName = Content-Type : headerValue = [text/html]
ProxyServer:::>writeResponse-->headerName = Server : headerValue = [NetCache appliance (NetApp/5.5R2)]
ProxyServer:::>writeResponse-->headerName = Proxy-Authenticate : headerValue = [Basic realm="Charlotte - napxyclt2"]
ProxyServer:::>writeResponse-->headerName = null : headerValue = [HTTP/1.1 407 Proxy Authentication Required]
ProxyServer:::>writeResponse exiting
ProxyServer:::>wrote response successfully
I write these headers back to the client. According to what I was thinking, the client ie the browser would open a new dialog box asking for username/password owing to the presence of the "Proxy-Authenticate " header. But it does not happen that way. Rather the browser stops responsding and displays a blank page. Does anyone know why it happens this way? I am pasting the server prog below for everybody's reference.
package server.proxy;
//import all servlet related classes
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
import java.net.*;
import server.resources.*;
//My Proxy server --->Currently it is very simplea and relies on
//other proxy servers of an already connected network.
public class ProxyServer extends HttpServlet
//stores the resource bundle
private ServerResBundle resBundle = null;
//checks for the mode of operation
private boolean proxySet = false;
private String proxy = null;
//storing the original System out/err etc
private PrintStream sysOutOrig = null;
private PrintStream sysErrOrig = null;
private InputStream sysInOrig = null;
//initialise certain features that are required later
public void init() throws ServletException
try
//initialise the resource bundle
this.initResBundle();
System.out.println("ProxyServer:::>res bundle init");
//set the mode of operation
this.setMode();
System.out.println("ProxyServer:::>mode set");
//set the system out and err --System.setOut etc
this.setSystemOutErr();
System.out.println("ProxyServer:::>in/out/err set");
}//End try
catch(Exception e)
System.out.println("Exception in init..."+(e.getMessage()));
throw new ServletException(e);
}//Edn
catch(Throwable e)
System.out.println("Irrecoverable Error...");
throw new ServletException(e);
}//End
}//End init
//method to init the resource bundle;
private void initResBundle()
this.resBundle = ServerResBundle.getBundle();
}//End
//method to set the mode of the server--proxy or direct
private void setMode()
//read the target proxy property from the bundle and
//if it is set,take that URL
String temp = (String)(this.resBundle.getResource(ResKeys.PROXY_SERVER));
if ( (temp != null) && (temp.length() > 0) )
this.proxySet = true;
this.proxy = temp;
temp = null;
}//End
}//End
//method to set the system out and err etc
private void setSystemOutErr() throws Exception
//keep a copy of the original system out and error
this.sysOutOrig = System.out;
this.sysErrOrig = System.err;
try
//read the options adn if they are set, take the values directly
String newOutStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_OUT));
String newErrStr = (String)(this.resBundle.getResource(ResKeys.SYSTEM_ERR));
if ((newOutStr != null) && (newOutStr.length() > 0))
System.setOut(new PrintStream(new FileOutputStream(new File(newOutStr),true),true));
}//End if
if ((newErrStr != null) && (newErrStr.length() > 0))
System.setErr(new PrintStream(new FileOutputStream(new File(newErrStr),true),true));
}//End if
}//End
catch(Exception e)
//restore the stuff
System.setOut(this.sysOutOrig);
System.setErr(this.sysErrOrig);
}//End
}//End
//this is where the proxy functionalities will be embedded
public void service(HttpServletRequest req,HttpServletResponse resp)
throws ServletException,java.io.IOException
//conenction URL
URL target = null;
//conenction to the remote object
URLConnection targetConn = null;
//stores the OOS and the OIS
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
try
//check for the mode of operation
if (proxySet)
URLConnection objects go through two phases: first they are created, then they are connected.
After being created, and before being connected, various options can be specified
(e.g., doInput and UseCaches). After connecting, it is an error to try to set them.
Operations that depend on being connected, like getContentLength, will implicitly perform the connection,
if necessary.
//for the URL to the proxy
target=new URL(this.proxy);
//conenct to the proxy
targetConn = target.openConnection();
//set the details of the connectuon
targetConn.setDoInput(true);
targetConn.setDoOutput(true);
targetConn.setUseCaches(false);
// If true, this URL is being examined in a context in which it makes sense to allow user interactions such as popping up an authentication dialog. If false, then no user interaction is allowed
targetConn.setAllowUserInteraction(true);
//connect to the remote object
// targetConn.connect();//call this only when all the request properties are set
System.out.println("ProxyServer:::>posting request");
//post the received request to the URL
this.postRequest(targetConn,req);
System.out.println("ProxyServer:::>posted request successfully");
System.out.println("ProxyServer:::>writing response");
//receive the response
//write the received response to the client
this.writeResponse(targetConn,resp);
System.out.println("ProxyServer:::>wrote response successfully");
}//End if
else
//currently this functionality is not supported
throw new ServletException(
(String)(this.resBundle.getResource(ResKeys.ERR_FUNC_NOTSUPPORTED)));
}//End
}//End try
catch(Exception e)
if(e instanceof ServletException)
throw (ServletException)e;
}//End
if (e instanceof IOException)
throw (IOException)e;
}//End
//wrap it up in ServletException
throw new ServletException(e);
}//End
}//End
//method to write the response back to the client
private void writeResponse(URLConnection targetConn,HttpServletResponse resp)
throws ServletException
//get all the header fields from the response connection and set them to the
//response of the servlet
Map headerFields = null;
Iterator headerFieldEntries = null;
Map.Entry header = null;
//stores the input stream to the conn
BufferedReader brConn = null;
//stores the writer to the response
PrintWriter prResp = null;
//checks if the proxy authentication needed or not
boolean proxyAuthReqd = false;
try
//juste ensuring that the proxy authentication is reset
proxyAuthReqd = false;
if( (targetConn != null) && (resp != null) )
//Returns an unmodifiable Map of the header fields.
//The Map keys are Strings that represent the response-header field names.
//Each Map value is an unmodifiable List of Strings that represents the corresponding
//field values
headerFields = targetConn.getHeaderFields();
//Returns a set view of the mappings contained in this map
Set temp = headerFields.entrySet();
//Returns an iterator over the elements in this set
headerFieldEntries = temp.iterator();
if (headerFieldEntries != null)
while (headerFieldEntries.hasNext())
Object tempHeader = headerFieldEntries.next();
if (tempHeader instanceof Map.Entry)
header = (Map.Entry)tempHeader;
Object headerName = header.getKey();
Object headerValue=header.getValue();
System.out.println("ProxyServer:::>writeResponse-->headerName = "+headerName+" : headerValue = "+headerValue);
//do not select the key-value pair if both the key adn the value are null
if ( ( headerName == null) && (headerValue == null) )
continue;
}//Enmd
if (headerValue != null)
List headerValList = null;
if (headerValue instanceof List)
headerValList = (List)headerValue;
}//End
if(headerValList != null)
for (int i=0;i<headerValList.size();i++)
Object headerValueStr = headerValList.get(i);
if (headerValueStr instanceof String)
//note that the header-key can not be null for addHeader
//I have made this temporary provision to make the programme work.
resp.addHeader(( (headerName==null)? ("null_header"+i) :(String)headerName),
(String)headerValueStr);
//check if the proxy authentication required or not
if (((String)headerValueStr).
indexOf(resp.SC_PROXY_AUTHENTICATION_REQUIRED+"") != -1)
System.out.println("ProxyServer:::>writeResponse-->proxy auth needed");
//proxy authentication is needed
proxyAuthReqd = true;
}//End
}//Ednd of
else if (headerValueStr == null)
resp.addHeader(( (headerName==null)? null :(String)headerName),
null);
}//End
}//End for
}//End if
}//End if
}//End
}//End while
}//End if
//get the writer to the client
prResp = resp.getWriter();
System.out.println("ProxyServer:::>writeResponse-->proxyAuthReqd="+proxyAuthReqd);
//juste test a simple header
System.out.println("Proxy-Authenticate = "+(resp.containsHeader("Proxy-Authenticate")));
//if the proxy asks you for authentication,pass on the same to the client
//from whom you have received the request.When this flag is true,the connection
//is closed by the remotehost adn hence any attempt to open in input steram
//results in an error ie IOException
if (!proxyAuthReqd)
//now get the content adn write it to the response too
brConn = new BufferedReader(new InputStreamReader(
targetConn.getInputStream()));
String tempStr = null;
while ((tempStr = brConn.readLine())!=null)
prResp.println(tempStr);
}//End while
//close the connections
brConn.close();
}//End if
else
prResp.println("Proxy Authentication needed...");
}//End
//close the streams
prResp.flush();
prResp.close();
}//End if
System.out.println("ProxyServer:::>writeResponse exiting\n");
}//End try
catch(Exception e)
throw new ServletException(e);
}//End
}//End
//method to post request to the internet
private void postRequest(URLConnection targetConn,HttpServletRequest req)
throws ServletException
//extract the header parameters and the body content from the incoming request
//and set them to the new connection
Enumeration reqHeaders = null;
//reads the incoming request's content
BufferedReader brReqRd = null;
PrintWriter prResWt = null;
//stores temp header names and values
String headerName = null;
String headerValue = null;
try
if( (targetConn != null) && (req != null) )
reqHeaders = req.getHeaderNames();
//extract a header adn set it to the new connection
while (reqHeaders.hasMoreElements())
headerName = (String)(reqHeaders.nextElement());
headerValue = req.getHeader(headerName);
targetConn.setRequestProperty(headerName,headerValue);
System.out.println("ProxyServer:::>headerValue::> headerName = "+headerName+" : headerValue="+headerValue);
}//End
System.out.println("ProxyServer:::>postRequest\n");
//establis the actual connection
//calling this method bfore the above loop results in IllegalStateException
targetConn.connect();
//NOTE : try reading from and writing into OIS and OOS respectively
//now read the contents and write them to the connection
// brReqRd = req.getReader(); //this hangs for some reason
brReqRd = new BufferedReader(new InputStreamReader(req.getInputStream()));
System.out.println("Got the reader..brReqRd = "+brReqRd);
if (brReqRd != null)
String temp = null;
//establish the printwriter
// prResWt = new PrintWriter(targetConn.getOutputStream(),true);
prResWt = new PrintWriter(targetConn.getOutputStream());
System.out.println("trying to read in a loop from brReqRd.. ready="+(brReqRd.ready()));
while( (brReqRd.ready()) && ((temp=brReqRd.readLine()) != null) )
System.out.println("In while::>temp = "+temp);
prResWt.println(temp);
}//Emd while
//close the streams adn go back
brReqRd.close();
prResWt.flush();
prResWt.close();
}//End
}//End outer if
System.out.println("ProxyServer:::>postRequest exiting\n");
}//End try
catch(Exception e)
throw new ServletException(e);
}//End
}//End
}//EndHi serlank ,
Thanks for your reply. Well , I initially I thought of not pasting the code,as it was too long. But I could not help it,as I thought I must show in code what I exactly meant. That's why I followed a description of my problem with the code. You could probably have copied the code and pasted it in one of your favourite editors to take a look at it. Did you,by any chance, try to read it on the browser? And as regards reposting the same message, I can say that I did it as I felt the subject was not quite appropriate in the first posting and I was not sure as to how I could delete/alter the posting. I am not asking for a code-fix,but some suggestions from some one who might ever have come across such a thing.Anyway, lemme know if you have any idea on it. Thanks... -
Problem with Listeners/ requestFocus()
Hello,
I am new to Java (started learning two months back), There is a problem with the requestFocus() in the focusListener. The program does not return the focus to the object indicated in the requestFocus but it shows multiple cusors!!
The faculity at the institute where I am learning could not rectify the error.
Is the error because of the myMethod() which I am using. I had made this method to prove to my professor that we can reduce the code drastically while using the gridbaglayout.
The code which I had written is as under:
// file name ShopperApplet.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ShopperApplet extends JApplet implements ActionListener, FocusListener,Runnable
//static JPanel sP;
//static JPanel oP;
JTabbedPane tabbedPane = new JTabbedPane();
JPanel sP;
JPanel oP;
JPanel pwd = new JPanel();
// Layout Decleration of oP
GridBagLayout ordL = new GridBagLayout();
GridBagConstraints ordC = new GridBagConstraints();
// Layout Decleration of sP
FlowLayout flow = new FlowLayout();
// Variables of sP
JTextField textShopperId;
JPasswordField textPassword;
JTextField textFirstName ;
JTextField textLastName ;
JTextField textEmailId ;
JTextField textAddress ;
JComboBox comboCity ;
JTextField textState ;
JTextField textCountryId ;
JTextField textZipCode ;
JTextField textPhone ;
JTextField textCreditCardNo ;
JRadioButton rbVisa;
JRadioButton rbMaster;
JRadioButton rbAmEx;
ButtonGroup BGccType;
//JComboBox comboCreditCardType;
//JTextField textExperyDate;
JComboBox cmbDt;
JComboBox cmbMth;
JComboBox cmbYear;
JButton btnSubmit;
JButton btnReset;
// Variables of oP
// Variable Decleration od oP
JTextField txtOrderNo;
JTextField txtToyId;
JTextField txtQty;
JRadioButton rbYes;
JRadioButton rbNo;
ButtonGroup bgGiftWrap;
JComboBox cmbWrapperId;
JTextField txtMsg;
JTextField txtToyCost;
JButton btnOSubmit;
JButton btnOReset;
// Variables of pwd
JTextField txtShopperId;
JPasswordField txtPassword;
JButton btnPSubmit;
JButton btnPReset;
JButton btnPNew;
JButton btnPLogoff;
JLabel lblN, lblN1;
Thread t,t1;
Font TNR = new Font("Times New Roman",1,15);
Font arial = new Font("Arial",2,15);
public void sPDet()
//Variable Decleration of sP
textShopperId = new JTextField(6);
textPassword = new JPasswordField(4);
textPassword.addFocusListener(this);
//textPassword = new JTextField(4);
textPassword.setEchoChar('*');
textFirstName = new JTextField(20);
textLastName = new JTextField(20);
textEmailId = new JTextField(25);
textAddress = new JTextField(20);
String cityList[] = {"New Delhi", "Mumbai", "Calcutta", "Hyderabad"};
comboCity = new JComboBox(cityList);
comboCity.setEditable(true);
textState = new JTextField(30);
textCountryId = new JTextField(25);
textZipCode = new JTextField(6);
textPhone = new JTextField(25);
textCreditCardNo = new JTextField(25);
String cardTypes[] = {"Visa", "Master Card", "American Express"};
//comboCreditCardType = new JComboBox(cardTypes);
rbVisa = new JRadioButton("Visa");
rbMaster = new JRadioButton("Master Card");
rbAmEx = new JRadioButton("American Express");
BGccType = new ButtonGroup();
BGccType.add(rbVisa);
BGccType.add(rbMaster);
BGccType.add(rbAmEx);
String stDt[] = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"};
String stMth[] = {"January","February","March","April","May","June","July","August","September","October","November","December"};
String stYear[] = {"2001","2002","2003","2004","2005","2006","2007","2008","2009","2010"};
cmbDt = new JComboBox(stDt);
cmbMth = new JComboBox(stMth);
cmbYear = new JComboBox(stYear);
//textExperyDate = new JTextField(10);
btnSubmit = new JButton("Submit");
btnReset = new JButton("Reset");
// Adding Layout Controls
sP.setLayout(ordL);
sP.setBackground(Color.green);
myLayout(textShopperId,3,1,sP,"FM","Shopper Id");
myLayout(textPassword,3,2,sP,"FM","Password");
myLayout(textFirstName,3,3,sP,"FM","First Name") ;
myLayout(textLastName,3,4,sP,"FM","Last Name") ;
myLayout(textEmailId,3,5,sP,"FM","E-Mail Id") ;
myLayout(textAddress,3,6,sP,"FM", "Address") ;
myLayout(comboCity,3,7,sP,"FM","City") ;
myLayout(textState,3,8,sP,"FM","State") ;
myLayout(textCountryId,3,9,sP,"FM","Country") ;
myLayout(textZipCode,3,10,sP,"FM","Zip Code") ;
myLayout(textPhone,3,11,sP,"FM","Phone") ;
myLayout(textCreditCardNo,3,12,sP,"FM","Credit Card No.") ;
//myLayout(rbVisa,3,13,sP);
JPanel newPanel = new JPanel();
newPanel.add(rbVisa);
newPanel.add(rbMaster);
newPanel.add(rbAmEx);
myLayout(newPanel,3,13,sP,"FM","Credit Card Type");
//myLayout(rbMaster,4,13);
//myLayout(rbAmEx,5,13);
JPanel newPanel1 = new JPanel();
newPanel1.add(cmbDt);
newPanel1.add(cmbMth);
newPanel1.add(cmbYear);
myLayout(newPanel1,3,14,sP,"FM","Expiry Date");
//myLayout(textExperyDate,3,14,sP,"FM");
myLayout(btnSubmit,1,17,sP,"AL","Submit");
myLayout(btnReset,3,17,sP,"AL","Reset");
public void oPDet()
txtOrderNo = new JTextField(10);
txtToyId = new JTextField(10);
txtQty = new JTextField(10);
rbYes = new JRadioButton("Yes");
rbNo = new JRadioButton("No");
bgGiftWrap = new ButtonGroup();
bgGiftWrap.add(rbYes);
bgGiftWrap.add(rbNo);
String wrapperTypes[] = {"Blue Stripes", "Red Checks", "Green Crosses","Yellow Circles", "Red & Purple Stripes"};
cmbWrapperId = new JComboBox(wrapperTypes);
txtMsg = new JTextField(10);
txtToyCost = new JTextField(10);
btnOSubmit = new JButton("Submit");
btnOReset = new JButton("Reset");
// Adding Controls to oP
oP.setLayout(ordL);
oP.setBackground(Color.yellow);
myLayout(txtOrderNo,3,1,oP,"FM","Order No.");
myLayout(txtToyId,3,2,oP,"FM","Toy Id");
myLayout(txtQty,3,3,oP,"FM","Quantity");
myLayout(rbYes,3,4,oP,"M");
myLayout(rbNo,4,4,oP,"M");
myLayout(cmbWrapperId,3,5,oP,"M","Wrapper Id");
myLayout(txtMsg,3,6,oP,"FM","Message");
myLayout(txtToyCost,3,7,oP,"FM","Toy Cost");
myLayout(btnOSubmit,1,8,oP,"AL","Submit");
myLayout(btnOReset,3,8,oP,"AL","Reset");
public void pwdDet()
pwd.setLayout(ordL);
pwd.setBackground(Color.green);
t = new Thread(this);
t.start();
t1 = new Thread(this);
t1.start();
lblN = new JLabel("");
lblN1 = new JLabel("");
txtShopperId = new JTextField(10);
txtPassword = new JPasswordField(10);
btnPSubmit = new JButton("Submit") ;
btnPReset = new JButton("Reset");
btnPNew = new JButton("New Member");
btnPLogoff = new JButton("Log Off");
pwd.setLayout(ordL);
pwd.setBackground(Color.yellow);
myLayout(lblN,3,7,pwd);
myLayout(lblN1,3,8,pwd);
myLayout(txtShopperId,3,1,pwd,"FM","Shopper Id.");
myLayout(txtPassword,3,2,pwd,"FM","Password");
myLayout(btnPSubmit,2,4,pwd,"AL","Submit");
myLayout(btnPReset,3,4,pwd,"AL","Reset");
myLayout(btnPNew,2,5,pwd,"AL","New");
myLayout(btnPLogoff,3,5,pwd,"AL","Log Off");
public void run()
int ctr =0;
String ili[] = {"India","is","a","Great","Country"};
int ctr1 = 0;
String iib[] = {"India","is","the","Best"};
Thread myThread = Thread.currentThread();
if (myThread == t)
while (t != null)
lblN.setText(ili[ctr]);
ctr++;
if (ctr >=5) ctr=0;
try
t.sleep(500);
catch(InterruptedException e)
showStatus("India is a great Country has been interrupter");
else
while (t1 != null)
lblN1.setText(iib[ctr1]);
ctr1++;
if (ctr1 >=4) ctr1=0;
try
t1.sleep(1000);
catch(InterruptedException e)
showStatus("India is the best has been interrupter");
public void myLayout(JComponent aObj, int x, int y, JPanel aPanel,String aListener,String toolTip)
ordC.anchor=GridBagConstraints.NORTHWEST;
JLabel aLabel = new JLabel(toolTip);
ordC.gridx = x-1;
ordC.gridy = y;
ordL.setConstraints(aLabel,ordC);
aPanel.add(aLabel);
aObj.setToolTipText("Enter "+toolTip+" here");
aObj.setForeground(Color.red);
aObj.setBackground(Color.green);
if (aListener.indexOf("F") != -1)
aObj.addFocusListener(this);
//if (aListener.indexOf("M") != -1)
//aObj.addMouseListener(this);
aObj.setFont(TNR);
ordC.gridx = x;
ordC.gridy = y;
ordL.setConstraints(aObj,ordC);
aPanel.add(aObj);
public void myLayout(JComponent aObj, int x, int y, JPanel aPanel,String aListener)
ordC.anchor=GridBagConstraints.NORTHWEST;
aObj.setForeground(Color.red);
aObj.setBackground(Color.green);
if (aListener.indexOf("F") != -1)
aObj.addFocusListener(this);
//if (aListener.indexOf("M") != -1)
//aObj.addMouseListener(this);
aObj.setFont(TNR);
ordC.gridx = x;
ordC.gridy = y;
ordL.setConstraints(aObj,ordC);
aPanel.add(aObj);
public void myLayout(JButton aObj, int x, int y, JPanel aPanel,String aListener, String toolTip)
aObj.setToolTipText(toolTip);
ordC.anchor=GridBagConstraints.NORTHWEST;
aObj.setForeground(Color.red);
if (aListener.indexOf("F") != -1)
aObj.addFocusListener(this);
//if (aListener.indexOf("M") != -1)
//aObj.addMouseListener(this);
if (aListener.indexOf("A") != -1)
aObj.addActionListener(this);
aObj.setFont(TNR);
ordC.gridx = x;
ordC.gridy = y;
ordL.setConstraints(aObj,ordC);
aPanel.add(aObj);
public void myLayout(JTextField aObj, int x, int y, JPanel aPanel,String aListener,String toolTip)
ordC.anchor=GridBagConstraints.NORTHWEST;
//aObj = new JTextField(10);
JLabel aLabel = new JLabel(toolTip);
ordC.gridx = x-1;
ordC.gridy = y;
ordL.setConstraints(aLabel,ordC);
aPanel.add(aLabel);
aObj.setToolTipText("Enter "+toolTip+" here");
aObj.setForeground(Color.red);
if (aListener.indexOf("F") != -1)
aObj.addFocusListener(this);
//if (aListener.indexOf("M") != -1)
// aObj.addMouseListener(this);
if (aListener.indexOf("A") != -1)
aObj.addActionListener(this);
aObj.setFont(TNR);
ordC.gridx = x;
ordC.gridy = y;
ordL.setConstraints(aObj,ordC);
aPanel.add(aObj);
public void myLayout(JLabel aObj, int x, int y, JPanel aPanel)
ordC.anchor=GridBagConstraints.SOUTH;
aObj.setForeground(Color.blue);
aObj.setFont(TNR);
ordC.gridx = x;
ordC.gridy = y;
ordL.setConstraints(aObj,ordC);
aPanel.add(aObj);
public void init()
getContentPane().add(tabbedPane);
sP = new JPanel();
sPDet();
oP = new JPanel();
oPDet();
pwdDet();
tabbedPane.addTab("Login",null,pwd,"Login");
tabbedPane.addTab("Shopper",null,sP,"Shopper Details");
tabbedPane.addTab("Order",null,oP,"Order Details");
tabbedPane.setEnabledAt(2, false);
tabbedPane.setEnabledAt(1, false);
public void actionPerformed(ActionEvent e)
Object obj = e.getSource();
if (obj == btnSubmit)
if (validShopperId() == false) return;
if (validPassword() == false) return;
if (validFirstName() == false) return ;
if (validLastName() == false) return ;
if (validEmailId() == false) return;
if (validAddress() == false) return;
if (validState() == false) return;
if (validCountryId() == false) return;
if (validZipCode() == false) return;
if (validCreditCardNo() == false) return ;
resetShopper();
tabbedPane.setEnabledAt(1,false);
tabbedPane.setEnabledAt(2,false);
tabbedPane.setSelectedIndex(0);
// also can be written as tabbedPane.setSelectedComponent(pwd);
//tabbedPane.remove(sP);
if (obj == btnReset)
resetShopper();
tabbedPane.setEnabledAt(2,false);
//textExperyDate.setText("");
if (obj == btnOSubmit)
if (validOrderNo() == false) return;
if (validToyId() == false) return;
if (chkNullEntry(txtQty, "Quantity")) return ;
if (chkNullEntry(txtToyCost, "Toy Cost")) return ;
if (obj == btnOReset)
resetOrder();
if (obj == btnPSubmit)
if (validPShopperId() && validPPassword())
tabbedPane.setEnabledAt(2, true);
tabbedPane.setEnabledAt(1, false);
txtShopperId.setText("");
txtPassword.setText("");
resetPassword();
//tabbedPane.addTab("Order",null,oP,"Order Details");
if (obj == btnPReset)
resetPassword();
tabbedPane.setEnabledAt(1, false);
tabbedPane.setEnabledAt(2, false);
if (obj == btnPNew)
tabbedPane.setEnabledAt(1, true);
tabbedPane.setEnabledAt(2, false);
resetPassword();
tabbedPane.setSelectedComponent(sP);
//tabbedPane.addTab("Shopper",null,sP,"Shopper Details");
if (obj == btnPLogoff)
tabbedPane.setEnabledAt(2, false);
tabbedPane.setEnabledAt(1, false);
resetPassword();
public void focusGained(FocusEvent fe)
//Object aObj = fe.getSource();
//showStatus("Current Object is "+aObj);
public void resetPassword()
txtShopperId.setText("");
txtPassword.setText("");
public void resetShopper()
textShopperId.setText("");
textPassword.setText("");
textFirstName.setText("") ;
textLastName.setText("") ;
textEmailId.setText("") ;
textAddress.setText("") ;
textState.setText("") ;
textCountryId.setText("") ;
textZipCode.setText("") ;
textPhone.setText("") ;
textCreditCardNo.setText("") ;
public void resetOrder()
txtOrderNo.setText("");
txtToyId.setText("");
txtQty.setText("") ;
txtToyCost.setText("") ;
txtMsg.setText("") ;
public void focusLost(FocusEvent fe)
try{
Object obj = fe.getSource();
if (obj == textShopperId && validShopperId() == false)
//textShopperId.requestFocus();
return;
if (obj == textPassword && validPassword() == false)
//textPassword.requestFocus();
return;
if (obj == textFirstName && validFirstName() == false)
//textFirstName.requestFocus();
return;
if (obj == textEmailId && validEmailId() == false)
//textEmailId.requestFocus();
return;
if (obj == txtOrderNo && validOrderNo() == false)
//txtOrderNo.requestFocus();
return;
if (obj == txtToyId && validToyId() == false);
//txtToyId.requestFocus();
return;
catch(Exception e)
showStatus("error in LostFocus() Method");
public boolean validShopperId()
if (chkNullEntry(textShopperId,"Shopper Id")) return false;
return true;
public boolean validPassword()
if (chkNullEntry(textPassword,"Password")) return false;
return true;
public boolean validFirstName()
if (chkNullEntry(textFirstName,"First Name")) return false;
return true;
public boolean validLastName()
if (chkNullEntry(textLastName,"Last Name")) return false;
return true;
public boolean validAddress()
if (chkNullEntry(textAddress,"Address")) return false;
return true;
public boolean validState()
if (chkNullEntry(textState,"State")) return false;
return true;
public boolean validCountryId()
if (chkNullEntry(textCountryId,"Country")) return false;
return true;
public boolean validZipCode()
if (chkNullEntry(textZipCode,"Postal Code")) return false;
return true;
public boolean validCreditCardNo()
if (chkNullEntry(textCreditCardNo,"Credit Card No.")) return false;
return true;
public boolean validEmailId()
if (chkNullEntry(textEmailId,"Email Address")) return false;
String s1 = textEmailId.getText();
int abc = s1.indexOf("@");
if (abc == -1 || abc == 0 || abc == (s1.length()-1))
JOptionPane.showMessageDialog(sP,"Invalid Email Address","Error Message",JOptionPane.ERROR_MESSAGE);
//textEmailId.requestFocus();
return false;
return true;
public boolean validOrderNo()
if (chkNullEntry(txtOrderNo,"Order No.")) return false;
return true;
public boolean validToyId()
if (chkNullEntry(txtToyId,"Toy Id")) return false;
return true;
public boolean chkNullEntry(JTextField aObj,String sDef)
String s1 = aObj.getText();
if (s1.length() ==0)
try
JOptionPane.showMessageDialog(sP,sDef+" cannot be left blank","Error Message",JOptionPane.ERROR_MESSAGE);
//showStatus(sDef+" cannot be left blank");
// nbvvvv vcz z111111eeeefgggggggggg aObj.requestFocus();
catch(Exception e)
showStatus("Error in chkNullEntry() method");
return true ;
else
return false;
public boolean validPShopperId()
if (chkNullEntry(txtShopperId,"Shopper Id")) return false;
return true;
public boolean validPPassword()
if (chkNullEntry(txtPassword,"Password")) return false;
return true;
// end of code.Would it not be acceptable to check that each field has a value when Submit is pressed. If a field is found with no data then display the error message and return the focus to the empty field. This would solve the multiple cursors problem as you would not need any focusLost handler code.
If this is entirely out of the question then you will have to override some of the FocusManager methods to prevent the JVM from handling focus for you :
FocusManager.setCurrentManager(new DefaultFocusManager() {
// Override FocusManager methods here.
});Ronny. -
Having problem with spry menu bar in Internet Explorer.
I'm having a problem with my spry menu bars in Internet Explorer.
Here are the pictures:
Firefox
Internet Explorer
HERE ARE THE CODES:
HTML CODE:
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
width:160px;
height:126px;
z-index:1;
left: 205px;
top: 424px;
margin: 0 auto;
-->
</style>
<style type="text/css">
#apDiv3 {
position:absolute;
width:254px;
height:206px;
z-index:2;
left: 123px;
top: 1529px;
#apDiv4 {
position:absolute;
width:250px;
height:194px;
z-index:3;
left: 381px;
top: 1528px;
#apDiv5 {
position:absolute;
width:256px;
height:200px;
z-index:4;
left: 636px;
top: 1529px;
#apDiv6 {
position:absolute;
width:349px;
height:205px;
z-index:5;
left: 889px;
top: 1530px;
</style>
<style type="text/css">
#apDiv7 {
position:absolute;
width:887px;
height:204px;
z-index:6;
left: 324px;
top: 905px;
#apDiv8 {
position:absolute;
width:1295px;
height:74px;
z-index:1;
left: 212px;
top: 668px;
</style>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
</script>
<style type="text/css">
#apDiv2 {
position:absolute;
width:209px;
height:197px;
z-index:2;
top: 1220px;
left: 171px;
#apDiv9 {
position:absolute;
width:331px;
height:97px;
z-index:3;
left: 385px;
top: 1218px;
#apDiv10 {
position:absolute;
width:292px;
height:199px;
z-index:4;
left: 724px;
top: 1218px;
#apDiv11 {
position:absolute;
width:200px;
height:115px;
z-index:1;
body {
background-color: #000;
background-image: url();
text-align: center;
color: #F00;
.none {
font-size: 80px;
font-family: "Times New Roman", Times, serif;
font-weight: bold;
#apDiv12 {
position:absolute;
width:991px;
height:60px;
z-index:5;
left: 198px;
top: 192px;
#apDiv13 {
position:absolute;
width:200px;
height:115px;
z-index:1;
left: 588px;
top: 322px;
</style>
<body onLoad="MM_preloadImages('images/WebConfroll.png','images/youthfootballroll.png','images/ statefbsweatshirt.png')">
<p align="center" class="none"><img src="images/footballtitle.png" width="941" height="183"></p>
<div align="center">
<ul id="MenuBar2" class="MenuBarHorizontal">
<li><a class="MenuBarItemSubmenu" href="#">[Placeholder]</a>
<ul>
<li><a href="#">[Placeholder]</a></li>
<li><a href="#">[Placeholder]</a></li>
<li><a href="#">[Placeholder]</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">[Placeholder]</a>
<ul>
<li><a href="#">[Placeholder]</a></li>
<li><a href="#">[Placeholder]</a></li>
<li><a href="#">[Placeholder]</a></li>
</ul>
</li>
<li><a class="MenuBarItemSubmenu" href="#">Videos</a>
<ul>
<li><a class="MenuBarItemSubmenu" href="#">2008 Videos</a>
<ul>
<li><a href="videos/2009 videos/Glenbard part one/partone.html">Glenbard South Game</a></li>
<li><a href="#">             &# 160;         [Placeholder]</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">2009 Videos</a>
<ul>
<li><a href="#">[Placeholder]</a></li>
<li><a href="#">[Placeholder]</a></li>
</ul>
</li>
<li><a href="#" class="MenuBarItemSubmenu">2010 Videos</a>
<ul>
<li><a href="#">[Placeholder]</a></li>
<li><a href="#">[Placeholder]</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><span class="cent"><img src="images/bulldoghelmit.png" width="150" height="99" /></span></p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p class="cent"> </p>
<div align="center">
<ul id="MenuBar1" class="MenuBarHorizontal">
<li> <a class="MenuBarItemSubmenu" href="#">Football Season 2008</a>
<ul>
<li><a href="http://page.bps101.net/web/t1350/Football2009/2008%20Defense%20Stats.pdf">Defense Stats</a></li>
<li><a href="http://page.bps101.net/web/t1350/Football2009/2008%20Offense%20Stats.pdf">Offense and Records</a></li>
<li><a href="http://page.bps101.net/web/t1350/BHS%20All%20Time%20Stats.pdf">AllTime Data</a></li>
<li><a href="http://page.bps101.net/web/t1350/Football2009/Western%20Sun%202009.pdf">Western Sun Final Standings</a></li>
</ul>
</li>
<li> <a href="#" class="MenuBarItemSubmenu">Football Season 2009</a>
<ul>
<li><a href="http://page.bps101.net/web/t1350/Football%202010/2009%20Banquet%20Record%20and%20Stats.pdf">Defense Stats</a></li>
<li><a href="http://page.bps101.net/web/t1350/Football%202010/2009%20Banquet%20Record%20and%20Stats.pdf">Record Book and Offense</a></li>
<li><a href="http://page.bps101.net/web/t1350/Football%202010/All-Time%20Data%202009.pdf">Alltime Data</a></li>
</ul>
</li>
<li> <a class="MenuBarItemSubmenu" href="#">Football Season 2010</a>
<ul>
<li><a href="http://page.bps101.net/web/t1350/Football%202011/2011%20Checklist.pdf">2010-2011 Offseason Checklist</a></li>
<li><a href="http://page.bps101.net/web/t1350/Football%202011/2010%20Defense%20Stats%20Final.pdf">Defense Stats</a></li>
<li><a href="http://page.bps101.net/web/t1350/Football%202011/2010%20Stats%20Packet.pdf">Record Book and Offense</a></li>
<li><a href="http://page.bps101.net/web/t1350/Football%202011/2010%20ALL%20TIME.pdf">Alltime Data</a></li>
</ul>
</li>
</ul>
</div>
<p align="center"> </p>
<p align="center"> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><img src="images/Batavia Youth football.png" alt="" width="869" height="200" /></p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','images/WebConfroll.png',1)"></a></p>
<div align="center">
<div align="center"></div>
<div align="center"><a href="http://www.athletics2000.com/upstate8/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image7','','images/WebConfroll.png',1)"><img src="images/WebConf.png" name="Image7" width="206" height="194" border="0" id="Image7" /></a><a href="http://www.bataviayouthfootball.org/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','images/statefbsweatshirt.png',1)"><img src="images/statefbsweatshirt.jpg" name="Image6" width="375" height="199" border="0" id="Image6" /></a><a href="http://www.bataviayouthfootball.org/" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image8','','images/youthfootballroll.png',1)"><img src="images/youth football.png" name="Image8" width="329" height="197" border="0" id="Image8" /></a></div>
</div>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image5','','images/youthfootballroll.png',1)"></a></p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"> </p>
<p align="center"><img src="images/Logos.png" width="1167" height="199" /></p>
<script type="text/javascript">
var MenuBar2 = new Spry.Widget.MenuBar("MenuBar2", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
</script>
CSS CODE
@charset "UTF-8";
/* SpryMenuBarHorizontal.css - version 0.6 - Spry Pre-Release 1.6.1 */
/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */
LAYOUT INFORMATION: describes box model, positioning, z-order
/* The outermost container of the Menu Bar, an auto width box with no margin or padding */
ul.MenuBarHorizontal
margin: auto 0;
padding: 0;
list-style-type: none;
font-size: 100%;
cursor: default;
width: 54em;
border-top: thick solid #00F;
border-left: thick solid #00F;
border-right: thick solid #00F;
border-bottom: thick solid #00F;
height: 2.2em;
/* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
ul.MenuBarActive
z-index: 1000;
/* Menu item containers, position children relative to this container and are a fixed width */
ul.MenuBarHorizontal li
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
position: relative;
cursor: pointer;
width: 18em;
float: left;
/* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
ul.MenuBarHorizontal ul
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
z-index: 1020;
cursor: default;
width: 18em;
position: absolute;
left: -1000em;
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
left: auto;
/* Menu item containers are same fixed width as parent */
ul.MenuBarHorizontal ul li
width: 18em;
/* Submenus should appear slightly overlapping to the right (95%) and up (-5%) */
ul.MenuBarHorizontal ul ul
position: absolute;
margin: -5% 0 0 95%;
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
left: auto;
top: 0;
DESIGN INFORMATION: describes color scheme, borders, fonts
/* Submenu containers have borders on all sides */
ul.MenuBarHorizontal ul
border: 1px solid #CCC;
/* Menu items are a light gray block with padding and no text decoration */
ul.MenuBarHorizontal a
display: block;
cursor: pointer;
background-color: #000;
padding: 0.5em 0.75em;
color: #C96;
text-decoration: none;
text-align: center;
height: 1.2em;
/* Menu items that have mouse over or focus have a blue background and white text */
ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
background-color: #900;
color: #009;
/* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
background-color: #900;
color: #FFF;
text-decoration: underline;
SUBMENU INDICATION: styles if there is a submenu under a given menu item
/* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal a.MenuBarItemSubmenu
background-image: url(SpryMenuBarDown.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
color: #FF0;
font-family: "Lucida Console", Monaco, monospace;
/* Menu items that have a submenu have the class designation MenuBarItemSubmenu and are set to use a background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal ul a.MenuBarItemSubmenu
background-image: url(SpryMenuBarRight.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
/* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal a.MenuBarItemSubmenuHover
background-image: url(SpryMenuBarDownHover.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
/* Menu items that are open with submenus have the class designation MenuBarItemSubmenuHover and are set to use a "hover" background image positioned on the far left (95%) and centered vertically (50%) */
ul.MenuBarHorizontal ul a.MenuBarItemSubmenuHover
background-image: url(SpryMenuBarRightHover.gif);
background-repeat: no-repeat;
background-position: 95% 50%;
BROWSER HACKS: the hacks below should not be changed unless you are an expert
/* HACK FOR IE: to make sure the sub menus show above form controls, we underlay each submenu with an iframe */
ul.MenuBarHorizontal iframe
position: absolute;
z-index: 1010;
filter:alpha(opacity:0.1);
/* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
@media screen, projection
ul.MenuBarHorizontal li.MenuBarItemIE
display: inline;
f\loat: left;
background: #FFF;
The website is http://wwww.bataviabulldogfootball.tkNote that running your page through the W3C Validator gives this list of errors: http://validator.w3.org/check?uri=http%3A%2F%2Fwww.bataviabulldogfootball.tk%2F&charset=%2 8detect+automatically%29&doctype=Inline&group=0
I see that you have a very thin doctype at the top. I suggest you create a new page in Dreamweaver and copy the bit at the top of the page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Then put that code in place of these lines from your current page:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
I see that you have two opening <body> tags. Delete one; it is not needed. Add the preload images from the second into the first body tag and delete the second.
I see code below the closing </html> tag. Re position it before the closing </body> tag.
Because of these errors mentioned above, it was impossible to see the page. Fix and reply here when you have done so.
Also, it is not possible for me to divine what difficulty you are having. If you can please also express it in English (LOL), I'll be happy to suggest a correction for you!
Beth
p.s. Posting entire blocks of code is NEVER as helpful as giving us a link to the pages in action. I seldom read through code dumps here in the Forum.
Message was edited by: Zabeth69 -
Problems with a thread that records dvd on suse linux
PLEASE HELP
I am using SuSE linux, and I record dvd+/- RW with the program growisofs.
By command line on the linux shell, growisofs records normally, but when I try to use the same line cone that I use in the shell in a java thread, it never stops recording, I mean, it records all data, but it apparently does not close the dvd session, for the grenn light on the drive never stops blinking, and I have to stop the proccess manually, because it never releases the dvd drive.
I use the thread in a large program, but for debugging this I have made a simple program, whose error is the same.
the code is:
String s = "/usr/local/bin/growisofs -speed=1 -M /dev/dvdram -V MIS27 -A growisofs -P MedImServer " +
" -p MedImServer -sysid Linux -J -R -l -relaxed-filenames -allow-lowercase -allow-multidot /windows/C/online";
Process p;
try {
p = Runtime.getRuntime().exec(s);
p.waitFor();
catch (IOException ex) {
JOptionPane.showMessageDialog(null,"erro no runtime");
System.exit(0);
catch (InterruptedException ex1) {
JOptionPane.showMessageDialog(null,"erro no waitfor");
System.exit(0);
}with JBuilder 9 debug, I realized that it freezes at the moment of "p.waitFor()".
I thought that it was a problem with the recording software, but it is not: the same command line that I use in the program I have used in the Linux shell and it recorded perfectly. The program does not require any user interaction but the command line I wrote before. The problem with the Java program is that it records all data, but never returns from the process. It's not a problem with the software, for it records perfectly when it's not called within the Java program, so I imagine that it is some funny thing in either the Runtime.getRuntime().exec(...) or the p.wait().
Better yet:
Is there a way to record dvds with a java command instead with an exteranal program?
This would be the heaven...
IF it is possible, do it require some sun package?
Thans
TiagoDid you mean like this?
Process p = null;
String s = null;
File f;
try {
f = new File(pathtmp);
f.mkdir();
if(VERBOSE) Log.info(GRAVA_LOG_MARK + "Pasta " + f.getPath() + " criada");
for (Iterator iter = estudos.iterator(); iter.hasNext(); ) {
HashMap item = (HashMap) iter.next();
String id = (String) item.get("id_paciente");
String dt_hr = (String) item.get("dt_hr_estudo");
String estudo = id + "." + dt_hr;
File dir = new File(distriOff.path);
String[] arquivos = dir.list(new FiltroInicio(estudo));
for (int i = 0; i < arquivos.length; i++) {
File src = new File(distriOff.path + arquivos);
File dest = new File(pathtmp + arquivos[i]);
try {
Util.copy(src, dest);
catch (Throwable ex) {
Log.error(mensagem + " " + ex);
prop.enviaMsg(mensagem + " " + ex);
throw new ExcecaoDistribuicao(ExcecaoDistribuicao.ERRO, mensagem + " " + ex);
String os = System.getProperty("os.name");
String modo;
if(midia.getEspaco_disponivel_midia() == midia.getTamanho_midia()) {
//primeira gravagco
modo = "-Z";
else {
//gravagco de novas segues
modo = "-M";
String speed = "-speed=1";
String cmd = "/usr/local/bin/growisofs " + speed + " " + modo + " " + dvdDevice + " "
+" -V " + prop.getIdMidiaAtual() + " -A growisofs -P MedImServer "
+"-p MedImServer -sysid " + os + " -J -R -l -relaxed-filenames -allow-lowercase -allow-multidot " + pathtmp;
p = Runtime.getRuntime().exec(cmd);
p.waitFor();
catch (IOException ex){
Log.error(mensagem + " " + ex);
prop.enviaMsg(mensagem + " " + ex);
throw new ExcecaoDistribuicao(ExcecaoDistribuicao.ERRO, mensagem + " " + ex);
catch (InterruptedException ex) {
Log.error(mensagem + " " + ex);
prop.enviaMsg(mensagem + " " + ex);
throw new ExcecaoDistribuicao(ExcecaoDistribuicao.ERRO, mensagem + " " + ex);
try
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
// Lj saida padrco do comando
while ( (s = stdInput.readLine()) != null)
Log.info(GRAVA_LOG_MARK + s);
catch (IOException ex)
Log.error(mensagem + " " + ex);
prop.enviaMsg(mensagem + " " + ex);
throw new ExcecaoDistribuicao(ExcecaoDistribuicao.ERRO, mensagem + " " + ex);
try
BufferedReader stdErr = new BufferedReader(new InputStreamReader(p.getErrorStream()));
// Lj qualquer erro do comando
while ( (s = stdErr.readLine()) != null) {
Log.info("Processo de Gravagco: " + s);
if((s.indexOf("failed") != -1) || (s.indexOf("error") != -1) || (s.indexOf("unable") != -1)) {
Log.error(mensagem + " " + s);
prop.enviaMsg(mensagem + " " + s);
throw new ExcecaoDistribuicao(ExcecaoDistribuicao.ERRO, mensagem + " " + s);
catch (IOException ex)
Log.error(mensagem + " " + ex);
prop.enviaMsg(mensagem + " " + ex);
throw new ExcecaoDistribuicao(ExcecaoDistribuicao.ERRO, mensagem + " " + ex);
I tried to execute it, and it indeed doesn't freeze, but it doesn't record a thing either...
now it doesn't even wait for the thread, which is VERY weird: it does not record a thing!!! It just passes by the line 'p.waitFor()'...
Any sugestion?
By the way, thanks for helping me...
Tiago -
Hi everyone!!
The situation is this: I have a datable with one of its columns make an h:commanLink, which has two f:params, its actionListener is a function of a ManagedBean. This is JSF, not MyFaces. In IE, When the link is pressed, it shows a javascript error: " 'elements.idVar' is null or it's not an object ", however in Firefox, it works perfectly. I have been looking for the problem and it have to do with this:
</form><a href="# onclick="clearFormHiddenParams_formResultado('formResultado');document.forms['formResultado'['formResultado:_idcl'].value='formResultado:dtTablaResultados:0:_id10';document.forms['formResultado']['idVar'].value='37';document.forms['formResultado']['idMun'].value='168'; document.forms['formResultado'].submit(); return false;"><span id="formResultado:dtTablaResultados:0:itColumna3" title="AREA COSECHADA EN CULTIVOS PERMANENTES">1,230</span></a></td>
</tr>
<tr class="standardTable_Row2">
<td><span id="formResultado:dtTablaResultados:1:itColumna1" style="text-align:center;" title="Código Municipio">718</span></td>
<td><a href="javascript:void(0)" onclick="javascript:window.opener.opener.showLink('SASAIMA')"><span id="formResultado:dtTablaResultados:1:itColumna2_l" title="Municipio">SASAIMA</span></a></td>
<td><form id="formResultado:dtTablaResultados:1:_id9" method="post" action="/ConsultaEstadisticasGeo/resultadoConsulta.jsf" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="com.sun.faces.VIEW" id="com.sun.faces.VIEW" value="_id39:_id41" /><input type="hidden" name="formResultado:dtTablaResultados:1:_id9" value="formResultado:dtTablaResultados:1:_id9" /><input type="hidden" name="idVar" /><input type="hidden" name="idMun" /><input type="hidden" name="formResultado:_idcl" />
<script type="text/javascript">
<!--
function clearFormHiddenParams_formResultado_dtTablaResultados_1__id9(curFormName) {
var curForm = document.forms[curFormName];
curForm.elements['idVar'].value = null;
curForm.elements['idMun'].value = null;
curForm.elements['formResultado:_idcl'].value = null;
//-->
</script>
the way JSF manage the params. The error, acdording to the message shonw by IE is in this line: curForm.elements['idVar'].value = null;
The code of the JSP is this:
<h:commandLink actionListener="#{consultaEstadisticasMB.detalleEstadistica}">
<f:param name="idVar" value="#{consultaEstadisticasMB.idColumna3}" id="idVar" />
<f:param name="idMun" value="#{registro[0]}" id="idMun" />
<h:outputText title="#{consultaEstadisticasMB.columna3}" id="itColumna3" value="#{registro[2]}" />
</h:commandLink>
Waht can i do? (Not using MyFaces, because I can�t do that)
Thanks for your answers!!I have run into this same problem with javascript and the colon. I am not sure if the colon is a valid character for a javascript identifier (one would think the RI developers would have checked it out though!?!).
Anyway, my workaround is to search through the Javascript DOM for the widget you want to obtain a reference to, using part of its id. After all, you know its id, you just can't use it as a javascript reference. In your Javascript code, do something like:
var inputWidgets = document.getElementsByTagName("input");
var targetInput;
for(var i = 0; i < inputWidgets.length; i++)
var inputId = inputWidgets.id;
if(inputId.indexOf("yourInputId") != -1)
targetInput = inputWidgets[i];
break;
It's a lot of effort to just get a reference to a form widget....but it works (I pasted in the code and changed it a bit, so it might not work as is, but at least it demonstrates the idea). -
Strange Problem with a Vector wraped inside a Hashtable
Hi all ,
I'm having a strange problem with a Vector wraped within a Hashtable inherited Class.
My goal is to keep the order of the elements of the Hashtable so what I did was to extend Hashtable and wrap a Vector Inside of it.
Here is what it looks like :
package somepackage.util;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
public class OrderedHashTable extends Hashtable {
private Vector index;
/** Creates a new instance of OrderedHashTable */
public OrderedHashTable() {
this.index = new Vector();
//adds a key pair value to the HashTable and adds the key at the end of the index Vector
public synchronized Object put(Object key,Object value){
index.addElement(key);
Object obj = super.put(key,value);
System.out.println("inside OrderedHashTable Put method index size = " + index.size());
return obj;
public synchronized Object remove(Object key){
int indx = index.indexOf(key);
index.removeElementAt(indx);
Object obj = super.remove(key);
return obj;
public synchronized Enumeration getOrderedEnumeration(){
return index.elements();
public synchronized Object getByIndex(int indexValue){
Object obj1 = index.elementAt(indexValue);
Object obj2 = super.get(obj1);
return obj2;
public synchronized int indexOf(Object key){
return index.indexOf(key);
public synchronized int getIndexSize() {
return index.size();
}Everything seemed to work fine util I tried to add objects using a "for" loop such as this one :
private synchronized void testOrderedHashTable(){
OrderedHashTable test = new OrderedHashTable();
for (int i = 1 ; i<15; i++){
System.out.println("adding Object No " + i);
String s = new String("string number = "+i);
test.put(new Integer(i),s);
System.out.println("-----------------------------------");
//try to list the objects
Enumeration e = test.getOrderedEnumeration();
while (e.hasMoreElements()){
Integer intObj = (Integer) e.nextElement();
System.out.println("nextObject Number = "+ intObj);
}Here is the console output :
Generic/JSR179: adding Object No 1
Generic/JSR179: inside OrderedHashTable Put method index size = 1
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 2
Generic/JSR179: inside OrderedHashTable Put method index size = 2
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 3
Generic/JSR179: inside OrderedHashTable Put method index size = 3
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 4
Generic/JSR179: inside OrderedHashTable Put method index size = 4
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 5
Generic/JSR179: inside OrderedHashTable Put method index size = 5
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 6
Generic/JSR179: inside OrderedHashTable Put method index size = 6
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 7
Generic/JSR179: inside OrderedHashTable Put method index size = 7
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 8
Generic/JSR179: inside OrderedHashTable Put method index size = 8
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 9
Generic/JSR179: inside OrderedHashTable Put method index size = 10
Generic/JSR179: inside OrderedHashTable Put method index size = 10
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 10
Generic/JSR179: inside OrderedHashTable Put method index size = 11
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 11
Generic/JSR179: inside OrderedHashTable Put method index size = 12
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 12
Generic/JSR179: inside OrderedHashTable Put method index size = 13
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 13
Generic/JSR179: inside OrderedHashTable Put method index size = 14
Generic/JSR179: -----------------------------------
Generic/JSR179: adding Object No 14
Generic/JSR179: inside OrderedHashTable Put method index size = 15
Generic/JSR179: -----------------------------------
Generic/JSR179: nextObject Number = 1
Generic/JSR179: nextObject Number = 2
Generic/JSR179: nextObject Number = 3
Generic/JSR179: nextObject Number = 4
Generic/JSR179: nextObject Number = 5
Generic/JSR179: nextObject Number = 6
Generic/JSR179: nextObject Number = 7
Generic/JSR179: nextObject Number = 8
Generic/JSR179: nextObject Number = 9
Generic/JSR179: nextObject Number = 9
Generic/JSR179: nextObject Number = 10
Generic/JSR179: nextObject Number = 11
Generic/JSR179: nextObject Number = 12
Generic/JSR179: nextObject Number = 13
Generic/JSR179: nextObject Number = 14
You can notice that the output seems correct until the insertion of object 9.
At this point the vector size should be 9 and the output says it is 10 elements long ...
In the final check you can notice the 9 was inserted twice ...
I think the problem has something to do with the automatic resizing of the vector but I'm not really sure. Mybe the resizing is done in a separate thread and the new insertion occurs before the vector is resized ... this is my best guess ...
I also tested this in a pure J2SE evironment and I don't have the same strange behavior
Can anybody tell me what I am doing wrong or how I could avoid this problem ?
Thanks a lot !
Cheers AlexAm i doing anything wrong?Uhm, yes. Read the API doc for addElement() and for addAll()
-
Problems with loading Classes from a Directory of a jar file.
Hi Guys,
i have a problem with my programm. It works greatly in my eclipse platform. but there are all classes in my default folder. I want to add a plugin function now. My Abstract classes are in in my default folder and my doughter classes are in my plugin-folder called plugin.
I look what is in the pluginfolder -> all my doughter classes. but i every time get a Class Cast Exception and an ClassNotFoundException.
How can i do that ? Current i do it with Class.forName(frames.substring(0,frames[i].indexOf(".class")));
best regards flohttp://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html
-
Problems with JApplet, jar-Archive, packages and IE5
Hello!
I have a problem with a JApplet and Internet Explorer 5. I made a jar archive of my classes. The classes are
members of a package. The jar archive also contains images.
The structure of the archive:
com/mycomp/myapp/DemoApplication.class
com/mycomp/myapp/DemoApplet.class
<more classes>
com/mycomp/myapp/images/hp_logo.gif
com/mycomp/myapp/images/test.gif
<more images>
The archive is stored locally in a directory which contains also the html file.
I used the sdk 1.3.1 to compile the classes.
My problem: when I start the html file on NT with IE5, I get the error message below:
I try to create a label containing an icon with:
topLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("images"+fs+"hp_logo.gif")));It works on Sun with Netscape 4.67 and SDK 1.3.1 installed.
Should I move the images directory inside the jar archive to another place or is the html code not correct?
The error message:
java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at com.mycomp.myapp.DemoApplication.initComponents(DemoApplication.java:158)
at com.mycomp.myapp.DemoApplication.<init>(DemoApplication.java:55)
at com.mycomp.myapp.DemoApplet.<init>(DemoApplet.java:24)
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)The html file:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>DemoApplet</title>
</head>
<body>
<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#37a1a7">
<h1>DemoApplet</h1>
<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->
<SCRIPT LANGUAGE="JavaScript"><!--
var _info = navigator.userAgent; var _ns = false; var _ns6 = false;
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
//--></SCRIPT>
<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0)));
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
//--></SCRIPT></COMMENT>
<SCRIPT LANGUAGE="JavaScript"><!--
if (_ie == true) document.writeln('<OBJECT classid="clsid:CAFEEFAC-0013-0001-0000-ABCDEFFEDCBA" WIDTH = 695 HEIGHT = 525 codebase="http://java.sun.com/products/plugin/1.3.1/jinstall-131-win32.cab#Version=1,3,1,0"><NOEMBED><XMP>');
else if (_ns == true && _ns6 == false) document.writeln('<EMBED type="application/x-java-applet;jpi-version=1.3.1" CODE = com.mycomp.myapp.DemoApplet CODEBASE = "." ARCHIVE = "DemoApplet.jar,classes12.zip" WIDTH = 800 HEIGHT = 600 scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3.1/plugin-install.html"><NOEMBED><XMP>');
//--></SCRIPT>
<APPLET CODE = com.mycomp.myapp.DemoApplet CODEBASE = "." ARCHIVE = "DemoApplet.jar,classes12.zip" WIDTH = 695 HEIGHT = 525></XMP>
<PARAM NAME = CODE VALUE = com.mycomp.myapp.DemoApplet >
<PARAM NAME = CODEBASE VALUE = "." >
<PARAM NAME = ARCHIVE VALUE = "DemoApplet.jar,classes12.zip" >
<PARAM NAME="type" VALUE="application/x-java-applet;jpi-version=1.3.1">
<PARAM NAME="scriptable" VALUE="false">
</APPLET>
</NOEMBED></EMBED></OBJECT>
<!--
<APPLET CODE = DemoApplet CODEBASE = "." ARCHIVE = "DemoApplet.jar,classes12.zip" WIDTH = 695 HEIGHT = 525>
</APPLET>
-->
<!--"END_CONVERTED_APPLET"-->
</body>
</html>Thank you for your help!
Gruesse,
Torstenseems like it couldn't find the image file... try to give it the absolute path to the file first to see if this is the root of the problem... and then try to find alternative ways to not give it the absolute path...
-
Problem with xmllistcollection
Hi
I am new in Flex programming world. I am facing the problem with xmllistcollection which is bind to datagrid. Please help me
I have created the custom componet. In this custom datagrid component a column having combobox. the problem aries when there
are two duplicate rows and if i change the value of one row's combobox value then another duplicate row's combobox value is autometically
changed.
as i have attached the images.image 1 shows initial stage and image2 shows when i changed 5 row's combobox value then 8th rows combobox
value is autometically changed.
this is the code for change of combox value. commented code shows what i have tried right now
public function DropDownEvent(evt:ListEvent):void
var xmlvalues:XMLListCollection= DataGrid(_listData.owner).dataProvider as XMLListCollection;
//var xmlListval:XMLList= xmlvalues.source as XMLList;
// XMLNotifier.getInstance().unwatchXML(xmlListval,);
xmlvalues[_listData.rowIndex][_listData.dataField]=evt.target.selectedItem;
// var xml:XML=xmlvalues.getItemAt(_listData.rowIndex) as XML;
// var strval:String=xml.toString();
// var lval:int= strval.indexOf(_listData.dataField);
// var lvalLength:int=_listData.dataField.length+lval+1;
// var str1:String=strval.substr(0,lvalLength);
// var lval2:int=strval.indexOf("</",lvalLength);
// str1=str1+evt.target.selectedItem+" "+strval.substr(lval2);
// var xmlNew:XML=new XML(str1);
// xmlvalues.removeItemAt(_listData.rowIndex);
// xmlvalues.addItemAt(xmlNew,_listData.rowIndex);
//Alert.show(xmlvalues[_listData.rowIndex].toString());
// evt.target.data[_listData.dataField]=evt.target.selectedItem;the problem seems to be due to watchxml notification function, which every time call when i try to change in the xmllistcollection. there may be the solution unwatchxml. but how to use unwatchxml in my code and what will be the notification function to remove ?
please help ! -
Strange problem with connection to Integrator Server
Hi,
I have a strange problem with making a connection to my Integrator Server.
I have one workspace folder that I share between Integrator version 2.4 and 3.0 (I have several versions installed for testing purposes)
When I try to create a new Integrator Server Project in Integrator Designer I get this nice 'Connect to CloverETL Server' panel.
By default: the connection URL is http://localhost:8080/clover. So by default Integrator Designer wants to connect to my 2.4 Integrator Server.
When I change this to http://localhost:8301/clover by using the drop-down box and fill in my credentials everything is looking fine. I click Next.
The problem now is that every time I switch to the next or previous configuration windows the connection is reset to the default http://localhost:8080/clover.
So it seems like Integrator Designer resets the CloverETL Server URL each time I switch to a different configuration window by using NEXT or BACK.
The problem occurs in both versions of Integrator Designer.
Does anybody know that the problem is? Can I change the default URL to my 3.0 Integrator Server?
Greetings,
Marcow
Edited by: Marco Snels (AortaBI)(NL) on 31-mei-2013 4:59I'm using iPlanet App server as well and experiencing similar problem. I load my SQL Server driver by Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"), then use DriverManager.getDriver() to obtain the Driver.
However, the Driver returned is not the SQLServerDriver as expected. The Driver returned is com.netscape.server.jdbc.Driver! And then when I do Driver.getConnection("jdbc:microsoft:sqlserver://MyServer"), it throws an SQLException saying that it doesn't accept a jdbc:microsoft:sqlserver subprotocol. Well, of course it doesn't, it's not a microsoft Driver at all.
I suspect the problem is that the netscape Driver's acceptsURL() method ALWAYS returns true in iPlanet app server, thus when you getDriver(), the netscape Driver is always returned (and always returned as the first one since it's default?). Thus even though the same piece of code works fine as a standalone application, it just doesn't work on iPlanet app server.
My work around is:
Class.forName("my.Driver");
Enumeration enu = DriverManager.getDrivers();
Driver useThis = null;
while (enu.hasMoreElements()) {
Driver d = (Driver)enu.nextElement();
if (d.getClass().toString().indexOf("my.Driver") > -1) {
useThis = d;
Mind that my above code does not have an performance issue. If you look into the source code of how DriverManager get a Driver for a particular URL, it also loads the whole set of available Drivers, then call acceptsURL() method on each of them to find the first "suitable" one. Thus time complexity is the same.
I know this is not a very elegant solution and it defeats the purpose of having a DriverManager. Does any one else has a better way to solve this problem, like a way to specify the priority of each Driver so that SQLServerDriver is returned before the netscape Driver?
Thanks a lot. -
SSM 7.5 SP10 Problem with IE9
Hi Experts,
I got one problem with IE9. Let see what the error occur.
1. Click on <Add Initiative>
2. Click on <Calendar Button on Start*> ([http://1.bp.blogspot.com/-cHhGF6VetRU/Ty9P7nviUsI/AAAAAAAAAAM/9orLRDopwSE/s1600/Untitled.jpg])
3. Get Error ([http://1.bp.blogspot.com/-SJn4azyfoXY/Ty9P9LiCYXI/AAAAAAAAAAU/UhUrL412vxo/s1600/Error.jpg])
Appreciate for your help.
Regards,
Sokkorn CheavI also got that:
Error message Can't execute code from a freed script
URL https://server/strategy/pilotworks/sccalendar2.htm
Line #33
Edit the file \usr\sap\SSD\J00\j2ee\cluster\apps\sap.com\xappscpmsm~strategymanagement\servlet_jsp\strategy\root\pilotworks\sccalendar2.htm
Insert this in the 30th line:
CurrentDate = new Date(CurrentDate)
And you get something like this:
if (self.location.href.indexOf("Type=Double1") != -1)
CurrentDate = parent.FromDate
else if (self.location.href.indexOf("Type=Double2") != -1)
CurrentDate = parent.ToDate
else
CurrentDate = parent.CurrentDate
CurrentDate = new Date(CurrentDate)
// get same date in the previous year
var PreviousYear = new Date(CurrentDate)
PreviousYear.setFullYear(PreviousYear.getFullYear() - 1)
if (PreviousYear.getDate() != CurrentDate.getDate())
PreviousYear.setDate(0)
Hope this helps. -
I am writing a mobile client that makes an HTTP Connection and performs a POST to the a Web Services Server. The WS is running .NET. My client works as it should running on all the emulators out there, however, I�m having a problem with an actual device. Then the InputStream is returned but the HTTPConnection.getLength returns >= 0. So I had to make a patch to read the InputStream in chunks and then discard the header section. This results in an �Unexpected End of Input Stream� Exception. Is this going to be a problem with other devices then the one I tested with: The Audiovox SMT-5600? I contacted the vendor but they won�t give any help on outside issues. The headers are getting mixed in with the stream returned. This does not happen on the emulator, the emulator filters out the headers and returns the length of the SOAP message. Here is the following code I have tried to correct this problem. If anyone has run into this issues and can give me some instruction on how to work around this problem I would appreciate it a lot. Thank you in advance!
int length = 0;
HttpConnection hc = null;
OutputStream out = null;
DataInputStream in = null;
hc = (HttpConnection)Connector.open(SOAP_SERIVCE_URL);
hc.setRequestMethod(HttpConnection.POST);
hc.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
hc.setRequestProperty("Content-Length", Integer.toString(soapMessage.length()));
hc.setRequestProperty("SOAPAction","\"" + soapAction + "\"");
out = hc.openOutputStream();
out.write(soapMessage.getBytes());
in = hc.openDataInputStream();
length = (int)hc.getLength();
byte[] data = new byte[(int)length];
in.read(data);
This does not work because the length is not being returned. I have also tried this:
int length = 0;
HttpConnection hc = null;
OutputStream out = null;
DataInputStream in = null;
hc = (HttpConnection)Connector.open(SOAP_SERIVCE_URL);
hc.setRequestMethod(HttpConnection.POST);
hc.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
hc.setRequestProperty("Content-Length", Integer.toString(soapMessage.length()));
hc.setRequestProperty("SOAPAction","\"" + soapAction + "\"");
out = hc.openOutputStream();
out.write(soapMessage.getBytes());
in = hc.openDataInputStream();
length = (int)hc.getLength();
if (length <= 0) {
String contentLength = hc.getRequestProperty("Content-Length");
length = Integer.parseInt(contentLength);
byte[] data = new byte[(int)length];
in.read(data);
This works but since the HTTP Headers are in the input stream and not filtered out I don't get the whole SOAP Message. I tried to read the input stream in chunks:
int length = 0;
HttpConnection hc = null;
OutputStream out = null;
DataInputStream in = null;
String response;
hc = (HttpConnection)Connector.open(SOAP_SERIVCE_URL);
hc.setRequestMethod(HttpConnection.POST);
hc.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
hc.setRequestProperty("Content-Length", Integer.toString(soapMessage.length()));
hc.setRequestProperty("SOAPAction","\"" + soapAction + "\"");
out = hc.openOutputStream();
out.write(soapMessage.getBytes());
in = hc.openDataInputStream();
length = (int)hc.getLength();
if (length > 0) {
gs.setPositionStr("length > 0");
int actual = 0;
int bytesread = 0 ;
byte[] data = new byte[length];
in.readFully(data);
response = new String(data);
} else {
int chunkSize = 512;
int index = 0;
int readLength = 0;
byte[] data = new byte[chunkSize];
do {
if (data.length < index + chunkSize) {
byte[] newData = new byte[index + chunkSize];
System.arraycopy(data, 0, newData, 0, data.length);
data = newData;
readLength = in.read(data, index, chunkSize);
index += readLength;
} while (readLength == chunkSize);
length = index;
response = new String(data);
response = response.substring(response.indexOf("<?xml") -1); //remove the HTTP headers from the SOAP envelope
This methods gets into the else block because there is no length specified, but it throws an 'Unexpected End of Input Stream' exception. Looking at the response string only a portion of the input stream was read.Think simple! A query to the "Content-Length" won't work if the response is chunked (and it probably is). That's why getLength will return 0.
Solution is much simpler that sun does in the javadocs example codes:
int BUFFERSIZE=128;
ByteArrayOutputStream bout = new ByteArrayOutputStream();
byte[] buffer = new byte[BUFFERSIZE]
int bs = 0;
while((bs = in.read(buffer,0,buffer.length)!= -1){
bout.write(buffer,0,bs);
String response = bout.toString();It is always fast, simple, and short :) no if/else crap. Forget the length, and just read until end of stream and convert to String.
Maybe you are looking for
-
Is there a way to turn on Private Browsing so that it stays on all the time? After I close Safari down I always have to turn it on again the next time I open Safari up. I looked in Preferences, but couldn't find anything.
-
I am currently struggling to udate OSX mountain lion to 10.8.4, it constantly tells me that an update is available and a restart is required. Please could someone help?
-
Need to group & sum items & sub items into one record
I'm having an issue creating a report that can group & sum similar items together (I know in some ways, the requirement doesn't make sense, but it's what the client wants). I have a table of items (i.e. products). In some cases, items can be compone
-
Reporting the Same Score Regardless of Right/Wrong
Hi everyone, This is a very odd request...my client, for some reason, wants to report the same score for the quiz regardless of whether it's right or wrong. So, if the learner gets the correct answer, they get 1 point. If they get it wrong (even afte
-
WDClientUser.getCurrentUser() doesn't return getClientUserID()
Hi, i'm trying to get the User-ID of the current user in a webdynpro application. There's no Portal or any other security API installed. the WD-application is marked for authorization and the user has to log-on, when starting the application. The Pro