Error in code can't find what is wrong
Hello I have this class in my program in my main class I have button and if I press
that button I want the program to do test() from class BeltPanel but only that.
I tried it with this new BeltPanel().test(g);
but then I receive a lot of errors.
What is wrong with the code??
CODE
class BeltPanel extends JPanel
public BeltPanel()
// Code for adding buttons
public void test(Graphics g)
super.paint(g);
g.setColor(Color.white);
g.drawRect(501,32,191,20);
g.setColor(Color.gray);
g.drawRect(500,31,190,20);
progbar.teken(g);
ERRORS
java.lang.NullPointerException
at program.beltableaupack.beltableau$BeltPanel.test(beltableau.java:309)
at program.beltableaupack.beltableau$menu2KnopHandler.actionPerformed(beltableau.java:1072)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)
at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
> java.lang.NullPointerException
at program.beltableaupack.beltableau$BeltPanel.test(beltableau.java:309)
at program.beltableaupack.beltableau$menu2KnopHandler.actionPerformed(beltableau.java:1072)A few remarks:1) where did you get your Graphics object reference from in your
ActionListener? 2) your classes are waay too big (more than 1800 lines ...)
kind regards,
Jos
Similar Messages
-
Help Me , can't find what is wrong :S Simple code
Hello everyone, im'm back =P ...well the problem is : I can't find what's wrong with this code above. The output shoul be "-1" but it prints -4 , it should print the min. value of an array. An absolute value to do that , its simple just do: e.g ( if ( n < 0 ) n = n * -1 ; and then check what is the min. value of the array. I just copied the content of the first array to the second .
damn...what is wrong? :S
public static void main (String[] xxx) {
int [] array = {7,-4,-1,2}
System.out.print( "The shortest number is: "+ minValue(array));
static int minValue(int [] x ) {
int [] newarray = new int [x.length];
int min = mat[0];
for( int i = 0; i !=x.length; ++i) {
if ( i < o) i = i * -1;
else i = i * 1;
newarray[i] = x[i] ;
for (int i = 0; i != mat.length; ++i) {
if ( min > mat[i] ) min = mat;
}return min;
Thanks!!! I realy need your help plz!Almost!!!!! :D
it returns 1 , should return -1 LOLO this is an exercise for practice, because i've the final test tomorrow .
Is the last one , and i'm getting annoying of it :P.
That's why i copied the 1st to the 2� array (but without the signal).
U must ignore the signal when it checks, but it must print the number even if it has the signal . E.g -1 , u check ignoring the signal and the ouput must be: -1
:S -
Mail application keeps shutting down short after start up - resulting in an error message. how can I repair what is wrong without losing my mail history?
Will I lose my emails I have on there? I have numerous client email files and can't afford to lose any of them. I do have everything backed up but I'm fearful of losing important client info. What if something happened during the back up and it doesn't have my files?
-
Bug Error but can't find what's wrong
I have a bug error next to on of my pages. I can't for the life of me find what's wrong. I have gone over every image in the page and they are all, I believe, linked the same as in the other pages but still - the bug won't shoo . When I preview, then things get really wacky. I thought I was on top of it and made some updates and then refreshed my site. Go see - www.juliakuskin.com. If you click on Children and then click on Landscape or Lifestyle, it stays on children... Please help?
-JuliaNate,
I ended up creating a whole new page last night, linking it and posting it. The site now works but I will keep your emails in my file in case I get into this again. Thanks for your help.
-Julia
www.juliakuskin.com
ps - do you think it's a good idea to make the switch over to dreamweaver? -
Can;t find what is wrong. Trying to add elements in two arrays
Hello everyone
I'm trying to take as input two numbers, convert them to arrays and add all the element of the array one by one. I want the result to be the sum of every element of the array. Let's say array1={1,2,3,4} and array2={2,6,4,3} I want the final result to be 3877.
If the sum of one element of the array is greater than nine, then I would put zero and add 1 to the element on the left.
Here is the code:
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
String numberOne = JOptionPane.showInputDialog
("Enter the first number: ");
String numberTwo = JOptionPane.showInputDialog
("Enter the second number: ");
//compare string length and make them equal length
int[]n1 = toArray(numberOne); // my first array
int[]n2 = toArray(numberTwo); // my second array
//call the method that ads both strings
int[]finalArray = arrSum(n1,n2);
JOptionPane.showMessageDialog(null, "The sum of the two numbers is: "
+ finalArray);
}//end of main
//method to create an array from a string
public static int[] toArray(String str)
int[]arr = new int[str.length()];
arr[0]=0;
for (int i=1; i<str.length(); i++)
arr= Character.digit(str.charAt(i),10);
return arr;
}//end of toArray
//method to add arrays by elements
public static int[]arrSum (int[]arr1, int[]arr2){
for (int i = arr1.length-1; i >=1; i--)
int sum = arr1[i] + arr2[i];
if (sum > 9)
{ sum -= 10;
arr1[i-1]++;
return arr1;
}//end of arrSum method
}Edited by: designbc01 on Feb 16, 2010 1:15 AMThe best advice I can give you is to break your problem up into smaller pieces. First, focus on a method that converts an input String into an array. When you have that working perfectly, then focus on creating a method that "adds" two arrays with the logic you described. When you have that working perfectly, then combine the two different pieces.
Why does your for loop in toArray( ) start with 1? The first index of a String, array, or pretty much anything else, is zero. -
After loading Acrobat XI, Facebook pages are blank with errors. Can't find what happened to IE8. XP OS. Any suggestions?
I agree. The Facebook failure must have been coincidental in that machine. I have a notebook that I loaded the same Acrobat into and it's Facebook is OK - It's on Win 7 OS. This laptop's (XP) Facebook works, but it doesn't have the Acrobat loaded into it. Also have a networked desktop for business on Win 2000 and it's Facebook works too. Haven't tried another browser in the suspect machine yet. There's definitely something wrong with it's IE8. What it boils down to in it, is that it won't logout of Facebook properly. I have to logout on some other machine. Then when I login on the bad one, Facebook only partially loads it's pages and I can't logout from it.
-
Error!! Can not find the delivery details for the delivery Id :
hi all,
I have a report which i need to burst in seven different reports wherein my delivery key is column "emp_id". Now when i schedule the report to burst then the report completes with a warning. I see that there are various delivery cycles for the report and for one of the cycles i get the following message
Error!! Can not find the delivery details for the delivery Id :
hence, what happens due to this is, even there are successful deliveries for other delivery ids but then i get only two rows of data in each of the seven bursted ouput xls files. wheareas the data runs in thousands of rows for each cycle.
Hence whats happening is, that due to error /warning in one of the delivery cycles other reports are also not showing data.
I am not sure whats causing the issue and why i am not getting complete bursted files out.
Please suggest
Thanks
RonnyI guess, you are in 10.1.3.3.2 :),
in the latest release 10.1.3.4.1, there are more enhancement wrto bursting and performance i believe.
check th release notes
can you send me the xml and bursting query you have, i can try simulating in my local. -
I've made sure a dozen times that my home page is set correctly, and when I hit the home button next to the search bar it works and takes me right to google BUT whenever i open a new tab i get the error that my page cannot load and the web url that it keeps trying to remember is in the error message:
Firefox can't find the file at chrome://quick_start/content/index.html.
of course the last dot is not the url anymore but the end of the sentence for the error message, but i don't ever use chrome ever on my laptop only my cell so what is going on????? help fix god please!!!!!!Do you have the FastStart extension?
Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
*Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
*Do NOT click the Reset button on the Safe Mode start window
*https://support.mozilla.org/kb/Safe+Mode
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes -
Recently I'm getting an error dialog box on my T530 when I boot it into my OEM installation of Windows 8. The window title bar is "Windows Script Host", and the error message is:
Error on boot: "Can not find script file "C:\ProgramData\Lenovo-20841.vbs".
I pulled up an old backup, and I do have that file, along with a number of other ones that are missing from that directory. I'm attaching a screenshot of the files that are missing. Not sure why they would have been deleted (I know I didn't do it manually). Should I just restore the file? What about the other ones?
Thanks very much.I am getting a different VBS script error than the one listed above.
Does anyone know how I can get this file? or recreate it?
I get a similar message saying that it can't find the file c:\programdata\Lenovo-11472.vbs
Also, my wireless just randomly resets - sometimes very few minutes - after I've been using the system for a while. It's brand new and I can't figure out what's going on. Could this be the issue?
When I restart, it stays stable for a while and then starts acting up again.
Thanks for your help! -
The server deploy EJB but I run EJB Client program,The error msg is can't find JNDI
Hi all:
I am using Weblogic 6.1/SP2. I use the console to start
server and deploy EJB jar,from the msg I see my EJB jar
been deployed. When I run EJB Client program, the error
msg is can't find JNDI name t3://URL:11003.....
I check my ejb-jar.xml amd weblogic-ejb-jar.xml are fine.
Last week I did deploy EJB and ran the client both
suceessful. Any ideas, Thank you.Sabha:
Thank you for your help info, I soloved the problem.
The problem is the ejb jar was deleted(I don't why)
then System Admin to deploy EJB jar from Admin console.
After that everything is fine.
"Sabha" <[email protected]> wrote:
Run weblogic.Admin -url ... LIST to see whether the JNDI name is there
. or
you can view the jndi tree of the server from the console (right click
on
server name) and check whether the ejb home is bound to the correct jndi
name.
-Sabha
"Matthew Shinn" <[email protected]> wrote in message
news:[email protected]..
Hi Albert,
I would double check to make sure the EJB was indeed deployed (check
server log). What message did you see that leads you to believe itwas
successfully deployed? Also, verify the JNDI name you are lookingup in
your client matches the JNDI name for the EJB. If this doesn't solve
the problem, please post the error message and stack trace you are
seeing on the client.
- Matt
Albert Pi wrote:
Hi all:
I am using Weblogic 6.1/SP2. I use the console to start
server and deploy EJB jar,from the msg I see my EJB jar
been deployed. When I run EJB Client program, the error
msg is can't find JNDI name t3://URL:11003.....
I check my ejb-jar.xml amd weblogic-ejb-jar.xml are fine.
Last week I did deploy EJB and ran the client both
suceessful. Any ideas, Thank you. -
How can I find what apple ID I used to register my iMac when I first booted up? I am being told that by using this ID I will be able to go on to the App store and down load iPhoto at no cost. Is this true? My iMac does not have iPhoto resident on it now and I only purchased my new iMac in December 2012
Thanks....Launch Keychain Access and click on Login in the left hand pane and then on Passwords. Next do search for Apple in the search field at the top and click on Apple ID Authenicication in the list that comes up. That will give you the ID no. and password.
OT -
how can I find what the charges aree to my credit card from the apple store? I get multiple charges every month and don't know what they are for...I want to cancel whatever is being charged to me...how do I do it?
Have a look at this link
http://support.apple.com/kb/ht2727 -
HT4910 how can i find what devices are sync to my laptop as mine is saying 5 i dont no why
how can i find what devies are synced with my computer as in itunes says 5 i dont have 5
That information is not available.
De-authorizing Computers (contributed by user John Galt)
You can de-authorize individual computers, but only by using those computers. The only other option is to "de-authorize all" from your iTunes account.
1. Open iTunes on a computer
2. From the Store menu, select "View my Account..."
3. Sign in with your Apple ID and password.
4. Under "Computer Authorizations" select "De-authorize All".
5. Authorize each computer you still have, as you may require.
You may only do this once per year.
After you "de-authorize all" your authorized computers, re-authorize each one as required.
If you have de-authorized all computers and need to do it again, but your year has not elapsed, then contact: Apple - Support - iTunes - Contact Us.
For more information on authorization and de-authorization: iTunes Store- Authorize or deauthorize your Mac or PC. -
The share operation "master file" has failed. the operation could not be completed because an error occurred creating Frame 93164 (error-1). how can i find the frame?
https://discussions.apple.com/thread/6219522
-
I just bought a new iMac and am having troubles downloading creative cloud installer. Its coming up with error 214 - I can't find any solutions for this. Can anyone help me? Im on mac OS 10.9.4
Meg81 error 214 indicates a download data validation error. This means that the update you downloaded became corrupted likely during the download process. I would recommend utilizing the suggestions listed in Error downloading Creative Cloud applications - http://helpx.adobe.com/creative-cloud/kb/error-downloading-cc-apps.html to attempt to improve the stability of your Internet connection.
You can also find information on how to review your download logs which may provide additional information regarding the failure of the download.
Maybe you are looking for
-
What is difference between ADF Task Flow and Faces-Config - when delpoy ?
What is difference between ADF Task Flow and Faces-Config? When I create navigation between pages with ADF task flow then the navigation don't work when I deploy my application to Weblogic 10.3. When I use default server then navigation works fine. W
-
Can I use my time capsule for back ups once in a while and bacicly keep it unpluged
I want to keep my time capsule unpluged and just use it for back ups once in awhile Wil this be possible to do?
-
How to save users added to list using people picker to sharepoint Group
Hi I have created List with some people picker columns and now when I save a list,the data is saved to list as well as the users in particular column will be added to particular sharepoint group. Is there any sharepoint out of box solutio
-
Is there a way to mirror my ipad screen to my macbook pro with just an old fashioned cable? This may sound crazy, but I need to project ipad applications for demonstrations, and I need to be able to do this on corporate networks that don't support mu
-
Is Creative trying to purposely alienate its current customer base? There was a time when I would sing their praises over virtually all other MP3 player manufacturers, but now? No more. Since installing this plays for sure firmware, hundreds of consu