Skip to content

Commit 7f01c6d

Browse files
Project Delivered
1 parent d627a24 commit 7f01c6d

File tree

1 file changed

+92
-3
lines changed

1 file changed

+92
-3
lines changed

Mini-Project/28/README.md

+92-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,99 @@
11
# 20CYS383 Java Programming Lab
22
![](https://img.shields.io/badge/Batch-21CYS-lightgreen) ![](https://img.shields.io/badge/UG-blue) ![](https://img.shields.io/badge/Subject-JPL-blue)
33

4-
### JPL-XX
4+
## Ship Detection
55

6-
#### Team Members
6+
### Project Description
77

88

9-
### Deliverables
9+
### Module Split-up
1010

11+
| Name | Topic |
12+
|------|-------|
13+
14+
### Code
15+
16+
#### Main-Activity in Java
17+
```
18+
package com.amrita.jpl.cys21090.pract;
19+
import javax.swing.*;
20+
import java.awt.*;
21+
import java.awt.event.ActionEvent;
22+
import java.awt.event.ActionListener;
23+
import java.io.File;
24+
25+
public class di {
26+
private static JLabel inputImage;
27+
private static JLabel outputImage;
28+
29+
public static void main(String[] args) {
30+
JFrame frame = new JFrame("JAVA_UI_APPLICATION_MULTI_MEDIA");
31+
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
32+
frame.setSize(800, 600);
33+
frame.getContentPane().setBackground(Color.LIGHT_GRAY);
34+
35+
// Creating the topic label
36+
JLabel topicLabel = new JLabel("SHIP DETECTION USING ARIAL IMAGES ");
37+
topicLabel.setFont(new Font("Arial", Font.BOLD, 24));
38+
topicLabel.setHorizontalAlignment(JLabel.CENTER);
39+
topicLabel.setBounds(100, 50, 600, 50);
40+
topicLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
41+
frame.add(topicLabel);
42+
43+
// Creating the input image column
44+
JLabel inputLabel = new JLabel("INPUT IMAGE");
45+
inputLabel.setBounds(100, 250, 100, 25);
46+
inputLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
47+
frame.add(inputLabel);
48+
49+
// Creating the output image column
50+
JLabel outputLabel = new JLabel("OUTPUT IMAGE");
51+
outputLabel.setBounds(500, 250, 100, 25);
52+
outputLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
53+
frame.add(outputLabel);
54+
55+
// Creating the input image label
56+
inputImage = new JLabel();
57+
inputImage.setBounds(100, 290, 200, 150);
58+
inputImage.setBorder(BorderFactory.createLineBorder(Color.BLACK));
59+
frame.add(inputImage);
60+
61+
// Creating the output image label
62+
outputImage = new JLabel();
63+
outputImage.setBounds(500, 290, 200, 150);
64+
outputImage.setBorder(BorderFactory.createLineBorder(Color.BLACK));
65+
frame.add(outputImage);
66+
67+
// Creating the footer label
68+
JLabel footerLabel = new JLabel("Credits: @monish @sudeepv @yuvarajkumar");
69+
footerLabel.setHorizontalAlignment(JLabel.CENTER);
70+
footerLabel.setBounds(0, 500, 900, 25);
71+
footerLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
72+
frame.add(footerLabel);
73+
74+
// Creating the file chooser button
75+
JButton fileChooserButton = new JButton("Upload Image");
76+
fileChooserButton.setBounds(350, 400, 100, 25);
77+
frame.add(fileChooserButton);
78+
79+
// File chooser action listener
80+
fileChooserButton.addActionListener(new ActionListener() {
81+
public void actionPerformed(ActionEvent e) {
82+
JFileChooser fileChooser = new JFileChooser();
83+
int result = fileChooser.showOpenDialog(frame);
84+
if (result == JFileChooser.APPROVE_OPTION) {
85+
File selectedFile = fileChooser.getSelectedFile();
86+
ImageIcon imageIcon = new ImageIcon(selectedFile.getAbsolutePath());
87+
inputImage.setIcon(imageIcon);
88+
outputImage.setIcon(imageIcon);
89+
}
90+
}
91+
});
92+
93+
frame.setLayout(null);
94+
frame.setVisible(true);
95+
}
96+
}
97+
```
98+
99+
#### Screenshots

0 commit comments

Comments
 (0)