Swing - Get to the next "page" when pressing a button So im writing a GUI for a simple boardgame. I want to have a menu with several buttons, two of them are for example "Start game" or "Options" etc... If i click "Start game" i want to get to the next page/scene. Whats the best way of doing so? I want everything to happen in one JFrame.   I thought about removing all components with getContentPane().remove(); and then adding the new components i want to have. But i would also like to be able to get back to the menu again when pressing the "back" button for example. And removing and adding everything again all the time seems a bit of too much work for that simple task.  Is it possible to get somehow redirected to a new "scene" when pressing a button or something like that? I´m sure there has to be a better way than the one i listed above.
How do I change JPanel inside a JFrame on the fly? To put it simple, there's a simple java swing app that consists of JFrame with some components in it. One of the components is a JPanel that is meant to be replaced by another JPanel on user action.  So, what's the correct way of doing such a thing? I've tried  panel = new CustomJPanelWithComponentsOnIt(); parentFrameJPanelBelongsTo.pack();   but this won't work. What would you suggest?
Get week of year in JavaScript like in PHP Was Stack Exchange named after Experts Exchange? Was Stack Exchange named after Experts Exchange, or is the former using the word "Exchange" a coincidence? Understanding Euclid's proof that the number of primes is infinite. In Euclid's proof, if $p_1, p_2, \dots, p_n$ are the only primes then $p_1 \times p_2 \times \dots \times p_n + 1$ is not divisible by any of $p_1, p_2, \dots, p_n$ (because of some algebraic facts), which makes another prime and is a contradiction.   The proof makes sense logically, and I tried some numerical examples to "feel" the proof better but...  $2 \times 3 \times 5\times 7\times 11\times 13+1$ is not a prime! $2 \times 3 \times 5\times 7\times 11\times 13 \times 17+1$ is also not prime! Why is the general case proof is not working for these examples? Understanding of the theorem that all norms are equivalent in finite dimensional vector spaces The following is a well-known result in functional analysis:     If the vector space $X$ is finite dimensional, all norms are equivalent.     Here is the standard proof in one textbook. First, pick a norm for $X$, say  $$\|x\|_1=\sum_{i=1}^n|\alpha_i|$$ where $x=\sum_{i=1}^n\alpha_ix_i$, and $(x_i)_{i=1}^n$ is a basis for $X$. Then show that every norm for $X$ is equivalent to $\|\cdot\|_1$, i.e.,  $$c\|x\|\leq\|x\|_1\leq C\|x\|.$$ For the first inequality, one can easily get $c$ by triangle inequality for the norm. For the second inequality, instead of constructing $C$, the  is applied to construct a contradiction.   The strategies for proving these two inequalities are so different. Here is my question,      Can one prove this theorem without Bolzano-Weierstrass theorem?   UPDATE:     Is the converse of the theorem true? In other words, if all norms for a vector space $X$ are equivalent, then can one conclude that $X$ is of finite dimension? How to restart X Window Server from command line? How can I restart X Window Server from the command line?  I'd really like to be able to restart my GUI without having to do a full system reboot. Proving $1-\exp(-4x^2/ \pi) \ge \text{erf}(x)^2$ Repeating the consonant in many words in a sentence or phrase In the movie 'V for Vendetta' you have for example (bold part):     Evey: Who are you?        V. : Who? Who is but the form following the function of what and what I am is a man in a mask.      Evey: Well I can see that.        V. : Of course you can, I’m not questioning your powers of observation, I’m merely remarking upon the paradox of asking a masked man who he is.      Evey: Oh, right.      V. : But on this most auspicious of nights, permit me then, in lieu of the more commonplace soubriquet, to suggest the character of this dramatis persona.      V. : Voila!   In view humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of fate. This visage, no mere veneer of vanity, is a vestige of   the “vox populi” now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin, van guarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta, held as a votive not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily this vichyssoise of verbiage veers most verbose, so let me simply add that it’s my very good   honour to meet you and you may call me V.       Evey: Are you like a crazy person?      V. : I’m quite sure they will say so.   What do you call sentences like these? And do you know some other ones? Home button broken and Notification Center stuck my home button on my ipod touch 5th Gen has been broken for  while so I have been using assistive touch. Earlier on my notification centre got stuck half way down the lock screen, making my ipod completely unusable.   I tried turning it off but the notification centre is blocking the slider and obviously I can't restart it since my home button is broken. Has anyone got any solutions? It's an absolute nightmare! I'm having trouble opening jar files because there is no java runtime in open with listed. Even I have installed it via Software Center(i also try to reinstall it via synaptic and i do a --purge via terminal). What do 'real', 'user' and 'sys' mean in the output of time(1)? $ time foo real        0m0.003s user        0m0.000s sys         0m0.004s $   What do 'real', 'user' and 'sys' mean in the output of time?  Which one is meaningful when benchmarking my app? Unable to install any updates through update manager/apt-get upgrade What is a good reference for rigorous Electromagnetism and Electrodynamics? Is there any good book on Electromagnetism from a more mathematical point of view? By this I mean a book which makes use of differential forms and maybe De Rham cohomology. I was also searching for something that would include E&amp;M in the big picture of Gauge theories. How to read the following Itinerary What do the abbreviations mean in the following itinerary:     2  EK 641 L 29NOV 2 KBLDXB HK1       I  1630 1905   *1A/E*                      3  EK 344 L 29NOV 2 DXBKUL HK1       3  2140 0835+1 *1A/E*                      4  MH 704 V 30NOV 3 KULMNL HK1       M  1245 1630   *1A/E*                      5  UA 184 Y 01DEC 4 MNLGUM HK1       1  2255 0440+1 *1A/E*                      6  UA 155 Y 02DEC 5 GUMTKK HK1          0820 1008   especially, the numbers (2,2,3,4,5) before KBLDXB, KULMNL.... The letters and numbers before time (I, 3, M, 1) *1A/E*? Is 2h 45m enough for a layover in Newark Liberty International transferring from an international to a domestic flight (Terminal B → Terminal C)? How to remove items from a list while iterating? Why $\dim U+\dim U^\perp=\dim V$? Let $V$ be a vector space. Given $U\le V$, define $U^\perp=\{f\in V^\ast\mid f(u)=0\,,\;\forall u\in U\}$ and given $W\le V^\ast$, define $W^\perp=\{u\in V\mid f(u)=0\;,\;\forall f\in W\}$. This defines a Galois connection between subspaces of $V$ and subspaces of $V^\ast$. If $V$ is finite dimensional, why is $\dim U+\dim U^\perp=\dim V$? Unfortunately, I am not very comfortable with linear algebra. Any hint will be appreciated. This is about the seemingly controversial shield to ground connection. The system is basically a body-worn intel-based computer, powered by a battery. Two USB 3.0 (or 3.1 Gen1) cables come out to a PCB that contains two USB 3.0 hub chips (). Two external cameras plug in to this usb hub PCB (one camera for each hub). So the usb hub PCB has 4 usb connectors (2 upstream and 2 downstream).  The question is, what to do with each of the usb connector shields? The main directive is USB connection robustness.  I have seen many recommendations. For example:  Recommendation 1  TI's TUSB8020B hub reference design  ties all shells directly to ground.    Intel's  also recommends to tie to ground (although this was written for USB 2.0).    Recommendation 2  TI's TUSB8020B EVM (and datasheet) connect shields together, and to ground using RC filter:    Microchip's  also ties shields together and uses an RC filter, but a 3 orders of magnitude smaller R:    Recommendation 3  Cypess  ties each shield independently to ground using either LC or L filter (chokes really):    The cameras themselves (off the shelf) use Cypress recommendation (LC to ground). The embedded computer seems to tie to ground from visual inspection and checking continuity to ground, but I'm not 100% sure (schematics are not available).  Now we face the shield dilemma with the hub PCB (which by the way currently does not have a metallic enclosure, it is a 3d printed plastic enclosure).   What is your say? $f : S^1 \to\mathbb R$ is continuous then $f(x)=f(-x)$ for some $x\in S^1$ Question is to prove :  $f : S^1 \to \mathbb R$ is continuous then $f(x)=f(-x)$ for some $x\in S^1$  I guess it would be helpful to use intermediate value theorem  Assuming $f(x)\neq f(-x)$ then given any $p\in (f(-x),f(x))$ (assuming $f(-x)&lt;f(x)$) there exists $y\in (-x, x)$ such that $f(y)=p$  I am not very sure of how to use this..   It would be helpful if someone can give some hint which would help me to solve this..  Thank you. There are two checkboxes for Run As Administrator in the Properties dialog for a shortcut in Windows 7. One is under the Shortcut tab in the Advanced Properties dialog, and the other is under the Compatibility tab.  I've seen this under Windows 7 and Windows Server 2008. It might be in Vista and other versions, but I'm not sure.  What is the difference between these two settings? In a finite cyclic group, the generator has the order of the group Let $G$ be a finite cyclic group of order $n$ generated by an element $g$. I want to show that the order of $g$ is exactly the order of $G$.   My try:   We can write $G=\{g^i\;|\;i\in \mathbb Z\}$. Since $G$ is finite, we know that there will be identifications $g^i=g^j$ that will make $G$ finite. By the multiplication law on $G$ we must have $g^0=1$. Also if $i&lt;j$ and if $g^i=g^j$ then $g^{j-i}=1$. I can see all these but not see why $g^n=1$ and not $g^k=1$ for all $0&lt;k&lt;n$? Thank your for your help!!