When I try to start the swing timer using timer.start(); it just brings up a null pointer exception error that I have no idea how to fix. Am I calling it wrong? I've seen examples of it having the timer.start();  in the actual timer method but I don't know where to put it in my code. Any help would be appreciated!!!! Thank you. import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Scanner; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.Timer;  public class Board extends JPanel {     private Timer timer;     @Override     public void paintComponent(Graphics g)     {         super.paintComponent(g);         g.fillRect(30, 30, 640, 640);//makes a black square         for(int i=30;i&lt;=510; i+=160)//adds white columns         {             for(int j=30; j&lt;=510; j+=160)             {                 g.clearRect(i,  j,  80,  80);             }         }         for(int i=110; i&lt;=590; i+=160)//adds black columns         {             for(int j=110; j&lt;=590; j+=160)             {                 g.clearRect(i, j, 80, 80);             }         }         g.setFont(new Font(&quot;Monospace&quot;, Font.BOLD, 30));         g.setColor(Color.WHITE);         g.drawString(&quot;a&quot;, 85, 660);         g.drawString(&quot;c&quot;, 245, 660);         g.drawString(&quot;e&quot;, 405, 660);         g.drawString(&quot;g&quot;, 565, 660);         g.drawString(&quot;7&quot;, 35, 140);         g.drawString(&quot;5&quot;, 35, 300);         g.drawString(&quot;3&quot;, 35, 460);         g.drawString(&quot;1&quot;, 35, 620);                  g.setColor(Color.BLACK);         g.drawString(&quot;b&quot;, 165, 660);         g.drawString(&quot;d&quot;, 325, 660);         g.drawString(&quot;f&quot;, 485, 660);         g.drawString(&quot;h&quot;, 645, 660);         g.drawString(&quot;8&quot;, 35, 60);         g.drawString(&quot;6&quot;, 35, 220);         g.drawString(&quot;4&quot;, 35, 380);         g.drawString(&quot;2&quot;, 35, 540);         timer.start();     }     public void showX(Graphics g)     {         g.setFont(new Font(&quot;wrongFont&quot;, Font.BOLD, 200));          g.setColor(Color.RED);         g.drawString(&quot;X&quot;, 35, 540);     }     public void boardImage()     {         JFrame frame=new JFrame();         frame.setSize(600, 600);         frame.getContentPane().add(new Board());         frame.setLocationRelativeTo(null);         frame.setBackground(Color.LIGHT_GRAY);         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         frame.setVisible(true);         CoordinateGame game=new CoordinateGame();         frame.addMouseListener(new MouseAdapter()          {             public void mouseClicked(MouseEvent e)              {                 int x=e.getX();                 int y=e.getY();                                  }         });      }     public static void Timer()     {         class TimerListener implements ActionListener         {             int elapsedSeconds = 30;             @Override             public void actionPerformed(ActionEvent evt)             {                 Timer timer = new Timer(1000, new TimerListener());                 elapsedSeconds--;                 System.out.println(&quot;:(&quot;);                 if(elapsedSeconds &lt;= 0){                     timer.stop();                 }             }         }     }      }
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
"At the time" versus "at that time" I've recently embarked on my PhD studies (cancer, structural biology) and have yet to publish. Currently, there are some 200 papers in my name and several thousand under my surname. Because of this, I am considering switching my surname to an old, rare, surname in my family, which is only used by one active researcher.  My question is this: are there any reasonable alternatives that does not include legally changing my name? I personally don't mind changing it, but the old surname happens to be "noble", and may come off as quite pretentious. I would be able to change to another, less pretentious, surname, but in terms of rareness, no alternative comes close.   In short, what are my alternatives? Centering in the \align* environment How to present a vertical multiplication/addition How do I present vertical (columnar) multiplication and addition in LaTeX. Like this:       3 8 4 x     5 6 ---------   2 3 0 4 1 9 2 0 --------- 2 1 5 0 4   I used the "array" environment. But i have right align problem. Any other best ideas? Is there any way to recover deleted files which may have since been overwritten? I deleted lots of files &amp; folders on my laptop and then I put a new files in the same folders. I need to recover the deleted files. I tried a lot of recovery software and I couldn't recover my old files.   I read that if you refill the folders with new files after deleting old ones then I can't recover them again. Is that true?   What should I do? Are there any expressions that describe going from a bad to a worse situation? Are there idioms or expressions in English that describe going from one bad situation to one that's even worse?  I heard "between a rock and hard place" but this describes a dilemma not really a transition. I am looking for an expression that describes someone trying to get out of a bad situation but after much effort, the situation only got worse. Are virtual particles only a fictive tool in equations? There is no "action at a distance" in nature. Attraction of a piece of iron by a magnet, attraction between distant electric charges of opposite sign, have to be mediated by something. The  are proposed as an explanation.  If they have an observable effect, it seems like they must exist. If so, why do we call them virtual? It can't be that they have short lifetimes, as there are short-lived particles (resonances) that we don't call "virtual."  On the other hand, some people say that the so-called virtual particles only exist on paper, or that they are just a technique to help us handle our equations.  So what is the meaning of the word "virtual" here? Do these particles really exist, or not? Broadcom Wireless Drivers unclaimed after installing update 16.04 How can a file be copied? How do I copy a file in Python?  I couldn't find anything under . How should I install HPLIP binary/proprietary plugin/driver for my HP printer or printer+scanner? I don't want to award a bounty if I feel that the user hasn't answered the question in the right fashion. How do I prevent it? EL expressions not evaluated in JSP 80/90s UK children's drama series about an "alien" boy with radio weapon I've been trying to track down a live-action children's TV series (or short story perhaps) from the 1980s or 1990s, probably on CBBC or CITV.  A few people I've spoken to IRL have suggested The Boy from Space or Sky, but I'm pretty sure it's neither as a lot of the details don't seem to match.  The story was set on Earth (possibly England or Wales) and was about an "alien" boy who was being pursued by a group of people, though I don't remember who they were.  Somehow he encountered siblings, a girl and a boy, and made friends with them. I think they lived on a farm with their parents, as I remember quite a large barn or other building, and they hid(?) the boy in a car which was inside or next to this building. He also slept in this car with a dog (which might have been a German shepherd).  The "alien" boy had a portable "radio" (all silver, very 1980s) that repelled his pursuers by emitting a high-pitched sound when he turned a dial on it, and he used it when out and about with the other children whenever they encountered a pursuer. I seem to remember lots of hills and valleys, lots of green.  In the end it turned out he wasn’t really an alien, but a human from the far future. He was pretending to be an alien as he was from 20000 years into the future and humans' appearance had changed by then, but he had the ability to make himself look like current-day humans. When he was in his car/bed he reverted to his normal appearance, so he would hide under the blankets until he was able to assume current-day human appearance.  In the finale, it was revealed that he was never in any danger – the pursuers were testing him as part of a kind of coming-of-age thing. I remember a scene on a spaceship or something where his elders/parents where shown telling him that he was safe all along and that he "passed".  I also seem to remember them referring to "ancestors" and making sure they didn't find out, so the either the girl or boy could well have been a direct ancestor. How is it that questions posted to the Stack Overflow show up as #1 in Google search results just minutes after being submitted? What SEO practices are being used to generate this sort of up-to-the-minute accuracy? Is 2h 45m enough for a layover in Newark Liberty International transferring from an international to a domestic flight (Terminal B → Terminal C)? Splitting lines with points while maintaining other dissolved lines? I am on ArcGIS Desktop 10.2. I have a line feature class of a stream network. I also have a point feature class along the main stream (line) where a catchment enters that stream. I have dissolved my whole streams layer into one line feature and want to split this feature at the points.    However, when I use the  tool, the lines that don't have a point splitting them are still being split at the intersection of two streams.    Why did this line not stay as one feature with the other lines on that side of the splitting node and how can I prevent this from happening? I'm interested in quantum mechanics book that uses high level mathematics (not only the usual functional analysis and the theory of generalised functions but the theory of pseudodifferential operators etc, certainly the modern mathematics). If there isn't something similar please give me a reference to the book that is strictly supported by mathematics (given a set of mathematically descripted axioms author develops the theory using mathematics as a main tool). No sound (speakers/jack) + microphone's dead after spilling water Sadly, yesterday I've spilled some water on my MacBook Pro (El Capitan). Before you yell at me - it was closed, turned off and it wasn't a lot of water, the laptop was wet only on the top and under - not inside.  Today I've turned him on. At first battery wasn't recharging for some reason, but SMC reset fixed the problem.  At the first booting speaker was like talking to me, hard to explain but it was weird. Also only right speaker was "talking", despite the fact that only left side of the laptop was watered. Then there was no sound at all, not from the speakers, nor from the headphones. Also microphone's not working. USB ports are okay. The water was spilled from the left side of the laptop. I know this is hardware issue, and something's broken, but I want to be 100% sure. No it's not muted. I've also tried NVRAM reset a few times, but it doesn't fix the problem :(  There might be one factor, before spilling, my laptop "died" for the first time (battery energy ran off), but I doubt it's the case. (but hey, every info matters, right?)  It wouldn't be weird for me, if only left speaker wouldn't work, but built-in microphone not working is kinda weird in this case, isn't it?  I just want to ask you guys, what else can I check, before I'll be 100% sure it's dead inside?  I've plugged in external microphone - it's not working too. I'm a new Minecrafter, and was wondering if new updates are backwards compatible. Specifically, will the new "Adventure Update" features (Beta 1.8) appear in existing worlds created with Beta 1.7 and earlier? Or will I need to create a new world for this version? When I type uname -a, it gives the following output.  Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux   How can I know from this that the given OS is 32 or 64 bit?  This is useful when writing configure scripts, for example: what architecture am I building for?