original commit

This commit is contained in:
Matthis FAUVET 2024-06-23 01:39:58 +02:00
commit 40dc71ab03
15 changed files with 134 additions and 0 deletions

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/InfiniteGridMap.iml" filepath="$PROJECT_DIR$/InfiniteGridMap.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

11
InfiniteGridMap.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,2 @@
public class CustomController {
}

31
src/CustomListener.java Normal file
View File

@ -0,0 +1,31 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class CustomListener implements MouseListener {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println("x deb"+e.getX());
System.out.println("y deb"+e.getY());
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
System.out.println("x fin"+e.getX());
System.out.println("y fin"+e.getY());
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
}

25
src/CustomPanel.java Normal file
View File

@ -0,0 +1,25 @@
import javax.swing.*;
import java.awt.*;
public class CustomPanel extends JPanel {
private int width = 1920;
private int height = 1080;
public CustomPanel() {
setBackground(Color.WHITE);
}
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics g2 = g.create();
g2.setColor(Color.BLACK);
for(int x=0; x<width; x=x+50){
g2.drawLine(x, 0, x, 1080);
}
for(int y=0; y<height; y=y+50){
g2.drawLine(0, y, 1920, y);
}
}
}

9
src/Main.java Normal file
View File

@ -0,0 +1,9 @@
public class Main {
public static void main(String[] args) {
View view = new View();
view.setVisible(true);
System.out.println(view.getWidth());
System.out.println(view.getHeight());
}
}

17
src/View.java Normal file
View File

@ -0,0 +1,17 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
public class View extends JFrame {
public View(){
setLocationRelativeTo(null);
setSize(new Dimension(1920, 1080));
CustomPanel p = new CustomPanel();
CustomListener c = new CustomListener();
add(p);
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}

11
untitled.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>