Problem: Not able to update swing component from another class.  Objective: When user clicks the update button, the text in "nameLabel" will change to "John Doe".  I attempted the solutions from stackoverflow regarding this issue but had no success.  Here is a very simple example, not sure what I'm doing wrong.  GUI.java  package TestGUI.TestGUI;  import java.awt.BorderLayout;  import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel;  public class GUI {      JLabel nameLabel;     JButton updateButton;     JFrame frame;     JPanel panel;      public void display() {          frame = new JFrame();         panel = new JPanel(new BorderLayout());          frame.setTitle("BlackJack Game");         frame.setVisible(true);         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);         frame.add(panel);           nameLabel = new JLabel("No Name");         updateButton = new JButton("Update");          panel.add(nameLabel,  BorderLayout.NORTH);         panel.add(updateButton,  BorderLayout.SOUTH);          updateButton.addActionListener(new EventListener());     }      public void setNameLabel(String name) {         nameLabel.setText(name);     } }   EventListener.java  package TestGUI.TestGUI;  import java.awt.event.ActionEvent; import java.awt.event.ActionListener;  public class EventListener implements ActionListener {      //private Card card;     private GUI gui;      public EventListener(GUI gui) {         this.gui = gui;     }      public EventListener() {         // TODO Auto-generated constructor stub     }      public void actionPerformed(ActionEvent actionEvent) {          String actionCommand = actionEvent.getActionCommand();          if(actionCommand.equals("Update")) {             gui.setNameLabel("John Doe");         }      } }   App.java  package TestGUI.TestGUI;  public class App  {     public static void main( String[] args )     {         GUI gui = new GUI();          gui.display();     } }   The following error is produced, when the "update" button is clicked.
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?
Why is my camera metering indoor scenes as darker than I expect, forcing me to use a high ISO? I am shooting in natural light, with my subject facing a full floor-to-ceiling south facing window. You would think my meter would allow ISO between 200-400 in bright light, but I was lucky to get it to 640, with f/3.2 and 1/60 (manual mode).  I've read other places that people say put your ISO down to 100 for indoor shots for greatest clarity (especially sharp eyes) — but don't know how I can with subjects potentially moving. Is there a setting in my camera (Canon 5D Mark III) I am missing, or something that might be making my meter need more light? What is this plastic chip packing material called? Given 4 integers, $a, b, c, d > 0$, does $\frac{a}{b} < \frac{c}{d}$ imply $\frac{a}{b} < \frac{a+c}{b+d} < \frac{c}{d}$? My coach said that for all positive integers $n$, $n^4+4^n$ is never a prime number.  So we memorized this for future use in math competition.  But I don't understand why is it? Where $\phi(n)$ is the Euler phi function, how do you find all $n$ such that $\phi(n)|n$? Suppose I have a line segment of length $L$.  I now select two points at random along the segment.  What is the expected value of the distance between the two points, and why? I can't seem to find info on installing a Swedish language package on my machine. The language is not listed  and the hits on Google I got led nowhere (or, rather, to the said page).  Where can I ask such a question (within the realm of Stack Exchange)? This is problem #6 from Section 1.2 of Ash's Real Variables With Basic Metric Space Topology.   I am asked to show that it is impossible to list the rational numbers in increasing order.   While I know it is possible to list a finite subset of the rational numbers in increasing order, I was wondering if the reason for the impossibility in this case is because there is no least element of $\mathbb{Q}$?   I mean, it's possible to impose an ordering on $\mathbb{Q}$ (correct me if I'm wrong, but it seems possible to compare any two rationals).  But the set $\mathbb{Q}$ is of course, a subset of itself, and the Well-Ordering Principle says that a set $S$ is Well-Ordered only if any subset of $S$ contains a minimal element. Since $\mathbb{Q}$ does not contain a minimal element, it does not appear that it is a Well-Ordered set.   Is this the correct idea as to why it's impossible? If not, could somebody explain to me what the correct idea is and a strategy for proving it?  Thank you ahead of time. Does the Symmetric difference operator define a group on the powerset of a set? $G$ is the set of all subsets of a set $A$, under the operation of $\triangle\;$: Symmetric Difference of sets.  $A$ has at least two different elements.  I need to check if this is a group, and if it does to show if the group is abelian and/or finite.  Associativity - easy from Symmetric Difference. Identity element - empty group. Inverse element - each element is inverse to itself. Am I right?  abelian? finite? Don't display pending edit counter if you've exhausted your suggested edit votes I'm trying to get my head around mutable vs immutable objects. Using mutable objects gets a lot of bad press (e.g. returning an array of strings from a method) but I'm having trouble understanding what the negative impacts are of this. What are the best practices around using mutable objects? Should you avoid them whenever possible? What is the method for converting radians to degrees? I run into this occasionally and always forget how to do it.  One of those things that pop up ever so often.  Also, what's the formula to convert angles expressed in radians to degrees and back again? I've lost my portal home, and I am invincible. How can I leave the nether? Preview Breaks with Invalid Tag Name [tag:+] In the formatted preview for Questions &amp; Answers, typing a tag link with an invalid tag name "crashes" the preview. As soon as you type the following the preview stops updating and an error can be observed in the Javascript console.   [tag:+]   Observed in Safari 7 and Chrome 31.   seems related to the business rule of not allowing certain characters in tags, but it sounds like a different bug. says that a photon of  to $10^{-62}$ kg has been detected:     10×10−62 kg   Mass equivalent of the energy of the lightest photon   detected [citation needed]   This equates ($mc^2=E=hf=h\frac{c}{\lambda}$) to a wavelength of $\lambda=2.2\times 10^{20}$ m (roughly a million ly)! Can anyone provide a citation for this measurement? And how can such a large wavelength/low energy photon be detected?  Edit  Apart from the quotation (true/false un/reliable un/documented ....), I'd like to learn about the lightest photon detected, or about the instrumental limit: what is the lower limit of energy that can be registerd by an intrument (or the greatest wavelength), and how it is done? For example, can you detect a radiowave of 1 Hz? Location of parenthesis for auto-executing anonymous JavaScript functions? My current understanding:  $\vdash$ is "syntactic consequence", e.g. if we have $a \vdash b$ it means if we've written down $a$ as something we know, we can immediately write down $b$ as something we know. This is saying nothing about whether any of these pieces are true, false, something else, etc, it's just saying that we can say something about $b$ by virtue of being able to say something about $a$.  $\vDash$ is "semantic consequence", e.g. if we have $a \vDash b$, then it (usually) means if $a$ is always true in every interpretation (i.e. no matter how we mess with any of the underlying variables driving $a$'s valuation), then $b$ is true as well. However I don't know if this is necessarily just a "true"-only thing. It seems conceivable that we could make one for falsehoods too, i.e. if $a \vDash b$ might mean if $a$ is always false then $b$ is always false, of if $a$ is always "dog" then $b$ is always "dog", etc. But I am unsure of this one.  $\to$ is material implication, which exists solely within the logic system (as opposed to the previous two metalogical relations) and has a specific semantic meaning / definition in terms of a truth table in something like prepositional logic ($a \to b$ is always true unless $a$ is true and $b$ is false). It's defined this way simply because it is a helpful / useful model to describe things like "whenever $a$ is true, $b$ is true".  Do I have the right idea so far? The easiest thing to do is [to] call for a taxi Having the derivative be an operator I've noticed in the last couple of days that there have been a few occasions when there's been a sudden surge of questions in the SO "Reopen" review queue.  Normally there's either no questions at all to reopen or at most three or four, and that's still the case, except that for the last couple of days I've gone to the review page and seen about fifty-odd questions in the queue, where just moments before there had been none.  I've gone through the reviews and the questions themselves seem reasonably legitimate (including the occasional audit), so I'm not questioning that... it just seems odd that there would be so many more than usual all of a sudden, and that they'd all appear at once.  Anyone got any insights, or should I just chalk this down as "one of those things"?