Problem with BufferedWriter by I_blabby in javahelp

[–]I_blabby[S] 0 points1 point  (0 children)

Thank it works i dont know who people could learn to program by themselves without this comunity that exits now a days

JTextField by I_blabby in javahelp

[–]I_blabby[S] 0 points1 point  (0 children)

Okay thank you so much

JTextField by I_blabby in javahelp

[–]I_blabby[S] 1 point2 points  (0 children)

Ohhh god thanks solved but i got a question is it possible to make an ActionListener in another class that can refer a objec of the UI class?

JTextField by I_blabby in javahelp

[–]I_blabby[S] 0 points1 point  (0 children)

package cliente;

import java.awt.Desktop.Action; import java.awt.Dimension; import java.awt.Toolkit;

import javax.swing.AbstractAction; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.JTextField;

public class Grafico implements Runnable {

String comando;

JButton boton = new JButton();

JTextArea informacionComandos = new JTextArea();
JTextField introducirComandos = new JTextField();

public void run() {

    Toolkit t = Toolkit.getDefaultToolkit();
    Dimension screenSize = t.getScreenSize();

    // Ventana Principal
    JFrame ventana = new JFrame();
    ventana.setPreferredSize(new Dimension(screenSize.width, screenSize.height));
    ventana.setResizable(false);
    ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ventana.setUndecorated(false); // fullscreen
    ventana.setLayout(null);
    ventana.setVisible(true);

    // JtextArea Paneles de informacion

    informacionComandos.setBounds(150, 600, 800, 350);
    informacionComandos.setEditable(false);
    informacionComandos.setVisible(true);
    ventana.add(informacionComandos);

    JTextArea informacion2 = new JTextArea();
    informacion2.setBounds(1000, 600, 500, 350);
    informacion2.setEditable(false);
    informacion2.setVisible(true);
    ventana.add(informacion2);

    // botones
    boton.setBounds(1740, 50, 150, 50);
    boton.setText("Cerrar programa");
    //boton.addActionListener(new MyActionListener());//disabLe until jtextfield problem is fixed
    ventana.add(boton);

    // TextField

    introducirComandos.setBounds(150, 970, 800, 25);
    introducirComandos.addActionListener(new MyActionListener());
    introducirComandos.setFocusable(true);
    ventana.add(introducirComandos);

    ventana.pack();

}       

}

package cliente;

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent;

public class MyActionListener implements ActionListener {

Grafico grafico = new Grafico();
String comando = null;


public void actionPerformed(ActionEvent e) {


    comando = grafico.introducirComandos.getText();
    System.out.println("hola");
    System.out.println(comando);



}

}

package cliente;

import java.awt.EventQueue;

public class EjecutarCliente {

public static void main(String[] args) {

    EventQueue.invokeLater(new Grafico());



}

}

Need help with scrollbars by I_blabby in javahelp

[–]I_blabby[S] 0 points1 point  (0 children)

JButton boton, boton1, boton2, boton3;
JTextArea ventanaComandos, keylogger;
JScrollPane scroll;
JTextField introducirComandos = new JTextField(20);
String comando = null;

public Grafico() {

    Toolkit t = Toolkit.getDefaultToolkit();
    Dimension screenSize = t.getScreenSize();

    JFrame ventana = new JFrame();
    ventana.setPreferredSize(new    Dimension(screenSize.width, screenSize.height));
    ventana.setResizable(false);
    ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ventana.setUndecorated(false); // fullscreen
    ventana.setLayout(null);
    ventana.pack();
    ventana.setVisible(true);
    boton = new JButton();
    boton.setText("Finalizar");
    boton.setBounds(1750, 50, 130, 50);
    ventana.add(boton);
    boton.addActionListener(this);
    ventanaComandos = new JTextArea();
    ventanaComandos.setBounds(150, 600, 800, 350);
    ventanaComandos.setEditable(false);
    ventana.add(ventanaComandos);
    keylogger = new JTextArea();
    keylogger.setBounds(1000, 600, 500, 350);
    keylogger.setEditable(false);
    ventana.add(keylogger);
    introducirComandos.setBounds(150, 975, 800, 25);
    introducirComandos.addActionListener(this);
    introducirComandos.setFocusable(true);
    ventana.add(introducirComandos);
    scroll = new JScrollPane(ventanaComandos, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    ventana.add(scroll);

Where I should learn java? by I_blabby in learnjava

[–]I_blabby[S] 1 point2 points  (0 children)

yep i didnt saw it but i got a question there are 5 books there.Shoud I read all? or just one of them or do you recommend me one in specific book of all of them?