1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749
|
import javax.swing.SwingUtilities;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import java.awt.Rectangle;
import javax.swing.JScrollPane;
import javax.swing.JLabel;
import javax.swing.JTextField;
import java.awt.Font;
import javax.swing.SwingConstants;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JSlider;
import javax.swing.BorderFactory;
import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.Dimension;
import javax.swing.BoxLayout;
import java.awt.FlowLayout;
public class MainFrame extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel pnContent = null;
private JMenuBar jJMenuBar = null;
private JMenu jMenu = null;
private JMenuItem jMenuItem = null;
private JPanel pnProperties = null;
private JPanel pnTime = null;
private JPanel pnEnvironnment = null;
private JTextField tfAgentName = null;
private JLabel lblAgentPicture = null;
private JLabel lblAgentProperties = null;
private JLabel lblPlay = null;
private JSlider sdSpeed = null;
private JSlider sdTime = null;
private JLabel lblTimeSpeed = null;
private JLabel lblTimeTime = null;
private JLabel lblTimeSpeedCur = null;
private JLabel lblTimeTimeCur = null;
private JLabel lblAgentMinus = null;
private JLabel lblAgentPlus = null;
private JScrollPane pnMap = null;
private JPanel jPanel = null;
private JScrollPane jScrollPane = null;
private JPanel jPanel1 = null;
private JPanel jPanel2 = null;
private JLabel jLabel = null;
private JTextField jTextField = null;
private JTextField jTextField1 = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JTextField jTextField2 = null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JLabel jLabel5 = null;
private JTextField jTextField3 = null;
private JTextField jTextField4 = null;
private JTextField jTextField5 = null;
private JPanel jPanel3 = null;
private JPanel jPanel4 = null;
private JLabel jLabel6 = null;
private JPanel jPanel5 = null;
private JLabel jLabel7 = null;
private JPanel jPanel6 = null;
private Grid grid = null;
/**
* This method initializes jJMenuBar
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getJJMenuBar() {
if (jJMenuBar == null) {
jJMenuBar = new JMenuBar();
jJMenuBar.add(getJMenu());
}
return jJMenuBar;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getJMenu() {
if (jMenu == null) {
jMenu = new JMenu();
jMenu.setText("File");
jMenu.add(getJMenuItem());
}
return jMenu;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem() {
if (jMenuItem == null) {
jMenuItem = new JMenuItem();
jMenuItem.setText("test");
}
return jMenuItem;
}
/**
* This method initializes pnProperties
*
* @return javax.swing.JPanel
*/
private JPanel getPnProperties() {
if (pnProperties == null) {
GridBagConstraints gridBagConstraints25 = new GridBagConstraints();
gridBagConstraints25.gridx = 0;
gridBagConstraints25.gridy = 0;
GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
gridBagConstraints6.insets = new Insets(0, 0, 0, 0);
gridBagConstraints6.gridx = 2;
gridBagConstraints6.gridy = 0;
gridBagConstraints6.anchor = GridBagConstraints.NORTH;
gridBagConstraints6.fill = GridBagConstraints.BOTH;
gridBagConstraints6.gridwidth = 1;
gridBagConstraints6.ipadx = 150;
gridBagConstraints6.weightx = 1.0;
gridBagConstraints6.ipady = 0;
gridBagConstraints6.gridheight = 2;
lblAgentPlus = new JLabel();
lblAgentPlus.setIcon(new ImageIcon("C:/Documents and Settings/Eric/workspace2/Ecosystem Simulation/images/plus.gif"));
lblAgentPlus.setToolTipText("Add a copy of this agent");
lblAgentPlus.setText("");
lblAgentMinus = new JLabel();
lblAgentMinus.setIcon(new ImageIcon("C:/Documents and Settings/Eric/workspace2/Ecosystem Simulation/images/minus.gif"));
lblAgentMinus.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
lblAgentMinus.setToolTipText("Remove this agent");
lblAgentMinus.setText("");
lblAgentProperties = new JLabel();
lblAgentProperties.setText("------ Agent Properties ------");
lblAgentProperties.setHorizontalAlignment(SwingConstants.CENTER);
lblAgentPicture = new JLabel();
lblAgentPicture.setHorizontalTextPosition(SwingConstants.CENTER);
lblAgentPicture.setHorizontalAlignment(SwingConstants.CENTER);
lblAgentPicture.setFont(new Font("Dialog", Font.PLAIN, 12));
lblAgentPicture.setText("No image");
pnProperties = new JPanel();
pnProperties.setLayout(new GridBagLayout());
pnProperties.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
pnProperties.setPreferredSize(new Dimension(0, 0));
pnProperties.add(getJPanel1(), gridBagConstraints6);
pnProperties.add(getJPanel3(), gridBagConstraints25);
}
return pnProperties;
}
/**
* This method initializes pnTime
*
* @return javax.swing.JPanel
*/
private JPanel getPnTime() {
if (pnTime == null) {
lblTimeTimeCur = new JLabel();
lblTimeTimeCur.setBounds(new Rectangle(134, -1, 26, 14));
lblTimeTimeCur.setHorizontalAlignment(SwingConstants.RIGHT);
lblTimeTimeCur.setText("50");
lblTimeTimeCur.setFont(new Font("Dialog", Font.PLAIN, 10));
lblTimeSpeedCur = new JLabel();
lblTimeSpeedCur.setBounds(new Rectangle(69, -3, 22, 17));
lblTimeSpeedCur.setFont(new Font("Dialog", Font.PLAIN, 10));
lblTimeSpeedCur.setHorizontalAlignment(SwingConstants.RIGHT);
lblTimeSpeedCur.setText("50");
lblTimeTime = new JLabel();
lblTimeTime.setBounds(new Rectangle(100, -3, 29, 16));
lblTimeTime.setFont(new Font("Dialog", Font.PLAIN, 10));
lblTimeTime.setHorizontalAlignment(SwingConstants.LEFT);
lblTimeTime.setText("Time:");
lblTimeSpeed = new JLabel();
lblTimeSpeed.setBounds(new Rectangle(32, -4, 34, 19));
lblTimeSpeed.setFont(new Font("Dialog", Font.PLAIN, 10));
lblTimeSpeed.setHorizontalAlignment(SwingConstants.LEFT);
lblTimeSpeed.setText("Speed:");
lblPlay = new JLabel();
lblPlay.setIcon(new ImageIcon("C:/Documents and Settings/Eric/workspace2/Ecosystem Simulation/images/play.gif"));
lblPlay.setBounds(new Rectangle(4, 6, 20, 17));
lblPlay.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
lblPlay.setIcon(new ImageIcon("C:/Documents and Settings/Eric/workspace2/Ecosystem Simulation/images/pause.gif"));
}
});
pnTime = new JPanel();
pnTime.setLayout(null);
pnTime.add(lblPlay, null);
pnTime.add(getSdSpeed(), null);
pnTime.add(getSdTime(), null);
pnTime.add(lblTimeSpeed, null);
pnTime.add(lblTimeTime, null);
pnTime.add(lblTimeSpeedCur, null);
pnTime.add(lblTimeTimeCur, null);
}
return pnTime;
}
/**
* This method initializes pnEnvironnment
*
* @return javax.swing.JPanel
*/
private JPanel getPnEnvironnment() {
if (pnEnvironnment == null) {
jLabel7 = new JLabel();
jLabel7.setBounds(new Rectangle(4, 2, 158, 16));
jLabel7.setHorizontalAlignment(SwingConstants.CENTER);
jLabel7.setText("------ Environment ------");
pnEnvironnment = new JPanel();
pnEnvironnment.setLayout(null);
pnEnvironnment.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
pnEnvironnment.add(jLabel7, null);
}
return pnEnvironnment;
}
/**
* This method initializes tfAgentName
*
* @return javax.swing.JTextField
*/
private JTextField getTfAgentName() {
if (tfAgentName == null) {
tfAgentName = new JTextField();
tfAgentName.setFont(new Font("Dialog", Font.PLAIN, 12));
tfAgentName.setPreferredSize(new Dimension(84, 20));
tfAgentName.setToolTipText("Agent name");
tfAgentName.setText("Name");
}
return tfAgentName;
}
/**
* This method initializes sdSpeed
*
* @return javax.swing.JSlider
*/
private JSlider getSdSpeed() {
if (sdSpeed == null) {
sdSpeed = new JSlider();
sdSpeed.setBounds(new Rectangle(26, 12, 73, 16));
sdSpeed.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent e) {
lblTimeSpeedCur.setText(""+sdSpeed.getValue());
}
});
}
return sdSpeed;
}
/**
* This method initializes sdTime
*
* @return javax.swing.JSlider
*/
private JSlider getSdTime() {
if (sdTime == null) {
sdTime = new JSlider();
sdTime.setBounds(new Rectangle(94, 12, 73, 16));
sdTime.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent e) {
lblTimeTimeCur.setText(""+sdTime.getValue());
}
});
}
return sdTime;
}
/**
* This method initializes pnMap
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getPnMap() {
if (pnMap == null) {
pnMap = new JScrollPane();
pnMap.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
pnMap.setViewportView(getJPanel6());
}
return pnMap;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
gridBagConstraints8.gridx = 0;
gridBagConstraints8.gridy = 2;
GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
gridBagConstraints7.gridx = 0;
gridBagConstraints7.gridy = 1;
jLabel6 = new JLabel();
jLabel6.setText("------ Agent list ------");
GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
gridBagConstraints3.fill = GridBagConstraints.BOTH;
gridBagConstraints3.gridy = 3;
gridBagConstraints3.weightx = 1.0;
gridBagConstraints3.weighty = 1.0;
gridBagConstraints3.insets = new Insets(0, 2, 0, 0);
gridBagConstraints3.gridx = 0;
GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
gridBagConstraints2.anchor = GridBagConstraints.NORTH;
gridBagConstraints2.insets = new Insets(2, 2, 1, 2);
gridBagConstraints2.gridx = 0;
gridBagConstraints2.gridy = 0;
gridBagConstraints2.ipadx = 164;
gridBagConstraints2.ipady = 29;
gridBagConstraints2.fill = GridBagConstraints.NONE;
jPanel = new JPanel();
jPanel.setLayout(new GridBagLayout());
jPanel.add(getPnTime(), gridBagConstraints2);
jPanel.add(getJScrollPane(), gridBagConstraints3);
jPanel.add(jLabel6, gridBagConstraints7);
jPanel.add(getJPanel5(), gridBagConstraints8);
}
return jPanel;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
}
return jScrollPane;
}
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel1() {
if (jPanel1 == null) {
jLabel3 = new JLabel();
jLabel3.setText("JLabel");
jPanel1 = new JPanel();
jPanel1.setLayout(new BoxLayout(getJPanel1(), BoxLayout.Y_AXIS));
jPanel1.setPreferredSize(new Dimension(0, 0));
jPanel1.add(getJPanel4(), null);
jPanel1.add(getJPanel2(), null);
}
return jPanel1;
}
/**
* This method initializes jPanel2
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel2() {
if (jPanel2 == null) {
GridBagConstraints gridBagConstraints24 = new GridBagConstraints();
gridBagConstraints24.fill = GridBagConstraints.BOTH;
gridBagConstraints24.anchor = GridBagConstraints.CENTER;
GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
gridBagConstraints23.fill = GridBagConstraints.BOTH;
gridBagConstraints23.gridy = 1;
gridBagConstraints23.weightx = 1.0;
gridBagConstraints23.gridx = 5;
GridBagConstraints gridBagConstraints22 = new GridBagConstraints();
gridBagConstraints22.fill = GridBagConstraints.BOTH;
gridBagConstraints22.gridy = 1;
gridBagConstraints22.weightx = 1.0;
gridBagConstraints22.gridx = 3;
GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
gridBagConstraints21.fill = GridBagConstraints.BOTH;
gridBagConstraints21.gridy = 1;
gridBagConstraints21.weightx = 1.0;
gridBagConstraints21.gridx = 1;
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.gridx = 4;
gridBagConstraints20.fill = GridBagConstraints.VERTICAL;
gridBagConstraints20.gridy = 1;
jLabel5 = new JLabel();
jLabel5.setText("JLabel");
GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
gridBagConstraints19.gridx = 2;
gridBagConstraints19.fill = GridBagConstraints.VERTICAL;
gridBagConstraints19.gridy = 1;
jLabel4 = new JLabel();
jLabel4.setText("JLabel");
GridBagConstraints gridBagConstraints18 = new GridBagConstraints();
gridBagConstraints18.gridx = 0;
gridBagConstraints18.anchor = GridBagConstraints.WEST;
gridBagConstraints18.fill = GridBagConstraints.BOTH;
gridBagConstraints18.gridy = 1;
GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
gridBagConstraints17.fill = GridBagConstraints.BOTH;
gridBagConstraints17.gridy = 0;
gridBagConstraints17.weightx = 1.0;
gridBagConstraints17.gridx = 5;
GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
gridBagConstraints16.gridx = 4;
gridBagConstraints16.fill = GridBagConstraints.VERTICAL;
gridBagConstraints16.gridy = 0;
jLabel2 = new JLabel();
jLabel2.setText("JLabel");
GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
gridBagConstraints14.gridx = 2;
gridBagConstraints14.fill = GridBagConstraints.VERTICAL;
gridBagConstraints14.gridy = 0;
jLabel1 = new JLabel();
jLabel1.setText("JLabel");
GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
gridBagConstraints15.fill = GridBagConstraints.BOTH;
gridBagConstraints15.gridy = 0;
gridBagConstraints15.weightx = 1.0;
gridBagConstraints15.gridx = 3;
GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
gridBagConstraints13.fill = GridBagConstraints.BOTH;
gridBagConstraints13.gridy = 0;
gridBagConstraints13.weightx = 1.0;
gridBagConstraints13.gridx = 1;
jLabel = new JLabel();
jLabel.setText("Teste de teste");
jPanel2 = new JPanel();
jPanel2.setLayout(new GridBagLayout());
jPanel2.add(jLabel, gridBagConstraints24);
jPanel2.add(getJTextField(), gridBagConstraints13);
jPanel2.add(getJTextField1(), gridBagConstraints15);
jPanel2.add(jLabel1, gridBagConstraints14);
jPanel2.add(jLabel2, gridBagConstraints16);
jPanel2.add(getJTextField2(), gridBagConstraints17);
jPanel2.add(jLabel3, gridBagConstraints18);
jPanel2.add(jLabel4, gridBagConstraints19);
jPanel2.add(jLabel5, gridBagConstraints20);
jPanel2.add(getJTextField3(), gridBagConstraints21);
jPanel2.add(getJTextField4(), gridBagConstraints22);
jPanel2.add(getJTextField5(), gridBagConstraints23);
}
return jPanel2;
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
}
return jTextField;
}
/**
* This method initializes jTextField1
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField1() {
if (jTextField1 == null) {
jTextField1 = new JTextField();
}
return jTextField1;
}
/**
* This method initializes jTextField2
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField2() {
if (jTextField2 == null) {
jTextField2 = new JTextField();
}
return jTextField2;
}
/**
* This method initializes jTextField3
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField3() {
if (jTextField3 == null) {
jTextField3 = new JTextField();
}
return jTextField3;
}
/**
* This method initializes jTextField4
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField4() {
if (jTextField4 == null) {
jTextField4 = new JTextField();
}
return jTextField4;
}
/**
* This method initializes jTextField5
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField5() {
if (jTextField5 == null) {
jTextField5 = new JTextField();
}
return jTextField5;
}
/**
* This method initializes jPanel3
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel3() {
if (jPanel3 == null) {
GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
gridBagConstraints5.anchor = GridBagConstraints.NORTHWEST;
gridBagConstraints5.gridwidth = 1;
gridBagConstraints5.gridx = 0;
gridBagConstraints5.gridy = 0;
gridBagConstraints5.ipadx = 46;
gridBagConstraints5.ipady = 85;
gridBagConstraints5.weightx = 100.0D;
gridBagConstraints5.fill = GridBagConstraints.VERTICAL;
gridBagConstraints5.insets = new Insets(0, 0, 0, 0);
GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
gridBagConstraints4.anchor = GridBagConstraints.SOUTHWEST;
gridBagConstraints4.insets = new Insets(0, 0, 0, 0);
gridBagConstraints4.gridwidth = 1;
gridBagConstraints4.gridx = 0;
gridBagConstraints4.gridy = 1;
gridBagConstraints4.ipadx = 0;
gridBagConstraints4.weightx = 1.0;
gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
jPanel3 = new JPanel();
jPanel3.setLayout(new GridBagLayout());
jPanel3.add(getTfAgentName(), gridBagConstraints4);
jPanel3.add(lblAgentPicture, gridBagConstraints5);
}
return jPanel3;
}
/**
* This method initializes jPanel4
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel4() {
if (jPanel4 == null) {
FlowLayout flowLayout = new FlowLayout();
flowLayout.setHgap(110);
flowLayout.setVgap(0);
jPanel4 = new JPanel();
jPanel4.setLayout(flowLayout);
jPanel4.add(lblAgentMinus, null);
jPanel4.add(lblAgentProperties, null);
jPanel4.add(lblAgentPlus, null);
}
return jPanel4;
}
/**
* This method initializes jPanel5
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel5() {
if (jPanel5 == null) {
jPanel5 = new JPanel();
jPanel5.setLayout(new GridBagLayout());
}
return jPanel5;
}
/**
* This method initializes jPanel6
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel6() {
if (jPanel6 == null) {
GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
gridBagConstraints9.gridx = 0;
gridBagConstraints9.ipadx = 610;
gridBagConstraints9.ipady = 404;
gridBagConstraints9.gridy = 0;
jPanel6 = new JPanel();
grid = new Grid(56,37,10,10);
grid.setName("grid");
grid.setBackground(Color.WHITE);
grid.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent e) {
grid.setSelectedSquare(e.getX(),e.getY());
grid.repaint();
}
});
jPanel6.setLayout(new GridBagLayout());
jPanel6.add(grid, gridBagConstraints9);
}
return jPanel6;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SwingUtilities.invokeLater(new Runnable() {
public void run() {
MainFrame thisClass = new MainFrame();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
}
});
}
/**
* This is the default constructor
*/
public MainFrame() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(800, 600);
this.setJMenuBar(getJJMenuBar());
this.setContentPane(getPnContent());
this.setTitle("EcoSimul");
this.setVisible(true);
}
/**
* This method initializes pnContent
*
* @return javax.swing.JPanel
*/
private JPanel getPnContent() {
if (pnContent == null) {
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.anchor = GridBagConstraints.NORTHEAST;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.gridy = 1;
GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
gridBagConstraints12.fill = GridBagConstraints.BOTH;
gridBagConstraints12.gridy = 0;
gridBagConstraints12.weightx = 1.0;
gridBagConstraints12.weighty = 1.0;
gridBagConstraints12.gridheight = 2;
gridBagConstraints12.anchor = GridBagConstraints.NORTHWEST;
gridBagConstraints12.gridwidth = 2;
gridBagConstraints12.insets = new Insets(1, 1, 1, 0);
gridBagConstraints12.gridx = 0;
GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
gridBagConstraints11.anchor = GridBagConstraints.SOUTHEAST;
gridBagConstraints11.insets = new Insets(0, 0, 1, 1);
gridBagConstraints11.gridx = 2;
gridBagConstraints11.gridy = 2;
gridBagConstraints11.ipadx = 165;
gridBagConstraints11.ipady = 122;
gridBagConstraints11.fill = GridBagConstraints.NONE;
GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
gridBagConstraints1.insets = new Insets(1, 1, 1, 0);
gridBagConstraints1.gridy = 2;
gridBagConstraints1.ipadx = 0;
gridBagConstraints1.ipady = 123;
gridBagConstraints1.anchor = GridBagConstraints.SOUTHWEST;
gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints1.gridwidth = 2;
gridBagConstraints1.gridheight = 1;
gridBagConstraints1.gridx = 0;
pnContent = new JPanel();
pnContent.setLayout(new GridBagLayout());
pnContent.setName("");
pnContent.add(getPnProperties(), gridBagConstraints1);
pnContent.add(getPnEnvironnment(), gridBagConstraints11);
pnContent.add(getPnMap(), gridBagConstraints12);
pnContent.add(getJPanel(), gridBagConstraints);
}
return pnContent;
}
} |
Partager