Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added IMAGE-VIEWER/HOME.PNG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added IMAGE-VIEWER/ImageViewer.java
Empty file.
34 changes: 34 additions & 0 deletions IMAGE-VIEWER/README (1).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# IMAGE VIEWER

## Introduction
Image viewer application with a user-friendly graphical interface to facilitate seamless browsing and organization of image files. The application should enable users to effortlessly view images.

## Usage
1. User-Friendly Interface: Design an intuitive interface that allows users to navigate through their image collections effortlessly.
2. Responsive Design: Ensure the application's interface is responsive and adaptable to different screen sizes and resolutions for optimal user experience across various devices.

## Example
![HOME](HOME.PNG.png)
![HOME](UI.PNG.png)
![HOME](RESULT.PNG.png)

## TECH STACK
1. JAVA
2. SWING

## How it Works

Upon launching the application, users are presented with a user-friendly interface that displays thumbnails or a list of available image files.
The UI may include navigation controls such as buttons, sliders, or gestures to facilitate browsing through images.
Image Selection:

Users can select an image file either by clicking on its thumbnail or by navigating through the list of images using provided controls.
Once an image is selected, it is loaded into the viewer for display.
Image Viewing:

The selected image is displayed within the application's viewer window at an appropriate size.


## Contribution
Contributions are welcome! Feel free to submit issues or pull requests.

Binary file added IMAGE-VIEWER/RESULT.PNG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added IMAGE-VIEWER/UI.PNG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
164 changes: 164 additions & 0 deletions TEXT_EDITOR/TextEditor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.filechooser.*;

public class TextEditor extends JFrame implements ActionListener{

JTextArea textArea;
JScrollPane scrollPane;
JLabel fontLabel;
JSpinner fontSizeSpinner;
JButton fontColorButton;
JComboBox fontBox;

JMenuBar menuBar;
JMenu fileMenu;
JMenuItem openItem;
JMenuItem saveItem;
JMenuItem exitItem;

TextEditor(){
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle("Bro text Editor");
this.setSize(500, 500);
this.setLayout(new FlowLayout());
this.setLocationRelativeTo(null);

textArea = new JTextArea();
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setFont(new Font("Arial",Font.PLAIN,20));

scrollPane = new JScrollPane(textArea);
scrollPane.setPreferredSize(new Dimension(1150,650));
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

fontLabel = new JLabel("Font: ");

fontSizeSpinner = new JSpinner();
fontSizeSpinner.setPreferredSize(new Dimension(50,25));
fontSizeSpinner.setValue(20);
fontSizeSpinner.addChangeListener(new ChangeListener() {

@Override
public void stateChanged(ChangeEvent e) {

textArea.setFont(new Font(textArea.getFont().getFamily(),Font.PLAIN,(int) fontSizeSpinner.getValue()));
}

});

fontColorButton = new JButton("Color");
fontColorButton.addActionListener(this);

String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

fontBox = new JComboBox<>(fonts);
fontBox.addActionListener(this);
fontBox.setSelectedItem("Arial");

// ----- menubar -----

menuBar = new JMenuBar();
fileMenu = new JMenu("File");
openItem = new JMenuItem("Open");
saveItem = new JMenuItem("Save");
exitItem = new JMenuItem("Exit");

openItem.addActionListener(this);
saveItem.addActionListener(this);
exitItem.addActionListener(this);

fileMenu.add(openItem);
fileMenu.add(saveItem);
fileMenu.add(exitItem);
menuBar.add(fileMenu);

// ----- /menubar -----

this.setJMenuBar(menuBar);
this.add(fontLabel);
this.add(fontSizeSpinner);
this.add(fontColorButton);
this.add(fontBox);
this.add(scrollPane);
this.setVisible(true);
}

@Override
public void actionPerformed(ActionEvent e) {

if(e.getSource()==fontColorButton) {
JColorChooser colorChooser = new JColorChooser();

Color color = colorChooser.showDialog(null, "Choose a color", Color.black);

textArea.setForeground(color);
}

if(e.getSource()==fontBox) {
textArea.setFont(new Font((String)fontBox.getSelectedItem(),Font.PLAIN,textArea.getFont().getSize()));
}

if(e.getSource()==openItem) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File("."));
FileNameExtensionFilter filter = new FileNameExtensionFilter("Text files", "txt");
fileChooser.setFileFilter(filter);

int response = fileChooser.showOpenDialog(null);

if(response == JFileChooser.APPROVE_OPTION) {
File file = new File(fileChooser.getSelectedFile().getAbsolutePath());
Scanner fileIn = null;

try {
fileIn = new Scanner(file);
if(file.isFile()) {
while(fileIn.hasNextLine()) {
String line = fileIn.nextLine()+"\n";
textArea.append(line);
}
}
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
finally {
fileIn.close();
}
}
}
if(e.getSource()==saveItem) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new File("."));

int response = fileChooser.showSaveDialog(null);

if(response == JFileChooser.APPROVE_OPTION) {
File file;
PrintWriter fileOut = null;

file = new File(fileChooser.getSelectedFile().getAbsolutePath());
try {
fileOut = new PrintWriter(file);
fileOut.println(textArea.getText());
}
catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
finally {
fileOut.close();
}
}
}
if(e.getSource()==exitItem) {
System.exit(0);
}
}
}
8 changes: 8 additions & 0 deletions TEXT_EDITOR/basic.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public class basic {

public static void main(String[] args) {

new TextEditor();

}
}
8 changes: 8 additions & 0 deletions TEXT_EDITOR/max.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
asdfasefeqw
erfq
wr
q
wre

qwre
qwre
Binary file added TEXT_EDITOR/overview.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions TEXT_EDITOR/readme2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Basic Text Editor

## Introduction
The Java Text Editor is a versatile application designed to facilitate text editing tasks for users. It boasts a user-friendly graphical interface and essential functionalities for creating, editing, and saving text documents. Additionally, the application allows users to edit multiple text files simultaneously and provides features for formatting text, including color, font, and size adjustments.

## Usage
1. Opening and Creating Text Files.
2. Editing Text.
3. Formatting Text.
4. Saving Files.

## Sample
![image](overview.jpeg)

## Getting Started
To run the project locally, follow these steps:

1. Clone the repository.
2. Navigate to the project directory.
3. ``` bash
compile using this command -> javac basic.java
run using this commad -> java basic.java



## Dependencies
- open jdk must be installed on your device



## Contribution
Contributions are welcome! Feel free to submit issues or pull requests.