forked from Jossellin.Herrera/ProjectAscii-Art
proyecto ascii
This commit is contained in:
parent
23a00bad04
commit
072fa0e41b
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
5
a.java
5
a.java
|
@ -1,5 +0,0 @@
|
|||
public class a {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("SADSA");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
package org.example;
|
||||
public class Computadora extends Lienzo{
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
public Computadora(int ancho, int alto, char lienzo [][]) {
|
||||
super(ancho, alto, lienzo);
|
||||
}
|
||||
|
||||
public void pintarComputadora1(char[][] lienzo){
|
||||
this.setPen(1, 1, '.');
|
||||
this.setPen(2, 1, '|');
|
||||
this.setPen(3, 1, '|');
|
||||
this.setPen(4, 1, '|');
|
||||
this.setPen(5, 1, '|');
|
||||
this.setPen(6, 1, '|');
|
||||
this.setPen(1, 2, '-');
|
||||
this.setPen(1, 3, '-');
|
||||
this.setPen(1, 4, '.');
|
||||
this.setPen(2, 4, '|');
|
||||
this.setPen(3, 4, '|');
|
||||
this.setPen(4, 4, '|');
|
||||
this.setPen(5, 4, '|');
|
||||
this.setPen(6, 4, '|');
|
||||
this.setPen(6, 3, '_');
|
||||
this.setPen(6, 2, '_');
|
||||
this.setPen(2, 3, '_');
|
||||
this.setPen(2, 2, '_');
|
||||
this.setPen(3, 3, '.');
|
||||
this.setPen(3, 2, '=');
|
||||
this.setPen(4, 2, '-');
|
||||
this.setPen(4, 3, '-');
|
||||
this.setPen(6, 5, '~');
|
||||
this.setPen(6, 6, '°');
|
||||
this.setPen(5, 6, '|');
|
||||
this.setPen(4, 6, '|');
|
||||
this.setPen(3, 6, '|');
|
||||
this.setPen(2, 6, '.');
|
||||
this.setPen(6, 7, ')');
|
||||
this.setPen(5, 7, '°');
|
||||
this.setPen(4, 7, '|');
|
||||
this.setPen(3, 7, '.');
|
||||
this.setPen(2, 7, '-');
|
||||
this.setPen(6, 8, '_');
|
||||
this.setPen(5, 8, '-');
|
||||
this.setPen(3, 8, '-');
|
||||
this.setPen(2, 8, '-');
|
||||
this.setPen(6, 9, '_');
|
||||
this.setPen(5, 9, '-');
|
||||
this.setPen(4, 9, 'K');
|
||||
this.setPen(3, 9, '-');
|
||||
this.setPen(2, 9, '-');
|
||||
this.setPen(6, 10, '_');
|
||||
this.setPen(5, 10, '-');
|
||||
this.setPen(4, 10, 'C');
|
||||
this.setPen(3, 10, '-');
|
||||
this.setPen(2, 10, '-');
|
||||
this.setPen(6, 11, '_');
|
||||
this.setPen(5, 11, '-');
|
||||
this.setPen(4, 11, 'K');
|
||||
this.setPen(3, 11, '-');
|
||||
this.setPen(2, 11, '-');
|
||||
this.setPen(6, 12, '_');
|
||||
this.setPen(5, 12, '-');
|
||||
this.setPen(3, 12, '-');
|
||||
this.setPen(2, 12, '-');
|
||||
this.setPen(6, 13, '(');
|
||||
this.setPen(5, 13, '°');
|
||||
this.setPen(4, 13, '|');
|
||||
this.setPen(3, 13, '.');
|
||||
this.setPen(2, 13, '-');
|
||||
this.setPen(6, 14, '°');
|
||||
this.setPen(5, 14, '|');
|
||||
this.setPen(4, 14, '|');
|
||||
this.setPen(3, 14, '|');
|
||||
this.setPen(2, 14, '.');
|
||||
}
|
||||
public void pintarComputadora2(char[][] lienzo){
|
||||
for(int i = 0; i < 20; i ++){
|
||||
this.setPen(12,i,'-');
|
||||
}
|
||||
this.setPen(11, 1, '/');
|
||||
for(int i = 4; i < 16; i ++){
|
||||
this.setPen(11,i,'*');
|
||||
}
|
||||
this.setPen(11, 18, '\\');
|
||||
this.setPen(10, 3, '/');
|
||||
for(int i = 5; i < 15; i ++){
|
||||
this.setPen(10,i,'*');
|
||||
}
|
||||
this.setPen(10, 16, '\\');
|
||||
this.setPen(9, 4, '_');
|
||||
this.setPen(9, 5, '|');
|
||||
this.setPen(9, 6, '_');
|
||||
this.setPen(9, 7, '_');
|
||||
this.setPen(9, 8, '|');
|
||||
this.setPen(9, 9, '/');
|
||||
this.setPen(9, 11, '\\');
|
||||
this.setPen(9, 12, '|');
|
||||
this.setPen(9, 13, '_');
|
||||
this.setPen(9, 14, '|');
|
||||
this.setPen(9, 15, '_');
|
||||
for(int i = 16; i < 29; i ++){
|
||||
this.setPen(9,i,'.');
|
||||
}
|
||||
for(int i = 8; i > 1; i --){
|
||||
this.setPen(i, 2, '|');
|
||||
}
|
||||
for(int i = 3; i < 8; i++){
|
||||
this.setPen(8, i, '_');
|
||||
}
|
||||
this.setPen(8,8,'|');
|
||||
this.setPen(8, 9, '\\');
|
||||
this.setPen(8, 10, '_');
|
||||
this.setPen(8, 11, '/');
|
||||
this.setPen(8,12 , '|');
|
||||
for(int i = 13; i < 18; i++){
|
||||
this.setPen(8, i, '_');
|
||||
}
|
||||
for(int i = 8; i > 1; i --){
|
||||
this.setPen(i, 18, '|');
|
||||
}
|
||||
for(int i = 3; i < 18; i++){
|
||||
this.setPen(1, i, '_');
|
||||
}
|
||||
for(int i = 7; i > 2; i--){
|
||||
this.setPen(i, 4, '|');
|
||||
}
|
||||
for(int i = 5; i<16; i++){
|
||||
this.setPen(2, i, '_');
|
||||
}
|
||||
for(int i = 7; i > 2; i--){
|
||||
this.setPen(i, 16, '|');
|
||||
}
|
||||
this.setPen(7, 5, '_');
|
||||
this.setPen(7, 6, '_');
|
||||
this.setPen(7, 7, '_');
|
||||
this.setPen(7, 13, '_');
|
||||
this.setPen(7, 14, '_');
|
||||
this.setPen(7, 15, '_');
|
||||
this.setPen(6, 8, '\\');
|
||||
this.setPen(6, 9, '_');
|
||||
this.setPen(6, 10, '_');
|
||||
this.setPen(6, 11, '_');
|
||||
this.setPen(6, 12, '/');
|
||||
this.setPen(5, 10, '-');
|
||||
this.setPen(4, 8, '0');
|
||||
this.setPen(4, 12, '0');
|
||||
this.setPen(9, 29, '*');
|
||||
this.setPen(8, 27, '.');
|
||||
this.setPen(8, 28, '*');
|
||||
this.setPen(8, 29, '*');
|
||||
this.setPen(8, 30, '*');
|
||||
this.setPen(8, 28, '*');
|
||||
this.setPen(8, 31, '.');
|
||||
this.setPen(7, 26, '.');
|
||||
this.setPen(7, 27, '*');
|
||||
this.setPen(7, 28, '*');
|
||||
this.setPen(7, 29, '*');
|
||||
this.setPen(7, 30, '*');
|
||||
this.setPen(7, 31, '*');
|
||||
this.setPen(7, 32, '.');
|
||||
this.setPen(6, 25, '.');
|
||||
for(int i = 26; i<33; i++){
|
||||
this.setPen(6, i, '*');
|
||||
}
|
||||
this.setPen(6, 33, '.');
|
||||
this.setPen(5, 24, '.');
|
||||
for(int i = 25; i<34; i++){
|
||||
this.setPen(5, i, '*');
|
||||
}
|
||||
this.setPen(5, 34, '.');
|
||||
this.setPen(4, 23, '.');
|
||||
for(int i = 24; i<29; i++){
|
||||
this.setPen(4, i, '*');
|
||||
}
|
||||
this.setPen(4, 29, '.');
|
||||
for(int i = 30; i<35; i++){
|
||||
this.setPen(4, i, '*');
|
||||
}
|
||||
this.setPen(4, 35, '.');
|
||||
this.setPen(3, 23, '.');
|
||||
for(int i = 24; i<28; i++){
|
||||
this.setPen(3, i, '*');
|
||||
}
|
||||
this.setPen(3, 28, '.');
|
||||
this.setPen(3, 30, '.');
|
||||
for(int i = 31; i<35; i++){
|
||||
this.setPen(3, i, '*');
|
||||
}
|
||||
this.setPen(3, 35, '.');
|
||||
this.setPen(2, 24, '.');
|
||||
this.setPen(2, 25, '-');
|
||||
this.setPen(2, 26, '.');
|
||||
this.setPen(2, 32, '.');
|
||||
this.setPen(2, 33, '-');
|
||||
this.setPen(2, 34 , '.');
|
||||
|
||||
}
|
||||
public void pintarComputadora3(char[][] lienzo){}
|
||||
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
package org.example;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
private static void menuMain() {
|
||||
System.out.println("Bienvenido a AsciiArtAttack :)");
|
||||
System.out.println("¿Qué deseas hacer hoy? ");
|
||||
System.out.println("1.- Pintar figuras predeterminadas del sistema");
|
||||
System.out.println("2.- Pintar figuras predeterminadas por archivos TXT");
|
||||
System.out.println("3.- Realizar un Ascii Art manualmente y guardarlo");
|
||||
System.out.println("4.- Salir del Sistema");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner entrada = new Scanner(System.in);
|
||||
Scanner entrada2 = new Scanner(System.in);
|
||||
Scanner entrada3 = new Scanner(System.in);
|
||||
int opcion, opcion2, opcion3;
|
||||
|
||||
do {
|
||||
System.out.println("Bienvenido a AsciiArtAttack :)");
|
||||
System.out.println("¿Qué deseas hacer hoy? ");
|
||||
System.out.println("1.- Pintar figuras predeterminadas del sistema");
|
||||
System.out.println("2.- Pintar figuras predeterminadas por archivos TXT");
|
||||
System.out.println("3.- Realizar un Ascii Art manualmente y guardarlo");
|
||||
System.out.println("4.- Salir del Sistema");
|
||||
opcion = entrada.nextInt();
|
||||
|
||||
switch (opcion) {
|
||||
case 1:
|
||||
do {
|
||||
System.out.println("1.- Computadora normal");
|
||||
System.out.println("2.- Enamorado");
|
||||
System.out.println("3.- Salir");
|
||||
opcion2 = entrada2.nextInt();
|
||||
|
||||
switch (opcion2) {
|
||||
case 1: {
|
||||
char[][] lienzo = new char[15][65];
|
||||
Computadora computadora = new Computadora(15, 65, lienzo);
|
||||
computadora.prepararMatriz(lienzo, 15, 65);
|
||||
computadora.pintarComputadora1(lienzo);
|
||||
computadora.paint(15, 65, lienzo);
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
char[][] lienzo2 = new char[15][65];
|
||||
Computadora computadora2 = new Computadora(15, 65, lienzo2);
|
||||
computadora2.prepararMatriz(lienzo2, 15, 65);
|
||||
computadora2.pintarComputadora2(lienzo2);
|
||||
computadora2.paint(15, 65, lienzo2);
|
||||
break;
|
||||
}
|
||||
|
||||
case 3:
|
||||
menuMain();
|
||||
opcion = entrada.nextInt();
|
||||
break;
|
||||
|
||||
default:
|
||||
System.out.println("Digita una opcion correcta por favor");
|
||||
}
|
||||
} while (opcion2 != 3);
|
||||
|
||||
case 2:
|
||||
try {
|
||||
// Ruta del directorio que quieres listar
|
||||
System.out.println("Escribe el nombre del archivo Ascii Art que quieres imprimir:");
|
||||
String rutaDirectorio = "C:\\Users\\edgar\\OneDrive\\Escritorio\\6yo\\Desarrollo\\AscciArt";
|
||||
|
||||
// Crear un objeto File con la ruta del directorio
|
||||
File directorio = new File(rutaDirectorio);
|
||||
if (directorio.isDirectory()) {
|
||||
// Obtener la lista de archivos en el directorio
|
||||
File[] archivos = directorio.listFiles();
|
||||
|
||||
// Imprimir el nombre de cada archivo en la lista
|
||||
System.out.println("Archivos .txt en " + rutaDirectorio + ":");
|
||||
for (File archivo : archivos) {
|
||||
if (archivo.isFile() && archivo.getName().endsWith(".txt")) {
|
||||
System.out.println(archivo.getName());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("La ruta especificada no corresponde a un directorio válido.");
|
||||
}
|
||||
|
||||
Scanner tecladoTxt = new Scanner(System.in);
|
||||
String nombreTxt = tecladoTxt.next();
|
||||
|
||||
File file = new File(rutaDirectorio, nombreTxt);
|
||||
|
||||
if (!file.exists()) {
|
||||
System.out.println("El archivo especificado no existe.");
|
||||
break;
|
||||
}
|
||||
|
||||
Scanner reader = new Scanner(file);
|
||||
while (reader.hasNextLine()) {
|
||||
String line = reader.nextLine();
|
||||
System.out.println(line);
|
||||
Thread.sleep(500);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.out.println("Error de lectura/escritura: " + e.getMessage());
|
||||
} catch (InterruptedException e) {
|
||||
System.out.println("Interrupción de la ejecución: " + e.getMessage());
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
String line;
|
||||
StringBuilder asciiArt = new StringBuilder();
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("Bienvenido al creador de arte ASCII Art manual");
|
||||
System.out.println("Realiza tu Ascii Art línea por línea. Presiona Enter después de cada línea. Escribe 'fin' para terminar.");
|
||||
while (true) {
|
||||
line = scanner.nextLine();
|
||||
if (line.equals("fin")) {
|
||||
break;
|
||||
}
|
||||
asciiArt.append(line).append("\n");
|
||||
}
|
||||
do {
|
||||
System.out.println("Decide la opcion que deseas elegir ");
|
||||
System.out.println("1.- Guardar");
|
||||
System.out.println("2.- Visualizar");
|
||||
System.out.println("3.- Copiar en el portapapeles");
|
||||
System.out.println("4.- Salir de esta opcion");
|
||||
opcion3 = entrada3.nextInt();
|
||||
switch (opcion3) {
|
||||
case 1:
|
||||
System.out.println("Nombre para tu Ascii Art:");
|
||||
Scanner teclado = new Scanner(System.in);
|
||||
String nombre = teclado.next();
|
||||
try {
|
||||
FileWriter archivo = new FileWriter(nombre);
|
||||
archivo.write(String.valueOf(asciiArt));
|
||||
System.out.println("Ilustración guardada en " + nombre + ".txt");
|
||||
archivo.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error al guardar la ilustración: " + e.getMessage());
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
System.out.println(asciiArt);
|
||||
break;
|
||||
case 3:
|
||||
StringSelection seleccion = new StringSelection(String.valueOf(asciiArt));
|
||||
Clipboard portapapeles = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
portapapeles.setContents(seleccion, null);
|
||||
System.out.println("Texto copiado al portapapeles: ");
|
||||
break;
|
||||
case 4:
|
||||
menuMain();
|
||||
opcion = entrada.nextInt();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
} while (opcion3 != 4);
|
||||
case 4:
|
||||
System.out.println("Saliendo...");
|
||||
System.out.println("Que tengas un buen dia :)");
|
||||
default:
|
||||
System.out.println("Digita una opción correcta por favor...");
|
||||
break;
|
||||
}
|
||||
} while (opcion != 4);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue