Seguidores

MIS WEBS



lunes, 12 de marzo de 2018

PROCESADOR DE TEXTOS CON JAVA 11


Buenos días a todos y todas.



En el siguiente ejercicio aprenderemos a dejar la consola de eclipse con fondo negro y colocar iconos en nuestra aplicación de java







Tal y como os comento en el vídeo :
Para oscurecer el fondo de Eclipse:


  • Window
    • Preferences
      • Aparence
        • Theme
          • Modificamos de clasic a Darck


En cuanto a nuestro ejercicio, he cargado diferentes fotos en la carpeta src donde eclipse va generando nuestros archivos de código y luego se los pase por parámetros al constructor.




class LAMINA_BARRA extends JPanel {
             public LAMINA_BARRA() {
                    BarraMenu = new JMenuBar();      
                    BarraMenu.setBackground(Color.cyan);
                   
Icono_rojo=new ImageIcon("C:\\Users\\xx\\Desktop\\xx\\src/rojo.gif");
Icono_gris=new ImageIcon("C:\\Users\\xx\\Desktop\\xx\\src/gris.gif");
Icono_verde= new ImageIcon("C:\\Users\\xx\\Desktop\\xx\\src/verde.gif");
Icono_blanco= new ImageIcon("C:\\Users\\xx\\Desktop\\xx\\src/blanco.gif");
Icono_Negrita =   new ImageIcon("C:\\Users\\xx\\Desktop\\xx\\src/NEGRITA.png");
Icono_Cursiva =   new ImageIcon("C:\\Users\\xx\\Desktop\\xx\\src/CURSIVA.gif");
Icono_nc =        new ImageIcon("C:\\Users\\x\\Desktop\\x\\src/N.jpg");
Icono_ninguno =   new ImageIcon("C:\\Users\\x\\Desktop\\x\\src/N.jpg");
Icono_flcehaMenos=new ImageIcon("C:\\Users\\x\\Desktop\\xx\\src/flechaMeneos.gif");
Icono_flechaMasnew ImageIcon("C:\\\\Users\\\\x\\\\Desktop\\\\x\\\\src/flechamas.gif");
Icono_GUARDAR=    new ImageIcon("C:\\\\Users\\\\x\\\\Desktop\\\\x\\\\src/GUARDAR.gif");
Icono_GUARDAR_COMO= new ImageIcon("C:\\\\Users\\\\x\\\\Desktop\\\\x\\\\src/GUARDAR_COMO.png");
Icono_CORTAR=     new ImageIcon("C:\\\\Users\\\\x\\\\Desktop\\\\x\\\\src/CORTAR.gif");
Icono_PEGAR=      new ImageIcon("C:\\\\Users\\\\x\\\\Desktop\\\\x\\\\src/PEGAR.gif");
                   
                   
      
                   
                    constructorJMenu((new JMenu[] {Inicio,COP_PEG,}),BarraMenu,(new String[]{"inicio","copiar y pegar"}),(new JMenuItem[]  {GUARDAR,GUARDAR_COMO}),(new String[] {"GUARDAR","GUARDAR_COMO"}),(new JMenuItem[]  {COPIAR,PEGAR}),(new String[] {"COPIAR","PEGAR"}),(new ImageIcon[] {Icono_GUARDAR,Icono_GUARDAR_COMO}),(new ImageIcon[] {Icono_CORTAR,Icono_PEGAR}));
                    constructorJMenu(tIPO_LETRA,BarraMenu,"TIPO LETRA",(new JMenuItem[]  { NEGRITA,CURSIVA,SIN_FORMATO,NEGRITAYCURSIVA}),(new String[] {"NEGRITA","CURSIVA","SIN FORMATO","NEG + CURSI"}),(new ImageIcon[] {Icono_Negrita,Icono_Cursiva,Icono_nc,Icono_ninguno}));
                    constructorJMenu(TAMAÑO_LETRA,BarraMenu,"TAMAÑO_LETRA",(new JMenuItem[]  { ENTRE2,ENTRE10,ENTRE100,POR2,POR10,POR100}),(new String[] {"/ 2","/ 10","/ 100","X 2","X 10", "X 100"}),(new ImageIcon[] {Icono_flcehaMenos,Icono_flcehaMenos,Icono_flcehaMenos,Icono_flechaMas,Icono_flechaMas,Icono_flechaMas}));
                    constructorJMenu(VISTA,BarraMenu,"VISTA",(new JMenuItem[]  { GRIS,BLANCO,ROJO,VERDE}),(new String[] {"GRIS","BLANCO","ROJO","VERDE"}),(new ImageIcon[] {Icono_gris,Icono_blanco,Icono_rojo,Icono_verde}));               
                    add(BarraMenu);
             }
             private void constructorJMenu
             (JMenu NombreVariableJMenu,JMenuBar NombreDeLaBarra,String TextoMostradoJmenu,JMenuItem[] Items_del_menu,String[] SumbmenusInicio) {
                    NombreVariableJMenu = new JMenu(TextoMostradoJmenu);              
                    for (int i =0; i<Items_del_menu.length;i++) {
                           Items_del_menu[i]=  new JMenuItem (SumbmenusInicio[i]);
                           Items_del_menu[i].addActionListener(new ConstructorDEoyebtes());         
                           NombreVariableJMenu.add(Items_del_menu[i]);
                    }
                    NombreDeLaBarra.add(NombreVariableJMenu);
             }     
             private void constructorJMenu
             (JMenu NombreVariableJMenu,JMenuBar NombreDeLaBarra,String TextoMostradoJmenu,JMenuItem[] Items_del_menu,String[] SumbmenusInicio,ImageIcon[] foto) {
                    NombreVariableJMenu = new JMenu(TextoMostradoJmenu);              
                    for (int i =0; i<Items_del_menu.length;i++) {
                           Items_del_menu[i]=  new JMenuItem (SumbmenusInicio[i],foto[i]);
                           //pone la imagen a la derecha
                           //Items_del_menu[i].setHorizontalTextPosition(SwingConstants.LEFT);
                          
                           NombreVariableJMenu.add(Items_del_menu[i]);
                          
                           Items_del_menu[i].addActionListener(new StyledEditorKit.BoldAction());
                    }
                    NombreDeLaBarra.add(NombreVariableJMenu);
             }
      
            
             private void constructorJMenu
             (JMenu NombreVariableJMenu[],JMenuBar NombreDeLaBarra,String TextoMostradoJmenu[],JMenuItem[] Items_del_menu,String[] SumbmenusInicio,JMenuItem[] Items_del_submenu,String[] TEXTOS_SUBMENUS,ImageIcon[] fotoSubmenu,ImageIcon[] fotoSubSUBmenu) {
                          
                           NombreVariableJMenu[0] = new JMenu(TextoMostradoJmenu[0]); 
                           NombreVariableJMenu[1] = new JMenu(TextoMostradoJmenu[1]); 
                   
                    for (int i =0; i<Items_del_menu.length;i++) {
                  Items_del_menu[i]=  new JMenuItem (SumbmenusInicio[i],fotoSubmenu[i]);
                Items_del_menu[i].addActionListener(new ConstructorDEoyebtes());         
                           NombreVariableJMenu[0].add(Items_del_menu[i]);
                    }
                   
                    NombreVariableJMenu[0].add(NombreVariableJMenu[1]);
                    for (int i =0; i<Items_del_submenu.length;i++) {
         Items_del_submenu[i]= new JMenuItem (TEXTOS_SUBMENUS[i],fotoSubSUBmenu[i]);
         Items_del_submenu[i].addActionListener(new ConstructorDEoyebtes());      
                           NombreVariableJMenu[1].add(Items_del_submenu[i]);
                    }

                    NombreDeLaBarra.add(NombreVariableJMenu[0]);
             }
            
             ImageIcon Icono_rojo,Icono_gris,Icono_verde,Icono_blanco,Icono_Negrita,Icono_Cursiva,Icono_nc,
              Icono_ninguno,Icono_flechaMas,Icono_flcehaMenos,Icono_GUARDAR,Icono_GUARDAR_COMO,Icono_CORTAR,Icono_PEGAR;
             String SumbmenusInicio[];
             JMenuItem[] Items_del_menu;
             JMenuBar BarraMenu;
             JMenu Inicio,COP_PEG,tIPO_LETRA,TAMAÑO_LETRA,VISTA;
             JMenuItem COPIAR,PEGAR,GUARDAR,GUARDAR_COMO,NEGRITA,CURSIVA,NEGRITAYCURSIVA,SIN_FORMATO,ENTRE2,ENTRE10,ENTRE100,POR2,POR10,POR100,GRIS,BLANCO,ROJO,VERDE;

       }






Muchas gracias a todos/as, espero que os pueda ser útil.

No hay comentarios:

Publicar un comentario

Buscar este blog

Sandisk y Western Digital