diff --git a/IMAGE-VIEWER/HOME.PNG.png b/IMAGE-VIEWER/HOME.PNG.png new file mode 100644 index 0000000..175be97 Binary files /dev/null and b/IMAGE-VIEWER/HOME.PNG.png differ diff --git a/IMAGE-VIEWER/ImageViewer.java b/IMAGE-VIEWER/ImageViewer.java new file mode 100644 index 0000000..e69de29 diff --git a/IMAGE-VIEWER/README (1).md b/IMAGE-VIEWER/README (1).md new file mode 100644 index 0000000..8e629a3 --- /dev/null +++ b/IMAGE-VIEWER/README (1).md @@ -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. + diff --git a/IMAGE-VIEWER/RESULT.PNG.png b/IMAGE-VIEWER/RESULT.PNG.png new file mode 100644 index 0000000..2a9b38a Binary files /dev/null and b/IMAGE-VIEWER/RESULT.PNG.png differ diff --git a/IMAGE-VIEWER/UI.PNG.png b/IMAGE-VIEWER/UI.PNG.png new file mode 100644 index 0000000..9958703 Binary files /dev/null and b/IMAGE-VIEWER/UI.PNG.png differ diff --git a/TEXT_EDITOR/TextEditor.java b/TEXT_EDITOR/TextEditor.java new file mode 100644 index 0000000..6a51546 --- /dev/null +++ b/TEXT_EDITOR/TextEditor.java @@ -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); + } + } +} \ No newline at end of file diff --git a/TEXT_EDITOR/basic.java b/TEXT_EDITOR/basic.java new file mode 100644 index 0000000..6af7dff --- /dev/null +++ b/TEXT_EDITOR/basic.java @@ -0,0 +1,8 @@ +public class basic { + + public static void main(String[] args) { + + new TextEditor(); + + } +} \ No newline at end of file diff --git a/TEXT_EDITOR/max.txt b/TEXT_EDITOR/max.txt new file mode 100644 index 0000000..4e1a17f --- /dev/null +++ b/TEXT_EDITOR/max.txt @@ -0,0 +1,8 @@ +asdfasefeqw +erfq +wr +q +wre + +qwre +qwre \ No newline at end of file diff --git a/TEXT_EDITOR/overview.jpeg b/TEXT_EDITOR/overview.jpeg new file mode 100644 index 0000000..d572cd1 Binary files /dev/null and b/TEXT_EDITOR/overview.jpeg differ diff --git a/TEXT_EDITOR/readme2.md b/TEXT_EDITOR/readme2.md new file mode 100644 index 0000000..0e67aec --- /dev/null +++ b/TEXT_EDITOR/readme2.md @@ -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. \ No newline at end of file