Please note that I am new to programing, thus my code is probably incredibly redundant and hard to read, but I REALLY need help!  Im trying to create a matching game, so that when the user picks two buttons that relate to one another, you get a match! I'm currently trying to get the action listener to work properly, but whenever I run the code every if statement implements and all the buttons turn green.   public class Panel extends JPanel {    int[] num = new int[2];    private JButton movie1;    private JButton movie2;    private JButton movie3;    private JLabel question;   private JButton name1;   private JButton name2;   private JButton name3;    public Panel()   {      ImageIcon movie1pic = new ImageIcon("movie1.jpg");      movie1 = new JButton (movie1pic);      movie1.addActionListener(new ButtonHandler());        ImageIcon movie2pic = new ImageIcon("movie2.png");      movie2 = new JButton (movie2pic);      movie2.addActionListener(new ButtonHandler());        ImageIcon movie3pic = new ImageIcon("movie3.png");      movie3 = new JButton (movie3pic);      movie3.addActionListener(new ButtonHandler());        question = new JLabel ("match");      ImageIcon name1pic = new ImageIcon("name1.png");      name1 = new JButton (name1pic);      name1.addActionListener(new ButtonHandler());       ImageIcon name2pic = new ImageIcon("name2.jpg");      name2 = new JButton (name2pic);      ImageIcon name3pic = new ImageIcon("name3.jpg");      name3 = new JButton (name3pic);      setLayout(new BorderLayout());      JPanel southPanel = new JPanel(new FlowLayout());      JPanel northPanel = new JPanel(new         FlowLayout());      southPanel.add(name1);      southPanel.add(name2);      southPanel.add(name3);      northPanel.add(movie1);      northPanel.add(movie2);      northPanel.add(movie3);      add(question, BorderLayout.CENTER);      add(northPanel, BorderLayout.NORTH);      add(southPanel, BorderLayout.SOUTH);           private class ButtonHandler implements ActionListener      {         public void actionPerformed(ActionEvent e)         {             if ( e.getSource() == "movie1.jpg" );            {               num[0] = 1;               ImageIcon green = new ImageIcon("green.png");               movie1.setIcon(green);            }            if (e.getSource() == "movie2.png");            {               num[0] = 2;               ImageIcon green = new ImageIcon("green.png");               movie2.setIcon(green);            }            else if (e.getSource() =="movie3.png" );            {               num[0] = 3;               ImageIcon green = new ImageIcon("green.png");               movie3.setIcon(green);            }             }      }   }
I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
Zombies are always after human beings. How do Zombies differentiate between a zombie and a human being? Why don't zombies eat each other? How did the Death Star move? In the Star Wars saga, one of the most iconic weapons of the Empire was the Death Star: a self sustained weapons platform the size of a moon, with the capacity to destroy a planet. in A New Hope, we see the first Death Star in close proximity to the planet Alderaan, holding the planet hostage as the Empire tries to deduce the location of the Rebel Alliance's headquarters. In Return of the Jedi, we see the second Death Star in "dry dock" over the forest moon of Endor as it is being constructed.  My question is: How did the Death Star move? I imagine a spherical space station the size of a moon would be utterly massive, requiring a massive amount of thrust to move it. If it was constructed in low orbit of an inhabited planet/moon, the gravitational field would be immense, consisting of the planet/moon's gravity, and the Death Star's own considerable gravity. Breaking that gravitational field would be a massive task, yet we see no thrusters or engines on either Death Star. Were they hidden, stored under the station's surface while not in use? Was the station towed by another vessel? Difference between pts and tty Possible Duplicate:          I always see pts and tty when I use the who command but I never understand how they are different? Can somebody please explain me this? How to prove that for all natural numbers, $4^n > n^3$? This is a problem set I have, it's not a homework but it's very important practice...  Send me some hints please, I don't want an answer I need to get it by myself but I'm failing miserably...   The problem is:     Prove that for all natural numbers $n$,  $4^n &gt; n^3$ Boy and girl paradox is driving me crazy Newbie Q: Is "Field Level Security" the same as "Field Accessibility"? There are two buttons that seem very similar when viewing the detial page for an object: Set Field Level Security and View Field Accessibility. They both seem to allow you to set the field level security.  Are these ("Field Level Security" and "Field Accessibility") basically the same thing? Suppose that $V, W$ are closed in $X$ and that $V\cap W, V\cup W$ are connected. Show that $V$ and $W$ are connected.  My attempt: Suppose that $V=U_1\cup U_2$ where $U_i$ are open in $V$, not empty and $U_1\cap U_2=\emptyset$. This induces a separation for $V\cap W$: $$ V\cap W = (U_1\cap W)\cup(U_2\cap W).$$  $U_i\cap W$ is open in $V\cap W$  $(U_1\cap W)\cup (U_2\cap W)=\emptyset$ as otherwise $U_1\cap U_2 \ne \emptyset$.  Now, I need to show that both sets are not empty. We know that $V\cup W$ is connected and closed in $X$. So, for all $x\in V\cup W=U_1\cup U_2\cup W$ and all neighborhoods $Z$ (in $X$!) of $x$ we have that $Z\cap (V\cup W) \ne \emptyset$. We can choose $x\in U_1 \subseteq V\cup W$. But then I would have to find a neighborhood of $x$ in $X$. I can't find one... How can I complete this bullet point?   Thanks. Hide processes from other users based on groups (under Linux)? Is it possible to configure process hiding for certain user groups under a linux system?  For example: Users from group X should not see processes owned by users from group Y in ps/top or under /proc.  Is it possible to configure such a setup with SELinux?  (I vaguely remember a similar feature in the funny grsecurity patch set - but IIRC, it was more generic - and besides, I want to configure a stock linux distro without having to maintain a custom kernel.)  Edit: For better illustration, . The example is not that generic, but one can configure that a user or some users can only see information of their own processes in ps etc. In Avengers: Infinity War, up until Thanos      gets all six Stones   in order to use the Gauntlet he needs to close his fist, as we see in the fight scene on Titan.     Doctor Strange: "Don't let him close his fist!"   So why later does snapping work? After 4 years of being a Mac user, there is only one thing that I still miss from the Windows world, and that is being able to switch with a single keystroke between all open windows in the computer.  What is the best app or utility, free or not, for accomplishing that?  I've used , but I never was completely satisfied with it. It's a bit slow and the switcher UI is not very pretty.  Do you know any alternative?    EDIT (2016): This question keeps getting views and upvotes after 6 years. When I asked this question in 2010 I was still transitioning from being a Windows user. Eventually, I got used to Mac OS X UI and nowadays I don't use any third party utility for managing app windows, just Mission Control and the native keyboard shortcuts. So, although this question is no longer relevant for me I hope it is useful to new Mac users making the switch (Including this comment). What is the maximum size of a web browser's cookie's key? What is the maximum size of a web browser's cookie's key?  I know the maximum size of a cookie is 4KB, but does the key have a limitation as well? Using terminal escape-sequences within GNU screen I have a ruby terminal script that I would like to print out hyperlinks. I achieve that like so:  puts("\e]8;;https://example.com\aThis is a link\e]8;;\a")   This works perfectly fine in a "normal" terminal (gnome-terminal btw) window.  But I need to run this script within GNU screen, where the escape-sequence simply has no effect. Other sequences (like colors for example) work fine, the hyperlink one (which according to the  might be a gnome-terminal-only thing) doesn't. (screen is running inside gnome-terminal)  How can I get screen to acknowledge my link sequence and display it properly? What is the definition of a symmetric distribution? What's the definition of a symmetric distribution? Someone told me that a random variable $X$ came from a symmetric distribution if and only if $X$ and $-X$ has the same distribution. But I think this definition is partly true. Because I can present a counterexample $X\sim N(\mu,\sigma^{2})$ and $\mu\neq0$.  Obviously, it has a symmetric distribution, but $X$ and $-X$ have different distribution! Am I right? Do you guys ever think about this question? What's the exact definition of symmetric distribution? UITableViewCell content overlaps delete button when in editing mode in iOS7 How does item level and rarity affect the possible attributes? Comma after introductory words, phrases, clauses: unacceptable, obligatory or optional? I am no native speaker and always confused about the comma in introductory phrases, in particular in prepositional phrases. Is there any hard rule when a comma must be set? If I make a google search for certain phrases, I often find both variants. Typical examples where I am not sure whether a comma must be set are:        First[ly][,] I must phone mother   In this case[,] we must...   For simple problems[,] the algorithm...   From Lemma 1.2[,] we obtain...   For a typical user[,] the algorithm...   In our theory[,] we...   A dark line on the horizon[,] the mountain range we were headed for seemed somehow not as threatening as when we had started out on the trip.   Avidly reading her novel[,] Jane did not notice that her stop was approaching.   To be sure[,] it is not easy to see a solution.   When you get to Rome[,] give me a ring. How can I uninstall software? I flagged a question, , as "low quality" but a moderator declined it. I thought that the post was a low quality one and would like to know why the moderator did not.  Hopefully shedding light on this matter will avail me of the knowledge to be a better flagger in future.  My logic was that mysql-fetch-row is not supposed to return an array of results. If it does than its name would be mysql-fetch-rows.  What's your take on the situation? This question led to a new package:      How can I display the full path of the tex file that I compile? It is a simple file, no include or input present.  Edit: I use MiKTeX 2.9 on a Windows 7 64-bit.  Less demanding: If not possible, then I will be satisfied with a partial path (at least one or two folders up + the filename). Suppose that $X_1,X_2,...,X_n$ is a random sample from a normal distribution, $X_i\sim N(\mu,9)$.  Find the UMVUE (uniformly minimum variance unbiased estimator) of $P(X\le c)$ where $c$ is a known constant.  Do this by finding the conditional distribution of $X_1$ given $\bar{X}={\bar{x}}$ and apply the Rao-Blackwell theorem with $T=u(X_1)$, where $u(x_1)=1$ if $x\le c$ and zero otherwise.  So clearly the parameter that we're trying to estimate given the problem description can be written as $\Phi\left( \frac{c-\mu}{3} \right)$ where $\Phi$ represents the CDF of the standard normal distribution.  However, I get stuck when I need to try and find the conditional distribution.  Without knowing the joint distribution or the other conditional distribution, how can I possibly find the conditional distribution of $X_1$ given $\bar{X}={\bar{x}}$?