You just have to put the pack(); before!
-
Basta colocar o pack(); antes!
//...
this.pack();
//pack() before!
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screenSize = tk.getScreenSize();
setLocation((screenSize.width - this.getWidth()) / 2, (screenSize.height - this.getHeight()) / 2);
//...
Binary | Hex | Decimal | Character |
0000_0000 | 00 | 0 | NULL |
0000_0001 | 01 | 1 | ctrl A |
0000_0010 | 02 | 2 | ctrl B |
0000_0011 | 03 | 3 | ctrl C |
0000_0100 | 04 | 4 | ctrl D |
0000_0101 | 05 | 5 | ctrl E |
0000_0110 | 06 | 6 | ctrl F |
0000_0111 | 07 | 7 | bell |
0000_1000 | 08 | 8 | backspace |
0000_1001 | 09 | 9 | tab |
0000_1010 | 0A | 10 | line feed |
0000_1011 | 0B | 11 | ctrl K |
0000_1100 | 0C | 12 | form feed |
0000_1101 | 0D | 13 | return |
0000_1110 | 0E | 14 | ctrl N |
0000_1111 | 0F | 15 | ctrl O |
0001_0000 | 10 | 16 | ctrl P |
0001_0001 | 11 | 17 | ctrl Q |
0001_0010 | 12 | 18 | ctrl R |
0001_0011 | 13 | 19 | ctrl S |
0001_0100 | 14 | 20 | ctrl T |
0001_0101 | 15 | 21 | ctrl U |
0001_0110 | 16 | 22 | ctrl V |
0001_0111 | 17 | 23 | ctrl W |
0001_1000 | 18 | 24 | ctrl X |
0001_1001 | 19 | 25 | ctrl Y |
0001_1010 | 1A | 26 | ctrl Z |
0001_1011 | 1B | 27 | ctrl [ |
0001_1100 | 1C | 28 | ctrl \ |
0001_1101 | 1D | 29 | Esc |
0001_1110 | 1E | 30 | ctrl ^ |
0001_1111 | 1F | 31 | ctrl _ |
0010_0000 | 20 | 32 | space |
0010_0001 | 21 | 33 | ! |
0010_0010 | 22 | 34 | " |
0010_0011 | 23 | 35 | # |
0010_0100 | 24 | 36 | $ |
0010_0101 | 25 | 37 | % |
0010_0110 | 26 | 38 | & |
0010_0111 | 27 | 39 | ' |
0010_1000 | 28 | 40 | ( |
0010_1001 | 29 | 41 | ) |
0010_1010 | 2A | 42 | * |
0010_1011 | 2B | 43 | + |
0010_1100 | 2C | 44 | , |
0010_1101 | 2D | 45 | - |
0010_1110 | 2E | 46 | . |
0010_1111 | 2F | 47 | / |
0011_0000 | 30 | 48 | 0 |
0011_0001 | 31 | 49 | 1 |
0011_0010 | 32 | 50 | 2 |
0011_0011 | 33 | 51 | 3 |
0011_0100 | 34 | 52 | 4 |
0011_0101 | 35 | 53 | 5 |
0011_0110 | 36 | 54 | 6 |
0011_0111 | 37 | 55 | 7 |
0011_1000 | 38 | 56 | 8 |
0011_1001 | 39 | 57 | 9 |
0011_1010 | 3A | 58 | : |
0011_1011 | 3B | 59 | ; |
0011_1100 | 3C | 60 | < |
0011_1101 | 3D | 61 | = |
0011_1110 | 3E | 62 | > |
0011_1111 | 3F | 63 | ? |
0100_0000 | 40 | 64 | @ |
0100_0001 | 41 | 65 | A |
0100_0010 | 42 | 66 | B |
0100_0011 | 43 | 67 | C |
0100_0100 | 44 | 68 | D |
0100_0101 | 45 | 69 | E |
0100_0110 | 46 | 70 | F |
0100_0111 | 47 | 71 | G |
0100_1000 | 48 | 72 | H |
0100_1001 | 49 | 73 | I |
0100_1010 | 4A | 74 | J |
0100_1011 | 4B | 75 | K |
0100_1100 | 4C | 76 | L |
0100_1101 | 4D | 77 | M |
0100_1110 | 4E | 78 | N |
0100_1111 | 4F | 79 | O |
0101_0000 | 50 | 80 | P |
0101_0001 | 51 | 81 | Q |
0101_0010 | 52 | 82 | R |
0101_0011 | 53 | 83 | S |
0101_0100 | 54 | 84 | T |
0101_0101 | 55 | 85 | U |
0101_0110 | 56 | 86 | V |
0101_0111 | 57 | 87 | W |
0101_1000 | 58 | 88 | X |
0101_1001 | 59 | 89 | Y |
0101_1010 | 5A | 90 | Z |
0101_1011 | 5B | 91 | [ |
0101_1100 | 5C | 92 | \ |
0101_1101 | 5D | 93 | ] |
0101_1110 | 5E | 94 | ^ |
0101_1111 | 5F | 95 | _ |
0110_0000 | 60 | 96 | ` |
0110_0001 | 61 | 97 | a |
0110_0010 | 62 | 98 | b |
0110_0011 | 63 | 99 | c |
0110_0100 | 64 | 100 | d |
0110_0101 | 65 | 101 | e |
0110_0110 | 66 | 102 | f |
0110_0111 | 67 | 103 | g |
0110_1000 | 68 | 104 | h |
0110_1001 | 69 | 105 | i |
0110_1010 | 6A | 106 | j |
0110_1011 | 6B | 107 | k |
0110_1100 | 6C | 108 | l |
0110_1101 | 6D | 109 | m |
0110_1110 | 6E | 110 | n |
0110_1111 | 6F | 111 | o |
0111_0000 | 70 | 112 | p |
0111_0001 | 71 | 113 | q |
0111_0010 | 72 | 114 | r |
0111_0011 | 73 | 115 | s |
0111_0100 | 74 | 116 | t |
0111_0101 | 75 | 117 | u |
0111_0110 | 76 | 118 | v |
0111_0111 | 77 | 119 | w |
0111_1000 | 78 | 120 | x |
0111_1001 | 79 | 121 | y |
0111_1010 | 7A | 122 | z |
0111_1011 | 7B | 123 | { |
0111_1100 | 7C | 124 | | |
0111_1101 | 7D | 125 | } |
0111_1110 | 7E | 126 | ~ |
0111_1111 | 7F | 127 | ¯ |
It's very useful! :)