Problem with forward reference
Java requires that the declaration of a field must occur before its usage in any initializer expression, if the field is used on the right-hand side of an assignment in the initializer expression
class NonStaticInitializers {
int sqSide = height = 20;
int height;
}'height' is used first and declared later how the above initialization is permitted?
I guess that class attributes are first alldeclared,
then initialized...
should be somewhere in the JLS...see section 8.3.2 of the JLS... I didn't bother to
read it though... it's friday afternoon, dammit ! ^_^... and I'm bored...
The declaration of a member needs to appear before it is used only if the
member is an instance (respectively static) field of a class or interface C and all
of the following conditions hold:
� The usage occurs in an instance (respectively static) variable initializer of C
or in an instance (respectively static) initializer of C.
� The usage is not on the left hand side of an assignment.
� C is the innermost class or interface enclosing the usage.
A compile-time error occurs if any of the three requirements above are not
met.
Similar Messages
-
Problem with Assign reference document.
Hi all,
I defined transaction input parameter type Xml.
I used Reference Document Loader to load document (structure.xml) below.
<?xml version="1.0" encoding="UTF-8"?>
<SO_VALIDATION>
<L4_SO_ID/>
<L4_SOI_NO/>
<PPC_STATUS/>
<PPC_INFO/>
</SO_VALIDATION>
I used menu command Assign Reference Document, to assign above document to transaction input.
I tryed to use this transaction in vs.net application as a web service.
But there is no xml structure in InputParams in web service.
I tryed alot but i did not achieve.
What must i do?
Thanks.cml_bzl,
I'm using version 12.04 and I have not had any problems with assigning reference documents and using .NET.
You should not have to do anyting special to get the transaction inputs to show up in .Net. To map the output I do the following:
1. Create an output transaction variable and assign it's type as XML
2. Using a XML document block to create and XML document for your output transaction variable
3. Assign the XML document as the reference for the output transaction variable.
THis works for me every time. If you change the transaction parameters, make sure you update the web service form the .NET side.
Glenn -
Problem with Type Reference "TYPE' in JCO
Hi All,
I am facing a weard situation when i am creating a custom RFC function module. This FM is called by Java program with JCO. But, if i define the FM parameters with Reference type as 'TYPE', the Java application is not able to get the data. But the same time, if i declare the parameters with 'LIKE', it is working successfully.
Can anybody advise me, why it is behaving differently? Is the problem with JCO which is not able to recognise the 'TYPE' reference or from SAP side?
And, any solution to use 'TYPE' reference successfully?hi Sailesh,
You are right. SAP doesn't recommend the usage of Like in PROGRAMS/REPORTS - mind it, only REPORTS.
But when it comes to RFC enabled FMs, JCo Understands only LIKE. what you had observed is true. LIKE creates a WA and JCo looks into a workarea. TYPE can refer to a pool of variables but your JCo can't differentiate them. So, you use LIKE.
Again, you use LIKE only Remote enabled FMs not in Reports/Programs. so, you may use TYPE as your company remommends in reports but in RFMs, use LIKE.
Hope this cleared.
Regards
Ak.
PS: If my post helped, don't forget the rewards! -
Problem with forward method of jsp
am having problem with the requestDispatcher.forward method in my jsp + wml , the forward method gets executed but the new page is not displayed in the wap browser,
code snippet
small.jsp
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<%@ page language="java" %>
<%@ page contentType="text/vnd.wap.wml; charset=UTF-8" %>
<%@ page import="java.lang.*,java.io.*,java.util.*,java.util.Vector,java.util.Properties "%>
<%
System.out.println("in small");
RequestDispatcher rd = request.getRequestDispatcher("small1.jsp");
rd.forward(request,response);
%>
small1.jsp
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<%@ page language="java" autoFlush="false"%>
<%@ page contentType="text/vnd.wap.wml; charset=UTF-8" %>
<%@ page import="java.net.*,java.lang.*,java.io.*,java.util.*,java.util.Vector,java.util .Properties"%>
<%
String sm = "small1";
System.out.println("in small1");
%>
<wml>
<card id="two">
<p>
<small><%=sm%></small>
</p>
</card>
</wml>
i get the following output in the log
in small
in small1
but i dont get to see the small1.jsp' content , also the response.sendRedirect method works fine ,,
pls give me the soln
Thnk u in advancethank u very for the repl this is the message which i get in the nokia wap browser...
cannot load small1.jsp(HTTP Error 500 Server Error)
and i use IBM WebSphere as the web server....
and i have found that using response.reset in the small2.jsp overcomes this problem but the card title and the anchor tag is not displayed !!!!
what could be this problem? -
Problem with forwarding to new page in jsf
Hi
I am facing a problem. I have a checkbox in my jsp page and 3 submit button. The two button works w r t check box and its woking fine. I am getting problem with the 3rd button. I want to fwd to next page once the button is clicked.
For the check box i am using the method
public String handleCheckbox2ValueChange(ValueChangeEvent valueChangedEvent)
Can anyone help me in this regard. I need to fwd to the next page.
Regards
RupeshThis sounds like a simple JSF navigation that has nothing to do with the checkbox. Read the documentation and tutorials on navigation.
-
i have to implement a few standard APIs. As a part of the implementation I have to provide references to an object I create. Now my underlying code is C++ with JNI used to throw the Java APIs. Problem is JNI now returns different references for the same object and hence my prupose id defeated. Could anyone suggest how this problem can be overcome.
I'm not exactly sure what you're talking about, but it sounds like you may need to look into global references. Look at NewGlobalRef() and DeleteGlobalRef() and see if those help you out.
God bless,
-Toby Reyelts
For all your JNI woes, check out Jace - http://jace.reyelts.com/jace -
Hi,
This is my first post.
I was getting behind on a particular project so my boss asked me to commission a design agency to complete work being done on some prospectuses I started designing.
The agency did their bit and sent the Indesign files back to me but the cross references I create do not work properly. The cross referenced page numbers just wont show.
I have tried copying the text frames to new documents and the cross references work. It's as if someone turned off a switch in that particular document.
There are 13 individual documents in all, each with a minimum of 20 pages, which I intend putting together using the Book panel - so its important the cross references work.
Please see the last lines on pages 2 and 3 of the attached document. the 'please see pageXX' is what I mean. these are pages from the rogue document.
Any help/suggestions will be appreciated.
Thanks
please download the sample indesign file using this dropbox link
http://dl.dropbox.com/u/80149652/sample.zipI don't know exactly what is causing the problem, but I can definitely see it in Story Editor.
In the screen cap below, the story editor windows on the top row are your file, and the bottom row are a new file with your text pasted in and new cross-ref added. Note the differnce in the tags:
I cant find any casue for the difference, and I don't know what the defective tag is all about. I thought perhaps it was related to a third-party x-ref plugin, but I don't see any sign of that, either. I'm stumped, and the pragmatist in my says copy and paste and move on for now, but save a copy for further exploratin when you have time.
And ask the other agency to tell you what they did and if they use any third party plugins. -
URGENT: Problem with lexical reference in query statement!
I am modifying the seeded Receipt Traveler report.
The query I need to modify is the receipts query (Q_RECEIPTS). The entire query statement for this is a lexical reference - &P_SELECT_RECEIPTS. The actual query is being set in the After Parameter Form trigger. I need to add a few columns to the select clause and tables to the from clause. Modifying the query in the trigger alone did not help. I got the error - REP 0498 "selected columns differ from report definition"
=> How do I add these new columns to the report now? Do I need to put them in the initial value of the parameter &P_SELECT_RECEIPTS?
=> I tried modifying P_SELECT_RECEIPTS, but I get a REP 1070 error saying the file cannot be saved.
=> In addition, P_SELECT_RECEIPTS does not have a from clause, which causes a problem for me, but I am wondering how the report was originally saved
Any help with this rather lengthy question will be greatly appreciated.
Thanks,
P.S.
The initial value of &P_SELECT_RECEIPTS is set to:
SELECT rrp.item_id,rrp.organization_id rrp_organization_id,MSI.SEGMENT1||''||MSI.SEGMENT2||''||MSI.SEGMENT3||''||MSI.SEGMENT19||''||MSI.SEGMENT20 C_FLEX_ITEM,MCA.SEGMENT1||''||MCA.SEGMENT2||''||MCA.SEGMENT3||''||MCA.SEGMENT19||''||MCA.SEGMENT20 C_FLEX_CAT,rrp.revision_num,rrp.category_id,rrp.item_description,rrp.un_num,rrp.un_description,rrp.hazard_class,rrp.routing_name,rrp.document_type_code,rrp.document_number,rrp.release_num,rrp.line_num,rrp.buyer_preparer_name,rrp.source_type,rrp.source,rrp.source_unit_of_measure,rrp.vendor_product_num,fnd_date.date_to_canonical(rrp.due_date) due_date,round(rrp.quantity_ordered,:P_qty_precision) quantity_ordered,rrp.note_to_receiver,rrp.pll_note_to_receiver,decode(psp.manual_receipt_num_type,'ALPHANUMERIC',rrp.receipt_num,decode(rtrim(rrp.receipt_num,'0123456789'),NULL,to_number(rrp.receipt_num),rrp.receipt_num)) RECEIPT_NUM,rrp.receipt_unit_of_measure,fnd_date.date_to_canonical(rrp.receipt_date) receipt_date,rrp.receipt_location,rrp.receiver_first_name,rrp.receiver_last_name,rrp.freight_carrier,round(rrp.quantity_received,:P_qty_precision) quantity_received,rrp.primary_quantity parent_primary_quantity,round(rrp.quantity_remaining,:P_qty_precision) quantity_remaining,rrp.shipment_num,rrp.bill_of_lading,rrp.vendor_lot_num,rrp.packing_slip_num,rrp.containers,rrp.receiver_comment,rrp.transaction_type rrp_transaction_type,rrp.transaction_id rrp_transaction_id,rrp.shipment_line_id rrp_shipment_line_id,rrp.shipment_header_id rrp_shipment_header_id,rrp.distribution_id rrp_distribution_id,rrp.po_header_id,rrp.po_line_id,rrp.po_line_location_id,rrp.requisition_header_id,rrp.requisition_line_id,rrp.from_interface rrp_from_interface,rrp.deliver_to_location,rrp.license_plate_numberYou can see the query being bulit within the BUILD_QRECIEPTS Program Unit
-
Problem with find reference and overshooting limits
I have a two axis system set up (with a 7344 and UMI-7764), axis 2 uses a lead screw and the find center VI works properly, axis 1 however has a much longer travel and uses sprockets and cables to move and is therefore less rigid. When attempting to find center, unless I run the axis very slowly, when the carriage hits the forward (or reverse) limit it overshoots the limit (inertia) and when the motor jogs to move off the limit it doesn't move far enough to release the switch and identify the location of the limit.
Is there a way to increase distance that the axis will move to back away from the limit and find its exact location? I would like to use a fairly high velocity to find center because the travel distance of the axis is up to 10 m and it takes quite a while to located center at the speed I am currently using.
ThanksGood morning David,
The Offset Move, in counts, is the function or feature that you are looking for. It is on the Find Reference Settings in MAX, just below the location where the approach velocity is specified. This is under each specific axis inside of the Default Settings. The Offset Move specifies the number of counts the system should move to after the Reference Location is found.
I hope that this information is helpful. If this is not what you are looking for, please post back and I will do my best to answer your questions!
Respectfully,
Jeffrey P.
LabVIEW Product Management
National Instruments -
Problem with GET REFERENCE statement
Hi gurus,
shortly; I need to populate a table whose elements are made as follows:
CODE TYPE MDM_FIELD_CODE (a string, basically)
VALUE TYPE REF TO DATA.
I need to loop over an item table and populate the above sketched table; so I wrote as follows:
LOOP AT lt_item INTO ls_item.
*** MDMSRM_SHORT_DESCRIPTION ***
CLEAR value_pair.
MOVE 'MDMSRM_SHORT_DESCRIPTION' to value_pair-code.
GET REFERENCE OF ls_item-short_desc INTO value_pair-value.
APPEND value_pair TO lt_value_pair.
ENDLOOP.
The problem is: each time the loop is performed, all the VALUE fields already appended have the value of the last iteration.
How can I overcome this problem? Is there a sort of unassignment technique for GET REFERENCE?
Thanks,Had some difficulties in working with field-symbols as I have to reference to a structure which is partly derived from the workarea and partly fixed...
I did as follows, maybe it's not the best solution, however, seems to work:
FIELD-SYMBOLS <item> TYPE zsrm_cat_files_i.
FIELD-SYMBOLS: <minqty> TYPE mdm_gdt_quantity-content.
FIELD-SYMBOLS: <minqty_unit> TYPE MDM_CDT_MEASURE_UNIT_CODE.
FIELD-SYMBOLS: <minqty_struct> TYPE mdm_gdt_quantity.
DATA minimum_qty TYPE REF TO mdm_gdt_quantity
LOOP ... ASSIGNING <item>.
CREATE DATA minimum_qty.
ASSIGN minimum_qty->* TO <minqty_struct>.
ASSIGN COMPONENT 1 OF STRUCTURE <minqty_struct> TO <minqty>.
ASSIGN COMPONENT 2 OF STRUCTURE <minqty_struct> TO <minqty_unit>.
<minqty> = <item>-min_qty.
<minqty_unit> = '$$$'.
GET REFERENCE OF <minqty_struct> INTO value_pair-value.
APPEND value_pair TO lt_value_pair. -
Hey,
I have a "Window" class wich extends JFrame and then creates a tabbedPane. In each of the tabs it's necessary to access to another class (Code).
Each of the tabs follows something like this:
public class Tab1 extends JPanel {
private Code code;
public Tab1 ( Code c ) {
code = c;
}When the tabs are created they receive the Code object.
The Code object declared in the main class and passed into the "Window" class (still a null reference) and then to each of the tabs (null). The instantiation of the Code object is done in one of the tabs. The Other tabs need it to set some values.
The problem is the tab that instantiates the Code object is doing so, however the other tabs don't get the new instance (it's always null). Although it's always the same reference.
Any ideas?
Thanks.It looks like setting the Code is something the Window object will
have to help with.//in Window (assuming Tab is a superclass of Tab1 Tab2
Tab[] tabArr = {new Tab1(null, this), new Tab2(null, this)};
void setCode(Code c) {
for(Tab tab :tabArr) tab.setCode(c);
//then the Tabs look like
public class Tab1 extends Tab { // or extends JPanel implements Tab
private Code code;
private Window wind
public Tab1( Code c, Window w ) {
code = c;
wind = w;
void setCode(Code c) {
code = c;
void someEventPerformed() {
Code c = null;
// figure out what flavour of Code the user wants
switch ( userOption ) {
case 0:
code = new Code1 ();
break;
case 1:
code = new CodeY ();
break;
// and have the Window tell all the Tabs to use it
wind.setCode(c);
} -
Problem with forwarding forms that are partially filled out
Problem/Issue
Our users use a third party content app (Airwatch SCL) to select a PDF form. They hold down and select open into Adobe Reader. The form opens in Adobe Reader - no issues
Fill out a form, forward it with comments to a second person, who also needs to add content. Person receives a blank (original) form.
The specific behavior only happens when a form is opened into Adobe Reader (not from Adobe Reader)
Workaround
Open form from AirWatch SCL into Adobe Reader
Click < Documents
Click on any other document (stupid but trust me)
Click < Documents
Click on the document you originally wanted to edit
Make changes
Send it to next person as Original Copy
If the form needs to be edited up the chain, such as a check request form, instead of sending “flattened” copy, send “original” and it can be re-edited and re-forwarded if you follow the steps above.
Is there a way to open into and get the sane behavior as when you open it directly in Reader?Same exact thing happens when tapping down on a PDF in an email message and opening into Adobe Reader...that is why we know it isn't the Airwatch Secure Content Locker app.
I can attach one of the files but I cannot figure out how to upload it. Is there an address to email it to?
it happens with any PDF form.
Thanks
Al -
PROBLEM WITH FORWARDING ALL - SIP TRUNK
Hello,
I'm experiencing the following problem:
I have this scenario: PSTN - SIP GW - CUCM6.1 - SIP TRUNK - CUM8.6
Phone A (extension 33476761834) is registered on CUCM8.6, with external forwarding to the PSTN.
If someone from CUCM8.6 calls - it works.
If someone from CUCM6.1 or from PSTN calls - fast busy. Error in CUCM traces:
19:20:47.056 |//SIP/SIPTcp/wait_SdlSPISignal: Outgoing SIP TCP message to 145.245.235.201 on port 36615 index 3295
[1925279,NET]
SIP/2.0 500 Internal Server Error
Via: SIP/2.0/TCP 145.245.235.201:5100;branch=z9hG4bK3744a3159aed8f
From: <sip:[email protected]>;tag=e1d37fe6-cb7b-46e7-a868-6fe81d6bb391-40319184
To: <sip:[email protected]>;tag=907605~2b367b5a-23ed-4193-a18b-e8c2f777615e-62999964
Date: Thu, 26 Sep 2013 17:20:46 GMT
Call-ID: [email protected]
CSeq: 101 INVITE
Allow-Events: presence
Reason: Q.850;cause=100
Content-Length: 0
|2,100,63,1.580442^145.245.235.232^*
Any idea? Thanks a lot!
(Attaching the complete trace).Hi,
Making some tests regarding the problem we saw this:
Oct 1 23:02:22: //-1/xxxxxxxxxxxx/SIP/Msg/ccsipDisplayMsg:
Received:
INVITE sip:[email protected]:5060 SIP/2.0
Date: Tue, 01 Oct 2013 23:02:22 GMT
Allow: INVITE, OPTIONS, INFO, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, PUBLISH
From: <sip:[email protected]>;tag=e1d37fe6-cb7b-46e7-a868-6fe81d6bb391-40468009
Allow-Events: presence
Supported: timer,replaces
Min-SE: 1800
Diversion: " Elodie" " <sip:[email protected]>;reason=unconditional;privacy=off;screen=yes
Remote-Party-ID: <sip:[email protected]>;party=calling;screen=yes;privacy=off
Content-Length: 0
User-Agent: Cisco-CUCM6.1
To: <sip:[email protected]>
Contact:
Expires: 180
Call-ID: [email protected]
Via: SIP/2.0/TCP 145.245.235.201:5060;branch=z9hG4bK3863af2fe80489
CSeq: 101 INVITE
Session-Expires: 1800
Max-Forwards: 67
Oct 1 23:02:22: //350172/5D95E6C38917/SIP/Msg/ccsipDisplayMsg:
Sent:
SIP/2.0 400 Bad Request - 'Malformed CC-Diversion/Diversion/CC-Redirect Header'
Via: SIP/2.0/TCP 145.245.235.201:5060;branch=z9hG4bK3863af2fe80489
From: <sip:[email protected]>;tag=e1d37fe6-cb7b-46e7-a868-6fe81d6bb391-40468009
To: <sip:[email protected]>;tag=DA70FE78-21AE
Call-ID: [email protected]
CSeq: 101 INVITE
Reason: Q.850;cause=100
Content-Length: 0
The problem is because in the redirect header, the comma "," is not a valid parameter so in the alerting name I removed the comma after the surname (i.e. "Elodie, Mary" to "Elodie Mary" and now is working.
We will change the alerting name by the moment and I will also investigate if there is a parameter to just not divert this name because is not needed this info in forwarded calls.
Anyway the problem is solved -
SG300-20 - Problems with Forwarding and Learning MACs until Write
I have an SG300-20 and started having problems a few weeks ago. Primarily the problem is related to rebooting systems, waking systems from sleep, or any other activity such as speed/duplex changes on the host that cause the host NIC to cycle. Regardless of how the host NIC "goes down", when the host NIC "turns up" it shows connected on the host and switch, but the SG300 refuses to learn the MAC. The only remedy seems to be the write command. Immediately after the write command is issued there is delay from 0 to a few seconds, then L2 connectivity returns.
Also, a new problem cropped-up during testing after changing the mode to "route." If I reload the switch it stops forwarding all traffic until a write command is issued.
Anyone see these symptoms and have a solution?
Thanks,
JeffJeff, I can't recreate this.
switch0d8210#set system mode switch
Changing the switch working mode will *delete* the startup configuration file
and reset the device right after that. It is highly recommended that you will
backup it before changing the mode, continue ? (Y/N)[N] Y
switch0d8210#10-Oct-2013 17:19:08 %FILE-I-DELETE: File Delete - file URL flash:/
/startup-config
switch0d8210#reload
You haven't saved your changes. Are you sure you want to continue ? (Y/N)[N] Res
etting local unit
***************** SYSTEM
Boot1 Checksum Test...............................PASS
Boot2 Checksum Test...............................PASS
Flash Image Validation Test.......................PASS
BOOT Software Version 1.3.5.06 Built 21-Jul-2013 15:12:10
Networking device with Marvell ARM CPU core. 128 MByte SDRAM.
I-Cache 16 KB. D-Cache 16 KB. L2 Cache 256 KB. Cache Enabled.
MAC Address : 00:26:0b:0d:82:10.
Autoboot in 2 seconds - press RETURN or Esc. to abort and enter prom.
Preparing to decompress...
100%
Decompressing SW from image-1
100%
OK
Running from RAM...
GPIO ID is 3
Module type is 10
Device ID 0xdff411ab
*** Running SW Ver. 1.3.5.58 Date 10-Oct-2013 Time 17:15:41 ***
HW version is V01
Base Mac address is: 00:26:0b:0d:82:10
Dram size is : 128M bytes
Dram first block size is : 102912K bytes
Dram first PTR is : 0x1780000
Dram second block size is : 4096K bytes
Dram second PTR is : 0x7C00000
Flash size is: 16M
.....10-Oct-2013 17:15:44 %CDB-I-LOADCONFIG: Loading running configuration.
10-Oct-2013 17:15:44 %CDB-I-LOADCONFIG: Loading startup configuration.
Device configuration:
Slot 1 - SG300-28P
Device 0: GT_98DX3025 (AlleyCat)
-- Unit Standalone --
Tapi Version: v1.9.6
Core Version: v1.9.6
10-Oct-2013 17:16:20 %INIT-I-InitCompleted: Initialization task is completed
Detected speed: 115200
10-Oct-2013 17:16:34 %Entity-I-SEND-ENT-CONF-CHANGE-TRAP: entity configuration c
hange trap.
10-Oct-2013 17:16:34 %SNMP-I-CDBITEMSNUM: Number of running configuration items
loaded: 0
10-Oct-2013 17:16:34 %SNMP-I-CDBITEMSNUM: Number of startup configuration items
loaded: 0
The SSH Server is generating a default RSA key.
This may take a few minutes, depending on the key size.
10-Oct-2013 17:16:35 %Environment-I-FAN-STAT-CHNG: FAN# 1 status changed - opera
tional.
The SSH Server is generating a default DSA key.
This may take a few minutes, depending on the key size.
10-Oct-2013 17:17:20 %SYSLOG-N-LOGGING:
The SSH Client is generating a default RSA key.
User Name:cisco
Password:
This may take a few minutes, depending on the key size.e default settings. Please change the passwor
The SSH Client is generating a default DSA key.
d for better protection
This may take a few minutes, depending on the key size.
10-Oct-2013 17:18:16 %SSL-I-SSLCTASK: Starting autogeneration of self-signed cer
Aging time is 300 sec
switchb2
tificate - 1024 bitsitchb29140#wr mem
Generating RSA private key, 1024 bit long modulus Port Type
10-Oct-2013 17:18:24 %SSL-I-SSLCTASK: Autogeneration of self-signed certificate
1 e0:5f:b9:b2:91:40 0
was successfully completed
Generating RSA private key, 1024 bit long modulush mac address-tab
User Name:
press ENTER key to retry authentication
User Name:
Detected speed: 115200
User Name:cisco
Password:*****
Please change your password from the default settings. Please change the passwor
d for better protection of your network. Do you want to change the password (Y/N
)[Y] ?N
switch0d8210#show mac address-table
Aging time is 300 sec
Vlan Mac Address Port Type
1 00:26:0b:0d:82:10 0 self
1 64:31:50:1c:50:d3 gi3 dynamic
1 d0:67:e5:56:14:32 gi2 dynamic
switch0d8210#
-Tom
Please mark answered for helpful posts -
Any help with this program (a bit of a problem with static references)
Can anyone give me any suggestions for fixing this code:
package vivarium;
import javax.swing.JApplet;
import javax.swing.JFrame;
import java.awt.*;
import java.applet.*;
import java.net.*;
public class Render extends java.applet.Applet {
static Animal[] animal_array_world;
public static void main(String s[]) {
JFrame frame = null;
Graphics g = null;
int[][] grassarray = new int[16][16];
createapplet(frame);
Render r = new Render();
r.rendergrass(g, grassarray);
frame.paint(g);
//createcreatures(20);
//live();
public void rendergrass(Graphics g, int[][] array) {
URL codebase = getCodeBase();
java.awt.Image grass = getImage(codebase, "grass.JPG");
java.awt.Image deadgrass = getImage(codebase, "deadgrass.JPG");
for(int i = 0; i < 16; i++)
for(int j = 0; j < 16; j++) {
int y = (i * 16);
int x = (j * 16);
if(array[i][j] == 0) {
drawimage(g, grass, y, x);
else
drawimage(g, deadgrass, y, x);
public void drawimage(Graphics g, java.awt.Image img, int y, int x) {
g.drawImage(img, y, x, this);
public static void createapplet(JFrame frame) {
frame = new JFrame();
frame.setTitle("Kirby's Vivarium Demo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JApplet applet = new RenderApplet();
applet.init();
frame.getContentPane().add(applet);
frame.pack();
frame.setVisible(true);
//this creates an array of creatures
public static void createcreatures(int x) {
animal_array_world = new Animal[x*2];
//this will than act on that
public static void live() {
while(true) {
int i = 0;
while(i != animal_array_world.length - 1) {
animal_array_world.live(animal_array_world);
The problem seems to be with
URL codebase = getCodeBase();
java.awt.Image grass = getImage(codebase, "grass.JPG");
java.awt.Image deadgrass = getImage(codebase, but I do not get how. This is a non-static field, but no matter what I do it seems to complain in some manner. Does anyone have any suggestions? Thanks!Exception in thread "main" java.lang.NullPointerException
at java.applet.Applet.getCodeBase(Unknown Source)
at vivarium.Render.rendergrass(Render.java:29)
at vivarium.Render.main(Render.java:20)I get this despite whether I put the getCodeBase part in a method, the main or the initialization block.
Heres line 29: URL codebase = getCodeBase();This is called within my nonstatic method rendergrass.
And heres line 20: r.rendergrass(g, grassarray);(Where r is a new Render class object)
Maybe you are looking for
-
Hi All, While opening a saved for later notification, we are getting "The selected action is not available. The cause may be related to security. Contact your system administrator to verify your permission level for this action". error. This is a cus
-
Hello Experts, In our project where CRM Web ui is UI technology used, i am displaying list of attachments in one block. WHen i am clicking on these adobe form outputs which are in the form of links, i am getting an error "Output cannot be displayed b
-
Extending Adobe Configurator With Scripts class materials
Here's the class materials from a session I did at Photoshop World: http://www.tranberry.com/panels/ Here's the PDF explaining the materials: http://tinyurl.com/d2wlm7
-
I have used Photoshop Elements 7 for some time with no issues, but have recently encountered a problem with importing photos to it from my Kodak Easyshare Software. In the past, importing has been a breeze, but lately if I am trying to import an albu
-
SD-PP Availability to include the production orders
Dear All, Our client has a production plant which produces for 3 differennt sales departments as below 1) Distriibution 2) Retail 3) KSA The production for each department is done seperately with seperate production orders whcih have seperate MRP Are