Skip to content
Snippets Groups Projects
Commit 9fc20818 authored by LABOUREL Arnaud's avatar LABOUREL Arnaud
Browse files

Corrected files in order to pass checkstyle

parent f961f589
No related branches found
No related tags found
No related merge requests found
...@@ -8,8 +8,6 @@ plugins { ...@@ -8,8 +8,6 @@ plugins {
group 'fr.univ_amu' group 'fr.univ_amu'
version '1.0-SNAPSHOT' version '1.0-SNAPSHOT'
checkstyle { checkstyle {
toolVersion = '10.3.4' toolVersion = '10.3.4'
} }
...@@ -19,14 +17,11 @@ repositories { ...@@ -19,14 +17,11 @@ repositories {
} }
dependencies { dependencies {
checkstyle "com.puppycrawl.tools:checkstyle:10.3.4"
testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.0', testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.0',
'org.assertj:assertj-core:3.23.1') 'org.assertj:assertj-core:3.23.1')
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
} }
test { test {
finalizedBy jacocoTestReport // report is always generated after tests run finalizedBy jacocoTestReport // report is always generated after tests run
} }
...@@ -34,8 +29,6 @@ jacocoTestReport { ...@@ -34,8 +29,6 @@ jacocoTestReport {
dependsOn test // tests are required to run before generating the report dependsOn test // tests are required to run before generating the report
} }
test { test {
useJUnitPlatform() useJUnitPlatform()
} }
......
package sample; package sample;
import javax.swing.*; import javax.swing.JFrame;
//import java.awt.*;
public class MyJFrame extends JFrame{ /**
public MyJFrame(){ * An extended version of javax.swing.JFrame containing a panel to draw images.
*/
public class MyJavaFrame extends JFrame {
/**
* Constructs a new visible frame.
*/
public MyJavaFrame() {
setTitle("Main window"); setTitle("Main window");
setSize(400, 400); setSize(400, 400);
setLocationRelativeTo(null); setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
add(new MyJPanel()); add(new MyJavaPanel());
setVisible(true); setVisible(true);
} }
public static void main(String[] args) { public static void main(String[] args) {
MyJFrame app = new MyJFrame(); new MyJavaFrame();
} }
} }
package sample; package sample;
import javax.imageio.ImageIO; import java.awt.Graphics;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
public class MyJPanel extends JPanel { /**
* An extension of javax.swing.JFrame that can draw images.
*/
public class MyJavaPanel extends JPanel {
private BufferedImage image; private BufferedImage image;
/**
* Constructs a new panel that draw an image.
*/
public MyJPanel() { public MyJavaPanel() {
try { try {
image = ImageIO.read(getClass().getResource("image.png")); image = ImageIO.read(Objects.requireNonNull(getClass().getResource("image.png")));
} catch (IOException ex) { } catch (IOException ex) {
System.out.println("problem! image can't be loaded!"); System.out.println("problem! image can't be loaded!");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment