Skip to content

Instantly share code, notes, and snippets.

@ornirus
Last active December 25, 2015 12:37
Show Gist options
  • Save ornirus/2c61aebbc6540e9d1b1e to your computer and use it in GitHub Desktop.
Save ornirus/2c61aebbc6540e9d1b1e to your computer and use it in GitHub Desktop.
package com.company;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class GUI extends JFrame
implements ActionListener {
int gridX = 10, gridY = 10;
Plot[][] grid;
private JPanel panel;
public void createGUI() {
setSize(750, 600);
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container window = getContentPane();
window.setLayout(new FlowLayout());
panel = new JPanel();
panel.setPreferredSize(new Dimension(300, 200));
panel.setBackground(Color.white);
window.add(panel);
setVisible(true);
}
public void actionPerformed(ActionEvent event) {
Graphics paper = panel.getGraphics();
paper.drawLine(0, 0, 100, 100);
}
private void createGrid() {
grid = new Plot[gridX][gridY];
for (int i = 0; i < grid.length; i++) {
for (int j = 0; j < grid[0].length; j++) {
grid[i][j] = new Plot();
}
}
}
}
package com.company;
public class Main {
public static void main(String[] args) {
GUI gui = new GUI();
gui.createGUI();
}
}
package com.company;
public class Plot {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment