Guest User

With na and bign

a guest
Oct 14th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.65 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import java.awt.image.BufferedImage;
  4.  
  5. import javax.swing.*;
  6. import javax.swing.border.EmptyBorder;
  7. import javax.swing.border.LineBorder;
  8.  
  9. import java.util.*;
  10.  
  11. public class GridTest extends JFrame implements ActionListener{
  12.  
  13. private static ArrayList<Integer> primes;
  14. private static int maxPrime = 1000;
  15. private static GridCell nextCell;
  16. private static GridCell natransform;
  17. private static GridCell bigncell;
  18. private static GridCell displayCell;
  19. private static JPanel gui;
  20. private static GridTest cb;
  21. private int size;
  22. private int fStore;
  23. private int pixels;
  24. private JButton[][] unitSquares;
  25. private JPanel xplusnSquare;
  26. private JPanel dplusnSquare;
  27. private JLabel message;
  28. private static JFrame f = new JFrame("(x+n)(x+n) and (d+n)(d+n)");;
  29. private boolean thingsSet = false;
  30. private JToolBar tools;
  31.  
  32. public GridTest(int sizeSend) {
  33. int size = sizeSend;
  34. initializeVars(size);
  35. initializeGui();
  36. }
  37.  
  38. public void initializeVars(int size){
  39. this.gui = new JPanel(new BorderLayout(0,0));
  40. this.size = size;
  41. this.unitSquares = new JButton[size][size];
  42. this.message = new JLabel(displayCell.print());
  43. }
  44.  
  45. public void setGui(){
  46. if(thingsSet != true){
  47. gui.setBorder(new EmptyBorder(5, 5, 5, 5));
  48. gui.add(tools, BorderLayout.PAGE_START);
  49. }
  50.  
  51. JPanel container = new JPanel();
  52. container.setLayout(new GridLayout(1,2));
  53. container.add(xplusnSquare);
  54. container.add(dplusnSquare);
  55. gui.add(container);
  56. }
  57.  
  58. public final void initializeGui() {
  59. if(tools == null){
  60. tools = new JToolBar();
  61. tools.setFloatable(false);
  62. JButton keepxplusnupButton = new JButton("Higher n same (x+n)");
  63. keepxplusnupButton.setActionCommand("keepxplusnup");
  64. keepxplusnupButton.addActionListener(this);
  65. JButton keepxplusndownButton = new JButton("Lower n same (x+n)");
  66. keepxplusndownButton.setActionCommand("keepxplusndown");
  67. keepxplusndownButton.addActionListener(this);
  68. JButton naButton = new JButton("na (if x+n odd)");
  69. naButton.setActionCommand("na");
  70. naButton.addActionListener(this);
  71. JButton bignButton = new JButton("bigN (if x+n odd)");
  72. bignButton.setActionCommand("bign");
  73. bignButton.addActionListener(this);
  74. JButton origButton = new JButton("Original");
  75. origButton.setActionCommand("orig");
  76. origButton.addActionListener(this);
  77. tools.add(keepxplusnupButton);
  78. tools.add(keepxplusndownButton);
  79. tools.add(naButton);
  80. tools.add(bignButton);
  81. tools.addSeparator();
  82. tools.add(message);
  83. tools.addSeparator();
  84. tools.add(origButton);
  85. }
  86.  
  87. xplusnSquare = new JPanel(new GridBagLayout());
  88. xplusnSquare.setBorder(new LineBorder(Color.WHITE));
  89. dplusnSquare = new JPanel(new GridBagLayout());
  90. dplusnSquare.setBorder(new LineBorder(Color.WHITE));
  91.  
  92. Insets buttonMargin = new Insets(0,0,0,0);
  93. for (int ii = 0; ii < unitSquares.length; ii++) {
  94. for (int jj = 0; jj < unitSquares[ii].length; jj++) {
  95. JButton b = new JButton();
  96. pixels = 630/displayCell.dplusn();
  97. b.setPreferredSize(new Dimension(pixels, pixels));
  98.  
  99. ImageIcon icon = new ImageIcon(new BufferedImage(pixels, pixels, BufferedImage.TYPE_INT_ARGB));
  100. b.setIcon(icon);
  101. unitSquares[jj][ii] = b;
  102. GridBagConstraints c = new GridBagConstraints();
  103. c.gridx = ii;
  104. c.gridy = jj;
  105.  
  106.  
  107. /*
  108. * This is where I'm drawing the triangles. It's a whole bunch of code so it could probably be moved to
  109. * its own method but whatever.
  110. */
  111.  
  112.  
  113. if(displayCell.xplusn() == 3){
  114. //if it's three then the center will be black and the eight remaining squares will be the triangles
  115. //these don't need sophisticated border drawing to make triangles out of them
  116. b.setBorder(BorderFactory.createMatteBorder(1,1,1,1, Color.black)); //directly left of center
  117. b.setBackground(Color.CYAN);
  118. //if you're in the middle, make it black
  119. if(ii==((size-1)/2) && jj==((size-1)/2)){
  120. b.setBackground(Color.BLACK);
  121. }
  122.  
  123. } else {
  124.  
  125. //drawing the triangles
  126. if(jj==((size-1)/2) && ii==(((size-1)/2)-1)){
  127. b.setBorder(BorderFactory.createMatteBorder(1,0,1,0, Color.black)); //directly left of center
  128. } else if(jj==((size-1)/2) && ii<(((size-1)/2)-1) && ii>0){
  129. b.setBorder(BorderFactory.createMatteBorder(1,0,0,0, Color.black)); //left of center to before left edge
  130. } else if(((((size-1)/2)-jj)+(((size-1)/2)-ii)==1) && jj>ii && ii>0){
  131. b.setBorder(BorderFactory.createMatteBorder(0,0,1,1, Color.black)); //diagonal left and down
  132. } else if(ii==(((size-1)/2)-1) && jj>((size-1)/2) && jj<size-1){
  133. b.setBorder(BorderFactory.createMatteBorder(0,0,0,1, Color.black)); //downwards directly left of center
  134. } else if(ii==0 && jj==((size-1)/2)){
  135. b.setBorder(BorderFactory.createMatteBorder(1,1,0,0, Color.black)); //left edge center corner
  136. } else if(ii==0 && jj>((size-1)/2) && jj<(size-2)){
  137. b.setBorder(BorderFactory.createMatteBorder(0,1,0,0, Color.black)); //left edge downwards from center
  138. } else if(ii==0 && jj==(size-2)){
  139. b.setBorder(BorderFactory.createMatteBorder(0,1,1,1, Color.black)); //left bottom corner of triangle (2nd last square)
  140. } else if(ii==0 && jj==(size-1)){
  141. b.setBorder(BorderFactory.createMatteBorder(0,1,1,0, Color.black)); //left bottom corner
  142. } else if(ii>0 && ii<(((size-1)/2)-1) && jj==(size-1)){
  143. b.setBorder(BorderFactory.createMatteBorder(0,0,1,0, Color.black)); //bottom edge before center
  144. } else if(ii==(((size-1)/2)-1) && jj==(size-1)){
  145. b.setBorder(BorderFactory.createMatteBorder(0,0,1,1, Color.black)); //bottom left inner corner before center
  146.  
  147.  
  148. } else if(jj==((size-1)/2) && ii==(((size-1)/2)+1)){
  149. b.setBorder(BorderFactory.createMatteBorder(1,0,1,0, Color.black)); //directly right of center
  150. } else if(jj==((size-1)/2) && ii>(((size-1)/2)-1) && ii<(size-1)){
  151. b.setBorder(BorderFactory.createMatteBorder(0,0,1,0, Color.black)); //right of center to before right edge
  152. } else if(((jj-((size-1)/2))+(ii-((size-1)/2))==1) && jj<ii && jj>0){
  153. if(ii==(size-1)){
  154. b.setBorder(BorderFactory.createMatteBorder(1,1,0,1, Color.black)); //diagonal right and up
  155. } else {
  156. b.setBorder(BorderFactory.createMatteBorder(1,1,0,0, Color.black)); //diagonal right and up
  157. }
  158. } else if(ii==(((size-1)/2)+1) && jj<((size-1)/2) && jj>0){
  159. b.setBorder(BorderFactory.createMatteBorder(0,1,0,0, Color.black)); //upwards directly right of center
  160. } else if(ii==(size-1) && jj==((size-1)/2)){
  161. b.setBorder(BorderFactory.createMatteBorder(0,0,1,1, Color.black)); //right edge center corner
  162. } else if(ii==(size-1) && jj<0 && jj>(size-2)){
  163. b.setBorder(BorderFactory.createMatteBorder(0,1,0,0, Color.black)); //right edge upwards from center
  164. } else if(jj==0 && ii>(((size-1)/2)+1) && ii<(size-1)){
  165. b.setBorder(BorderFactory.createMatteBorder(1,0,0,0, Color.black)); //top right
  166. } else if(ii==(size-1) && jj==0){
  167. b.setBorder(BorderFactory.createMatteBorder(1,0,0,1, Color.black)); //diagonal right and up
  168. } else if(ii==(((size-1)/2)+1) && jj==0){
  169. b.setBorder(BorderFactory.createMatteBorder(1,1,0,0, Color.black)); //diagonal right and up
  170. } else if(ii==(size-1) && jj>1 && jj<((size-1)/2)){
  171. b.setBorder(BorderFactory.createMatteBorder(0,0,0,1, Color.black)); //diagonal right and up
  172.  
  173.  
  174. } else if(jj==(((size-1)/2)+1) && ii==((size-1)/2)){
  175. b.setBorder(BorderFactory.createMatteBorder(0,0,0,1, Color.black)); //directly below center
  176. } else if(jj==(size-1) && ii>=((size-1)/2) && ii<(size-2)){
  177. b.setBorder(BorderFactory.createMatteBorder(0,0,1,0, Color.black)); //bottom below center
  178. } else if(jj==(size-1) && ii==(size-2)){
  179. b.setBorder(BorderFactory.createMatteBorder(1,0,1,1, Color.black)); //directly below center
  180. } else if(ii-jj==-1 && ii>((size-1)/2) && jj>((size-1)/2)){
  181. b.setBorder(BorderFactory.createMatteBorder(1,0,0,1, Color.black)); //diagonal right and down
  182. } else if(jj==(size-1) && ii==(size-1)){
  183. b.setBorder(BorderFactory.createMatteBorder(0,0,1,1, Color.black)); //bottom right corner
  184. } else if(jj>((size-1)/2) && jj<(size-1) && ii==(size-1)){
  185. b.setBorder(BorderFactory.createMatteBorder(0,0,0,1, Color.black)); //right edge downwards
  186.  
  187.  
  188. } else if(jj==0 && ii==0){
  189. b.setBorder(BorderFactory.createMatteBorder(1,1,0,1, Color.black)); //top corner
  190. } else if(ii==0 && jj>0 && jj<((size-1)/2)){
  191. b.setBorder(BorderFactory.createMatteBorder(0,1,0,0, Color.black)); //left top side edge
  192. } else if(jj==0 && ii>0 && ii<(((size-1)/2)+1)){
  193. b.setBorder(BorderFactory.createMatteBorder(1,0,0,0, Color.black)); //left top top edge
  194. } else if(ii==jj && ii>0 && ii<((size-1)/2) && jj>0 && jj<((size-1)/2)){
  195. b.setBorder(BorderFactory.createMatteBorder(1,0,0,1, Color.black)); //directly below center
  196.  
  197.  
  198. } else {
  199. b.setBorder(BorderFactory.createMatteBorder(0,0,0,0, Color.black)); //inner parts blank
  200. }
  201.  
  202.  
  203.  
  204. /*
  205. * Now I need to set the colours
  206. * nn+2d(n-1)+f-1
  207. * nn is purple (in this case Java.Color.MAGENTA)
  208. * 2d(n-1) is red
  209. * f is blue (in this case Java.Color.CYAN)
  210. */
  211.  
  212. b.setBackground(Color.WHITE);
  213.  
  214. //nn+2d(n-1)+f-1
  215. //If n=1 there's no nn because of the -1 (the black square in the middle
  216. //If n=1 there's no 2d(n-1) since n-1=0
  217. //So if n=1 you have to fill the whole square with f
  218. if(displayCell.xplusn() != 1){
  219. //if x+n=1, it's just the one black square, so it's already done
  220. if(displayCell.n() == 1){
  221. //everything other than the center is f-coloured
  222. if(!(ii==((size-1)/2) && jj==((size-1)/2))){
  223. b.setBackground(Color.CYAN);
  224. }
  225. } else {
  226. int offset = (((displayCell.n())-1)/2)+1;
  227. int nextrowlength = ((displayCell.n())+1)/2;
  228. int n = 0;
  229. if(displayCell.n()%2==0){
  230. n = displayCell.n() - 1;
  231. fStore = (displayCell.f()*-1) + (2*n) + 1;
  232. } else {
  233. n = displayCell.n();
  234. fStore = (displayCell.f()*-1);
  235. }
  236. int toput = fStore;
  237.  
  238. //it needs to be set up so that the n square is around the outside of the center black square
  239. //it'll be (n-1)/2 away from the center
  240. if(ii>=(((size-1)/2)-((n-1)/2))
  241. && ii<=(((size-1)/2)+((n-1)/2))
  242. && jj>=(((size-1)/2)-(n-1)/2)
  243. && jj<=(((size-1)/2)+(n-1)/2)){
  244. //everything here is nn-coloured
  245. b.setBackground(Color.MAGENTA);
  246. } else {
  247. b.setBackground(colouringF(ii,jj,toput,offset,nextrowlength,n));
  248. }
  249. }
  250. }
  251.  
  252. //if you're in the middle, make it black
  253. if(ii==((size-1)/2) && jj==((size-1)/2)){
  254. b.setBorder(BorderFactory.createMatteBorder(1,1,1,1, Color.black)); //diagonal left and down
  255. b.setBackground(Color.BLACK);
  256. }
  257.  
  258. if(b.getBackground() == Color.WHITE){
  259. b.setBackground(Color.RED);
  260. }
  261.  
  262. }
  263.  
  264. xplusnSquare.add(unitSquares[jj][ii], c);
  265. }
  266. }
  267. createdplusnSquare();
  268. setGui();
  269. }
  270.  
  271. public void createdplusnSquare(){
  272. int sizeD = displayCell.dplusn();
  273. for(int ii = 0; ii<sizeD; ii++){
  274. for(int jj = 0; jj<sizeD; jj++){
  275. JButton b = new JButton();
  276. b.setBorder(BorderFactory.createMatteBorder(1,1,1,1, Color.WHITE));
  277. b.setPreferredSize(new Dimension(pixels, pixels));
  278. b.setBackground(colouringdplusnSquare(ii, jj, sizeD));
  279. ImageIcon icon = new ImageIcon(new BufferedImage(pixels, pixels, BufferedImage.TYPE_INT_ARGB));
  280. b.setIcon(icon);
  281. GridBagConstraints c = new GridBagConstraints();
  282. c.gridx = ii;
  283. c.gridy = jj;
  284. dplusnSquare.add(b, c);
  285. }
  286. }
  287. }
  288.  
  289. public Color colouringdplusnSquare(int ii, int jj, int sizeD){
  290. //if ii and jj are within sizeD and sizeD-displayCell.d(), return black
  291. if(ii>=(displayCell.n()) && jj>=(displayCell.n())){
  292. return Color.BLACK; //dd
  293. } else if((ii==displayCell.n()-1) && (jj==displayCell.n()-1)){
  294. if(displayCell.e()%2==0){
  295. return Color.CYAN; //if e's even the d+1 corner will be blue for f
  296. } else {
  297. return Color.GREEN; //otherwise it's green for e
  298. }
  299. } else if((ii>=displayCell.n() && jj==displayCell.n()-1) || (jj>=displayCell.n() && ii==displayCell.n()-1)){
  300. int eD = displayCell.e();
  301. int fD = (displayCell.f())*-1;
  302. int fdiv2 = fD/2;
  303. int ediv2 = eD/2;
  304. //you want e from the bottom up and the right leftwards
  305. //so it's going to be ii and jj between sizeD (exc) and sizeD-ediv2, right? I think
  306. if((ii<sizeD && ii>=sizeD-ediv2 && jj==displayCell.n()-1) || (jj<sizeD && jj>=sizeD-ediv2 && ii==displayCell.n()-1)){
  307. return Color.GREEN;
  308. } else {
  309. return Color.CYAN;
  310. }
  311. } else if(((ii<=(displayCell.n()-1)) && (jj<=(displayCell.n()-1))) && !(ii==displayCell.n()-1 && jj==displayCell.n()-1) ){
  312. return Color.MAGENTA; //nn-1
  313. }
  314. return Color.RED;
  315. }
  316.  
  317. public Color colouringF(int ii, int jj, int toput, int offset, int nextrowlength, int n){
  318. while(toput>0){
  319. //then somehow I need to figure out how to put f in there
  320. //everything else will be 2d(n-1) so I guess that'll just be another else excluding center
  321. //so first I need to find f%8
  322.  
  323. //fdiv8 is how many to put in each triangle
  324. //the length of the part of the triangle outside of nn will be (n+1)/2
  325. //e.g. if n=19, the closest row of the triangles will be (19+1)/2=10 long
  326. //if f/8 is less than that, you can just go from wherever you drew a line between triangles
  327. //and keep going in the opposite direction
  328. //if f/8 is greater than that, you'll need to fill the whole row for eah triangle and then
  329. //do the same thing you did for f/8<((n+1)/2) but with the next row out
  330. //man this sounds really hard, fucking hell why am I doing this
  331. if(toput <= (nextrowlength*8)){
  332. //let's say you're putting 24 in
  333. //in the first triangle, it'd be the first, the ninth and the seventeenth
  334. //so you'd go "if you're in that set of squares and the distance from here to origin
  335. //times 8 +1 (+1 for first triangle) is less than or equal to toput
  336. if(
  337. ((ii<=((size-1)/2)) && (ii>(((size-1)/2)-offset)) && (jj==(((size-1)/2)-offset)))
  338. &&
  339. (((((((size-1)/2)-ii)*8)+1)<=toput))
  340. ){
  341. return Color.CYAN;
  342. } else if(
  343. ((jj<=(((size-1)/2))-1) && (jj>(((size-1)/2)-(offset+1))) && ii==(((size-1)/2)-offset))
  344. && (
  345. (((((((size-1)/2)-1)-jj)*8)+2)<=toput))
  346. ){
  347. return Color.CYAN;
  348. } else if(
  349. ((jj>=(((size-1)/2))) && (jj<(((size-1)/2)+(offset))) && ii==(((size-1)/2)-offset))
  350. && (
  351. ((((jj-((size-1)/2))*8)+3)<=toput))
  352. ){
  353. return Color.CYAN;
  354. } else if(
  355. ((ii<=(((size-1)/2)-1)) && (ii>(((size-1)/2)-(offset+1))) && jj==(((size-1)/2)+offset))
  356. && (
  357. (((((((size-1)/2)-1)-ii)*8)+4)<=toput))
  358. ){
  359. return Color.CYAN;
  360. } else if(
  361. ((ii>=(((size-1)/2))) && (ii<(((size-1)/2)+(offset))) && jj==(((size-1)/2)+offset))
  362. && (
  363. (((((ii-((size-1)/2)))*8)+5)<=toput))
  364. ){
  365. return Color.CYAN;
  366. } else if(
  367. ((jj>=(((size-1)/2)+1)) && (jj<(((size-1)/2)+1+(offset))) && ii==(((size-1)/2)+offset))
  368. && (
  369. ((((jj-(((size-1)/2)+1))*8)+6)<=toput))
  370. ){
  371. return Color.CYAN;
  372. } else if(
  373. ((jj<=(((size-1)/2))) && (jj>(((size-1)/2)-(offset))) && ii==(((size-1)/2)+offset))
  374. && (
  375. (((((((size-1)/2)-jj))*8)+7)<=toput))
  376. ){
  377. return Color.CYAN;
  378. } else if(
  379. ((ii>(((size-1)/2))) && (ii<(((size-1)/2)+1+(offset))) && jj==(((size-1)/2)-offset))
  380. && (
  381. ((((ii-(((size-1)/2)+1))*8)+8)<=toput))
  382. ){
  383. return Color.CYAN;
  384. } else {
  385. return Color.RED;
  386. }
  387. } else {
  388. //fill the rows with f-colour
  389. if(((ii==(((size-1)/2)-(nextrowlength))) && (jj>=((((size-1)/2))-(nextrowlength))) && (jj<=((((size-1)/2))+(nextrowlength))))
  390. ||((ii==(((size-1)/2)+(nextrowlength))) && (jj>=((((size-1)/2))-(nextrowlength))) && (jj<=((((size-1)/2))+(nextrowlength))))
  391. ||((jj==(((size-1)/2)-(nextrowlength))) && (ii>=((((size-1)/2))-(nextrowlength))) && (ii<=((((size-1)/2))+(nextrowlength))))
  392. ||((jj==(((size-1)/2)+(nextrowlength))) && (ii>=((((size-1)/2))-(nextrowlength))) && (ii<=((((size-1)/2))+(nextrowlength))))
  393. ){
  394. return Color.CYAN;
  395. }
  396. offset++;
  397. nextrowlength++;
  398. toput = toput - ((nextrowlength-1)*8);
  399. }
  400. }
  401. return Color.RED;
  402. }
  403.  
  404. public static void initializeCell(GridCell newOne){
  405. nextCell = newOne;
  406. int natransforma = nextCell.a()*nextCell.n();
  407. int natransformb = natransforma + (2*nextCell.x()) + 2;
  408. natransform = new GridCell(natransforma, natransformb);
  409. bigncell = new GridCell(1, newOne.c());
  410. }
  411.  
  412. public void actionPerformed(ActionEvent e) {
  413. if ("keepxplusnup".equals(e.getActionCommand())) {
  414. GridCell newOne = nextCell.keepxplusnup();
  415. displayCell = newOne;
  416. initializeCell(newOne);
  417. initializeVars(nextCell.xplusn());
  418. initializeGui();
  419. startThing();
  420. }
  421. if ("keepxplusndown".equals(e.getActionCommand())) {
  422. GridCell newOne = nextCell.keepxplusndown();
  423. displayCell = newOne;
  424. initializeCell(newOne);
  425. initializeVars(nextCell.xplusn());
  426. initializeGui();
  427. startThing();
  428. }
  429. if ("na".equals(e.getActionCommand())) {
  430. if(natransform.xplusn()%2==0){
  431. System.out.println("x+n is even");
  432. return;
  433. }
  434. displayCell = natransform;
  435. initializeVars(displayCell.xplusn());
  436. initializeGui();
  437. startThing();
  438. }
  439. if ("bign".equals(e.getActionCommand())) {
  440. if(bigncell.xplusn()%2==0){
  441. System.out.println("x+n is even");
  442. return;
  443. }
  444. displayCell = bigncell;
  445. initializeVars(displayCell.xplusn());
  446. initializeGui();
  447. startThing();
  448. }
  449. if ("orig".equals(e.getActionCommand())) {
  450. displayCell = nextCell;
  451. initializeVars(displayCell.xplusn());
  452. initializeGui();
  453. startThing();
  454. }
  455. }
  456.  
  457. public static boolean isPrime(int n){
  458. if(n==1 || n==2 || n==4){
  459. return false;
  460. }
  461. for(int i=2; i<n; i++){
  462. if(n%i==0){
  463. return false;
  464. }
  465. }
  466. return true;
  467. }
  468.  
  469. public JComponent getGui(){
  470. return gui;
  471. }
  472.  
  473. public static void main(String[] args) {
  474. Runnable r = new Runnable() {
  475.  
  476. @Override
  477. public void run() {
  478. startThing();
  479. }
  480. };
  481. SwingUtilities.invokeLater(r);
  482. }
  483.  
  484. public static void startThing(){
  485. if(cb != null){ //if you're changing the triangles
  486. cb = new GridTest(displayCell.xplusn());
  487. f.getContentPane().removeAll();
  488. f.add(cb.getGui());
  489. f.setMinimumSize(f.getSize());
  490. f.pack();
  491. f.setSize(1300,725);
  492. } else { //initial triangles
  493. gui = null;
  494. Scanner scan = new Scanner(System.in);
  495. int a = 0;
  496. int b = 0;
  497. while(a==0 || b==0){
  498. System.out.println("a:");
  499. a = scan.nextInt();
  500. System.out.println("b:");
  501. b = scan.nextInt();
  502. if(a%2==0 || b%2==0 || a>b){
  503. System.out.println("Invalid a and/or b");
  504. a=0;
  505. b=0;
  506. }
  507. }
  508. GridCell newOne = new GridCell(a, b);
  509. if(newOne.xplusn()%2==0){
  510. System.out.println("x+n is even, defaulting");
  511. newOne = new GridCell(1,1);
  512. }
  513. initializeCell(newOne);
  514. displayCell = newOne;
  515. cb = new GridTest(displayCell.xplusn());
  516. f.add(cb.getGui());
  517. f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  518. f.setLocationByPlatform(true);
  519. f.pack();
  520. f.setSize(1300,725);
  521. f.setMinimumSize(f.getSize());
  522. f.setVisible(true);
  523. }
  524. }
  525. }
Advertisement
Add Comment
Please, Sign In to add comment