Search Results

Search found 129 results on 6 pages for 'joptionpane'.

Page 1/6 | 1 2 3 4 5 6  | Next Page >

  • how to listen to Enter button when using JOptionPane.showOptionDialog

    - by MemoryLeak
    I use: char[] password = null; JPasswordField jpf = new JPasswordField(30); java.lang.Object [] messageInput = { prompt, jpf }; java.lang.Object [] options = { jpf , "OK", "Cancel"}; int result = JOptionPane.showOptionDialog(null, messageInput, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, ""); JOptionPane.showMessageDialog(null, result); if (result == 1) { password = jpf.getPassword(); } else if(result == JOptionPane.CANCEL_OPTION) { } return password; to get password, but this can not listen to the Enter button. I know if I set the options parameter to null, can make the dialog listen to "enter" button, but if I do that, the dialog don't focus to the textbox when show up. Can someone help me on this ? Thanks in advance !

    Read the article

  • How the JOptionPane works

    - by DevAno1
    How can I control what happens with window after clicking JOPtionPane buttons ? I'm trying to implement simple file chooser. In my frame I have 3 buttons (OK, Cancel, Browse). Browse button opens file search window, and after picking files should return to main frame. Clicking OK will open a frame with the content of the file. Now porblem looks this way. With the code below, I can choose file but directly after that a new frame is created, and my frame with buttons dissapears : import java.io.File; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.awt.*; import javax.swing.*; import java.io.*; public class Main { public static void main(String args[]) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { show("Window"); } }); } public static void show(String frame_name){ JFrame frame = new JFrame(frame_name); frame.setPreferredSize(new Dimension(450, 300)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel top = new JPanel(); top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS)); JFileChooser fc = new JFileChooser(new File(".")); JPanel creator = new JPanel(); creator.setLayout(new BoxLayout(creator, BoxLayout.Y_AXIS)); creator.add(top); String[] buttons = {"OK", "Cancel", "Browse"}; int rc = JOptionPane.showOptionDialog( null, creator, frame_name, JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, buttons, buttons[0] ); String approveButt = ""; switch(rc){ case 0: break; case 1: break; case 2: approveButt = buttons[rc]; int retVal = fc.showDialog(null, approveButt); if (retVal == JFileChooser.APPROVE_OPTION) System.out.println(approveButt + " " + fc.getSelectedFile()); break; } frame.pack(); frame.setVisible(true); } } With the second code I can return to my menu, but in no way I am able to pop this new frame, which appeared with first code. How to control this ? What am I missing ? public class Main { public static void main(String args[]) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { show("Window"); } }); } public static void show(String frame_name){ JFrame frame = new JFrame(frame_name); frame.setPreferredSize(new Dimension(450, 300)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel top = new JPanel(); top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS)); JFileChooser fc = new JFileChooser(new File(".")); JPanel creator = new JPanel(); creator.setLayout(new BoxLayout(creator, BoxLayout.Y_AXIS)); creator.add(top); String[] buttons = {"OK", "Cancel", "Browse"}; String approveButt = ""; Plane m = null; int rc = -1; while (rc != 0) { rc = JOptionPane.showOptionDialog( null, creator, frame_name, JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, buttons, buttons[0] ); switch (rc) { case 0: m = new Plane(); case 1: System.exit(0); case 2: approveButt = buttons[rc]; int retVal = fc.showDialog(null, approveButt); if (retVal == JFileChooser.APPROVE_OPTION) System.out.println(approveButt + " " + fc.getSelectedFile()); break; default: break; } } addComponents(frame.getContentPane(), m); frame.pack(); frame.setVisible(true); } private static void addComponents(Container c, Plane e) { c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); c.add(e); } } class Plane extends JPanel { public Plane(){ } @Override public void paint(Graphics g){ g.setColor(Color.BLUE); g.fillRect(0, 0, 400, 250); } }

    Read the article

  • Setting Mnemonics and Hot Keys for a JOptionPane Dialog

    - by Daniel Bingham
    Is it possible to assign hotkeys and mnemonics to the buttons in a JOptionPane Dialog? I'd like to be able, in a JOptionPane generated message dialog with the options Yes, No and Cancel, press Y to hit the Yes button, N to hit the No button and escape to activate the escape button. Similarly in a dialog with Okay and Cancel buttons I'd like to be able to activate them with enter and escape. I've attempted passing JButtons into the JOptionPane's button Object array with the Mnemonics set already. The mnemonics work and the buttons show up correctly in the dialogs, however, they do not act properly when they are activated. Most noticeably they do not dispose of the dialog. What is the correct way to add hotkeys and Mnemonics to a JOptionPane Dialog's buttons? As always, my apologies ahead of time if this is a duplicate - I searched both Google and Stackoverflow and found nothing.

    Read the article

  • How to get JOptionPane with three text fields

    - by Dr.Mostafa
    I want to know how i can do a messageBox from three input dialog .. Like this: JOptionPane.showInputMessageDialog("Enter your FirstName"); JOptionPane.showInputMessageDialog("Enter your MiddleName"); JOptionPane.showInputMessageDialog("Enter your LastName"); But I want one message has a three input boxes.

    Read the article

  • JOptionPane opening another JFrame

    - by mike_hornbeck
    So I'm continuing my fight with this : http://stackoverflow.com/questions/2923545/creating-java-dialogs/2926126 task. Now my JOptionPane opens new window with envelope overfiew, but I can't change size of this window. Also I wanted to have sender's data in upper left corner, and receiver's data in bottom right. How can I achieve that ? There is also issue with OptionPane itself. After I click 'OK' it opens small window in the upper left corner of the screen. What is this and why it's appearing ? My code: import java.awt.*; import java.awt.Font; import javax.swing.*; public class Main extends JFrame { private static JTextField nameField = new JTextField(20); private static JTextField surnameField = new JTextField(); private static JTextField addr1Field = new JTextField(); private static JTextField addr2Field = new JTextField(); private static JComboBox sizes = new JComboBox(new String[] { "small", "medium", "large", "extra-large" }); public Main(){ JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); getContentPane().add(mainPanel); JPanel addrPanel = new JPanel(new GridLayout(0, 1)); addrPanel.setBorder(BorderFactory.createTitledBorder("Receiver")); addrPanel.add(new JLabel("Name")); addrPanel.add(nameField); addrPanel.add(new JLabel("Surname")); addrPanel.add(surnameField); addrPanel.add(new JLabel("Address 1")); addrPanel.add(addr1Field); addrPanel.add(new JLabel("Address 2")); addrPanel.add(addr2Field); mainPanel.add(addrPanel); mainPanel.add(new JLabel(" ")); mainPanel.add(sizes); String[] buttons = { "OK", "Cancel"}; int c = JOptionPane.showOptionDialog( null, mainPanel, "My Panel", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, buttons, buttons[0] ); if(c ==0){ new Envelope(nameField.getText(), surnameField.getText(), addr1Field.getText() , addr2Field.getText(), sizes.getSelectedIndex()); } setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } public static void main(String[] args) { new Main(); } } class Envelope extends JFrame { private final int SMALL=0; private final int MEDIUM=1; private final int LARGE=2; private final int XLARGE=3; public Envelope(String n, String s, String a1, String a2, int i){ Container content = getContentPane(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(new JLabel("John Doe")); mainPanel.add(new JLabel("FooBar str 14")); mainPanel.add(new JLabel("Newark, 45-99")); JPanel dataPanel = new JPanel(); dataPanel.setFont(new Font("sansserif", Font.PLAIN, 32)); //set size from i mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setBackground(Color.ORANGE); mainPanel.add(new JLabel("Mr "+n+" "+s)); mainPanel.add(new JLabel(a1)); mainPanel.add(new JLabel(a2)); content.setSize(450, 600); content.setBackground(Color.ORANGE); content.add(mainPanel, BorderLayout.NORTH); content.add(dataPanel, BorderLayout.SOUTH); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setVisible(true); } }

    Read the article

  • How to merge JOptionPane and Frame into one

    - by mike_hornbeck
    Hello. Currently I have a very basic file viewer working as follows : - in JOptionPane I browse for files, and set some variables to display (colors, line connecting etc) - previous windows loads a frame with drawn points Code : http://paste.pocoo.org/show/220066/ Now I'd like to throw it into one window, with JMenu for selecting files and changing display parameters. How to get started ? Should I rewrite everything to JDialog ?

    Read the article

  • Getting hold of a reference to the object created by JOptionPane static methods

    - by user548240
    Hi, I wonder if it is possible to get hold of a reference to the (JDialog?) object created by one of those static methods of JOptionPane (e.g. showMessageDialog)? I intend to modify the position where the dialog appears on the screen. More specifically, I want the dialog to appear at the top-left corner of the main app window, instead of the centre of the window by default. So having a reference to the object would enable me to use setLocation to achieve the desired effect... Any suggestion would be appreciated! Thanks!

    Read the article

  • Unable to change background colour for JOptionPane

    - by Sunil Kumar Sahoo
    Hi I have created sample progeam which will give same look and feel of a confirm dialog and set the background colour as red. But I donot know what is the problem that my background colour of option is displayed as the default colour but not red. also i need same look and feel of confirm dialog across all platforms. Here is the code that I have written. please help me to solve the issue public class JOptionPaneBackground { public static void main(String[] args) throws Exception { // UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults(); List<Object> keys = new ArrayList<Object>(uiDefaults.keySet()); Collections.sort(keys, new Comparator<Object>() { public int compare(Object o1, Object o2) { return (o1.toString()).compareTo(o2.toString()); } }); for (Object key : keys) { System.out.println(String.format("%-40s = %s", key, uiDefaults.get(key))); } UIManager.put("OptionPane.background", Color.red); UIManager.put("Panel.background", Color.red); JOptionPane.showConfirmDialog(null, "Hello World!"); } }

    Read the article

  • Java : Storing Data in Array Of Object from JOptionPane Dialog

    - by Bader
    hi guys i need to know how i can insert data inside objects inside an array of objects using my already made Set methods. i need to know how should i do it through user , i mean JOptionPane input dialog [code] student[] s=new student[5]; for (int i=1 ; i <= s.length ;i++) { s[i] = new student(i,"AAA","Ecommerce",0.0); } for (int i=1; i<=s.length;i++) { name = JOptionPane.showInputDialog("Please Write Name for student n " + i); major = JOptionPane.showInputDialog("Please Write Major for student n " + i); gpa =Double.parseDouble(JOptionPane.showInputDialog("Please Write GPA for student n " +i)); s[i]=new student(i,name,major,gpa); } [/code] i tried to do vars here that get data from user by JOptionPane, but it seems that i only use my already made constructor , not the Set methods. i need to use the methods because it has some validation code inside it. any ideas ?

    Read the article

  • JOptionPane to appear on selected JCheckBox

    - by Venno
    Hi all I am having some difficulties with adding a joptionpane in JcheckBox listener public void itemStateChanged(ItemEvent evt) { if(evt.getStateChange() == ItemEvent.SELECTED){ ///some code JOptionPane.showMessageDialog(null, "Message", "Alert", JOptionPane.INFORMATION_MESSAGE); } } so it works fine,but the problem is that the JCheckBox gets selected and immediately deselected how can I manage to fix this ? Cheers

    Read the article

  • How to close a JFrame in the middle of a program

    - by Nick Gibson
    public class JFrameWithPanel extends JFrame implements ActionListener, ItemListener { int packageIndex; double price; double[] prices = {49.99, 39.99, 34.99, 99.99}; DecimalFormat money = new DecimalFormat("$0.00"); JLabel priceLabel = new JLabel("Total Price: "+price); JButton button = new JButton("Check Price"); JComboBox packageChoice = new JComboBox(); JPanel pane = new JPanel(); TextField text = new TextField(5); JButton accept = new JButton("Accept"); JButton decline = new JButton("Decline"); JCheckBox serviceTerms = new JCheckBox("I Agree to the Terms of Service.", false); JTextArea termsOfService = new JTextArea("This is a text area", 5, 10); public JFrameWithPanel() { super("JFrame with Panel"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pane.add(packageChoice); setContentPane(pane); setSize(250,250); setVisible(true); packageChoice.addItem("A+ Certification"); packageChoice.addItem("Network+ Certification "); packageChoice.addItem("Security+ Certifictation"); packageChoice.addItem("CIT Full Test Package"); pane.add(button); button.addActionListener(this); pane.add(text); text.setEditable(false); text.setBackground(Color.WHITE); text.addActionListener(this); pane.add(termsOfService); termsOfService.setEditable(false); termsOfService.setBackground(Color.lightGray); pane.add(serviceTerms); serviceTerms.addItemListener(this); pane.add(accept); accept.addActionListener(this); pane.add(decline); decline.addActionListener(this); } public void actionPerformed(ActionEvent e) { packageIndex = packageChoice.getSelectedIndex(); price = prices[packageIndex]; text.setText("$"+price); Object source = e.getSource(); if(source == accept) { if(serviceTerms.isSelected() == false) { JOptionPane.showMessageDialog(null,"Please accept the terms of service.", "Terms of Service", JOptionPane.ERROR_MESSAGE); } else { JOptionPane.showMessageDialog(null,"Thank you. We will now move on to registering your product."); pane.dispose(); } } else if(source == decline) { System.exit(0); } } public void itemStateChanged(ItemEvent e) { int select = e.getStateChange(); } public static void main(String[] args) { String value1; int constant = 1, invalidNum = 0, answerParse, packNum, packPrice; JOptionPane.showMessageDialog(null,"Hello!"+"\nWelcome to the CIT Test Program."); JOptionPane.showMessageDialog(null,"IT WORKS!"); } }//class How do I get this frame to close so that my JOptionPane Message Dialogs can continue in the program without me exiting the program completely. EDIT: I tried .dispose() but I get this: cannot find symbol symbol : method dispose() location: class javax.swing.JPanel pane.dispose(); ^

    Read the article

  • Error Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException [migrated]

    - by user134212
    I'm new here. I'm learning how to program on java and I have a problem with my code. I really have no clue why my code is not working. I think my mistake may be here, but I'm not quite sure. m3 = new Matriz(ren2,col2); btSumar.addActionListener(new ActionListener() { Matriz m3;//(ren2,col2); public void actionPerformed(ActionEvent e) { m3 = new Matriz(ren2,col2); if(ventanaAbierta==true) { try { crearMat.SUMA(m1,m2); } catch(Exception nul) { System.out.println(nul); } } else { JOptionPane.showMessageDialog(null,"Ya se realizo la suma"); } } }); My Complete code import java.awt.*; import javax.swing.*; import javax.swing.BorderFactory; import javax.swing.border.Border; import java.awt.event.*; import java.awt.*; import java.io.*; import java.util.*; public class Practica2 { private int opcion,ren2,col2; private JFrame ventana,ventanaPrintMatriz; private JPanel panel,panel2; private Border borderRed2,borderBlue2,borderGreen2,borderGreen4; private Color red,green,blue,white,black; private Font Verdana14,ArialBlack18; private JLabel labelTitulo; public JButton btSalir,btSumar,btRestar,btMultiplica,btTranspuesta,btCrear; private ImageIcon suma,resta,multi,crear,salir,trans; private boolean ventanaAbierta = false; private static ValidacionesMatrices valida; private static Operaciones operacion; private static Matriz m1,m2,m3; private static ImprimirMatriz printMat; public Practica2() { panel = new JPanel(); panel.setLayout(null); ventana = new JFrame("Operaciones con Matrices"); ventana.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); ventana.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { //Sale del programa System.exit(0); } }); ventana.setContentPane(panel); ventana.setVisible(true); ventana.setResizable(false); ventana.setBounds(150,150,300,380); //ventana.setBounds(0,0,650,650); } public void inicializarComponentes() { panel2 = new JPanel(); panel2.setLayout(null); labelTitulo = new JLabel("Practica #2"); suma = new ImageIcon("suma1.png"); resta = new ImageIcon("resta1.png"); multi = new ImageIcon("multi1.png"); trans = new ImageIcon("trans2.png"); crear = new ImageIcon("crear1.png"); salir = new ImageIcon("salir1.png"); btTranspuesta = new JButton("Transpuesta",trans); btMultiplica = new JButton("Multiplica",multi); btRestar = new JButton("Restar",resta); btSumar = new JButton("Sumar",suma); btCrear = new JButton("Crear",crear); btSalir = new JButton("Salir",salir); //Tipo de letra ArialBlack18 = new Font("Arial Black",Font.BOLD,18); //Color green = new Color(0,255,0); //Formato labelTitulo labelTitulo.setBounds(80,-60,200,150); labelTitulo.setFont(ArialBlack18); labelTitulo.setForeground(blue); labelTitulo.setVisible(true); //Formato de CrearMatriz btCrear.setBounds(80,50,130,30); btCrear.setToolTipText("Crea una matriz"); //Formato de Muliplica btMultiplica.setBounds(80,100,130,30); btMultiplica.setToolTipText("Mat[A] * Mat[B]"); //Formato de botonRestar btRestar.setBounds(80,150,130,30); btRestar.setToolTipText("Mat[A] - Mat[B]"); //Formato del botonSumar btSumar.setBounds(80,200,130,30); btSumar.setToolTipText("Mat[A] + Mat[B]"); //Formato de Transpuesta btTranspuesta.setBounds(80,250,130,30); btTranspuesta.setToolTipText("Mat[A]^-1"); //Formato del botonSalir btSalir.setBounds(80,300,130,30); //Agregando componentes al panel1 panel2.add(labelTitulo); panel2.add(btMultiplica); panel2.add(btCrear); panel2.add(btRestar); panel2.add(btSumar); panel2.add(btSalir); panel2.add(btTranspuesta); //Formato panel2 panel2.setBackground(green); panel2.setVisible(true); panel2.setBounds(0,0,300,380); //Argregamos componentes al panelPrincipal= panel.add(panel2); //BotonCrear btCrear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) //throws IOException { if(ventanaAbierta==false) { ventanaAbierta=true; new CrearMatriz(); } else { JOptionPane.showMessageDialog(null,"Ya se crearon las Matrices"); } } }); m3 = new Matriz(ren2,col2); btSumar.addActionListener(new ActionListener() { Matriz m3;//(ren2,col2); public void actionPerformed(ActionEvent e) { m3 = new Matriz(ren2,col2); if(ventanaAbierta==true) { try { crearMat.SUMA(m1,m2); } catch(Exception nul) { System.out.println(nul); } } else { JOptionPane.showMessageDialog(null,"Ya se realizo la suma"); } } }); //BotonSalir btSalir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); panel.setVisible(true); panel.setBounds(0,0,350,380); } class VentanaMatriz { private JFrame ventana; private JPanel panel; private JTextArea textArea1,textArea2; private JLabel mat1,mat2; private JTextField textField1; public VentanaMatriz() { panel = new JPanel(); panel.setLayout(null); ventana = new JFrame("Creacion de Matrices"); ventana.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { ventana.dispose(); } }); ventana.setContentPane(panel); ventana.setVisible(true); ventana.setResizable(false); ventana.setBounds(200,100,850,420); } public void inicializarComponentes() { //Colores black = new Color(0,0,0); white = new Color(255,255,255); blue = new Color(0,0,255); green = new Color(0,255,0); red = new Color(255,0,0); //Tipo de letra Verdana14 = new Font("Verdana",Font.BOLD,14); //Tipos de borde borderRed2 = BorderFactory.createLineBorder(red,2); borderBlue2 = BorderFactory.createLineBorder(blue,2); borderGreen2 = BorderFactory.createLineBorder(green,2); borderGreen4 = BorderFactory.createLineBorder(green,4); //Agregando componentes al panel1 panel.add(mat1); panel.add(textArea1); panel.add(mat2); panel.add(textArea2); //Formato panel2 panel.setBackground(blue); panel.setVisible(true); panel.setBounds(0,0,850,420); } } class CrearMatriz { public int col1,re1,ren2,col2; public Matriz m1,m2,m3; public CrearMatriz() { int col1,ren1,ren2,col2; ren2 = Integer.parseInt(JOptionPane.showInputDialog("Numero de Renglones Matriz A: ")); col2 = Integer.parseInt(JOptionPane.showInputDialog("Numero de Columnas Matriz A: ")); final Matriz m1= new Matriz(ren2,col2); ren2 = Integer.parseInt(JOptionPane.showInputDialog("Numero de Renglones Matriz B: ")); col2 = Integer.parseInt(JOptionPane.showInputDialog("Numero de Columnas Matriz B: ")); final Matriz m2= new Matriz(ren2,col2); m3 = new Matriz(ren2,col2); m1.llenarMatriz(); m2.llenarMatriz(); m1.printMat(); m2.printMat(); } public void SUMA(Matriz m1,Matriz m2) { Matriz m3; if(ventanaAbierta==false) { m3 = new Matriz(ren2,col2); if(valida.validaSumayResta(m1,m2)) { m3 = operacion.sumaMat(m1,m2); JOptionPane.showMessageDialog(null,"La suma es = "); m3.imprimeMatriz(); } else { JOptionPane.showMessageDialog(null,"No es posible hacer la suma"); } } } public void RESTA() { } //btSumar = new JButton("Sumar",suma); //BotonSumar //Mostrar matriz 1 y 2 // System.out.println("\n\n\nMatriz 1="); // m1.imprimeMatriz(); // System.out.println("\nMatriz 2="); //Poner en botones /* if(valida.validaSumayResta(m1,m2)) { m3 = operacion.sumaMat(m1,m2); JOptionPane.showMessageDialog(null,"La suma es = "); m3.imprimeMatriz(); } else { JOptionPane.showMessageDialog(null,"No es posible hacer la suma"); } if(valida.validaSumayResta(m1,m2)) { m3=operacion.restaMat(m1,m2); JOptionPane.showMessageDialog(null,"La resta es = "); m3.imprimeMatriz(); } else { JOptionPane.showMessageDialog(null,"No es posible hacer la resta"); } if(valida.validaMultiplicacion(m1,m2)){ m3=operacion.multiplicaMat(m1,m2); JOptionPane.showMessageDialog(null,"La multiplicacion es = "); m3.imprimeMatriz(); } else { JOptionPane.showMessageDialog(null,"No es posible hacer la multiplicacion"); } JOptionPane.showMessageDialog(null,"La multiplicacion es = "); m1=operacion.transpuesta(m1); m2=operacion.transpuesta(m2); */ } class Matriz { public JTextField matriz; //public JTextArea texto; private JFrame ventanaPrintMatriz; private JPanel panel2; int ren; int col; int pos[][]; public Matriz(int ren1, int col1) { ren = ren1; col = col1; pos = new int [ren][col];/*una matriz de enteros de renglon por columan*/ } public void llenarMatriz() { for(int i=0;i<ren;i++) for(int j=0;j<col;j++) pos[i][j]=(int) (Math.random()*10);/*la posicion i y j crea un entero random*/ } /*vuelve a recorrer los espacio de i y j*/ } //Esta clase era un metodo de CrearMatriz class ImprimirMatriz { public void ImprimirMatriz() { panel2 = new JPanel(); panel2.setLayout(null); ventanaPrintMatriz = new JFrame("Matriz"); ventana.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { //Practica2.ventanaAbierta=false; ventana.dispose(); } }); int i,j; int x=0,y=0; borderRed2 = BorderFactory.createLineBorder(red,2); white = new Color(255,255,255); red = new Color(255,0,0); black = new Color(0,0,0); blue = new Color(0,0,255); for(i=0;i<ren;i++) { for(j=0;j<col;j++) { matriz = new JTextField(" "+pos[i][j]); matriz.setBorder(borderRed2); matriz.setForeground(white); matriz.setBounds(x+25,y+25,25,25); matriz.setBackground(black); matriz.setEditable(false); matriz.setVisible(true); //Se incrementa la coordenada en X //para el siguiente Textfield no se encime x=x+35; //Agregamos el textField al panel panel2.add(matriz); } //Regreso las cordenadas de X a 0 para que el //siguiente renglon empieze en donde mismo x=0; //Incremento las coordenada Y para que se brinque //de linea y=y+35; } //Formato panel2 panel2.setBounds(150,150,350,380); panel2.setBackground(blue); //panel2.setEditable(false); panel2.setVisible(true); //Formato de Ventana ventanaPrintMatriz.setContentPane(panel2); ventanaPrintMatriz.setBounds(150,150,350,380); ventanaPrintMatriz.setResizable(false); ventanaPrintMatriz.setVisible(true); } } class Operaciones { public Matriz sumaMat(Matriz m1, Matriz m2) { Matriz m3; m3 = new Matriz(m1.ren, m1.col); for(int i=0;i<m1.col;i++) for(int j=0;j<m1.ren;j++) m3.pos[i][j]=m1.pos[i][j]+m2.pos[i][j]; return m3; } public Matriz restaMat(Matriz m1, Matriz m2) { Matriz m3; m3 = new Matriz(m1.ren, m1.col); for(int i=0;i<m1.col;i++) for(int j=0;j<m1.ren;j++) m3.pos[i][j]=m1.pos[i][j]-m2.pos[i][j]; return m3; } public Matriz multiplicaMat(Matriz m1, Matriz m2) { Matriz m3; m3 = new Matriz(m1.ren, m2.col); for(int i=0;i<m1.ren;i++) for(int j=0;j<m2.col;j++) { m3.pos[i][j]=0; for(int k=0;k<m1.col;k++) m3.pos[i][j]+=(m1.pos[i][k]*m2.pos[k][j]); } return m3; } public Matriz transpuesta(Matriz m1) { Matriz m3=new Matriz(m1.col,m1.ren); for(int i=0;i<m1.col;i++) for(int j=0;j<m1.ren;j++) m3.pos[i][j]=m1.pos[j][i]; return m3; } } class ValidacionesMatrices { public boolean validaSumayResta(Matriz m1, Matriz m2) { if((m1.ren==m2.ren) && (m1.col==m2.col)) return true; else return false; } public boolean validaMultiplicacion(Matriz m1, Matriz m2) { if(((m1.ren==m2.ren) && (m1.col==m2.col)) || (m1.col==m2.ren)) return true; else return false; } } public static void main(String[] args) { Practica2 practica2 = new Practica2(); practica2.inicializarComponentes(); } } Exc

    Read the article

  • How to display an icon on JOptionPane.showInputDialog() in Java?

    - by Lion
    The following segment of code shows JOptionPane.showInputDialog() method. It works fine but I need to display a custom icon on it. I currently left it null as shown below. String operatingSystem = System.getProperty("os.name"); Object o[] = {"Turn Off", "Restart", "Stand By", "Log Off"}; Frame frame = new Frame(operatingSystem); Object selectedValue = JOptionPane.showInputDialog(frame, "What would you like to do with the system?", "Select a task", JOptionPane.INFORMATION_MESSAGE, null, o, o[0]); //<---- Here it is. How can an icon be displayed on it replacing null?

    Read the article

  • Java implementing Exception Handling

    - by user69514
    I am trying to implement an OutOfStockException for when the user attempts to buy more items than there are available. I'm not sure if my implementation is correct. Does this look OK to you? public class OutOfStockException extends Exception { public OutOfStockException(){ super(); } public OutOfStockException(String s){ super(s); } } This is the class where I need to test it: import javax.swing.JOptionPane; public class SwimItems { static final int MAX = 100; public static void main (String [] args) { Item [] items = new Item[MAX]; int numItems; numItems = fillFreebies(items); numItems += fillTaxable(items,numItems); numItems += fillNonTaxable(items,numItems); sellStuff(items, numItems); } private static int num(String which) { int n = 0; do { try{ n=Integer.parseInt(JOptionPane.showInputDialog("Enter number of "+which+" items to add to stock:")); } catch(NumberFormatException nfe){ System.out.println("Number Format Exception in num method"); } } while (n < 1 || n > MAX/3); return n; } private static int fillFreebies(Item [] list) { int n = num("FREEBIES"); for (int i = 0; i < n; i++) try{ list [i] = new Item(JOptionPane.showInputDialog("What freebie item will you give away?"), Integer.parseInt(JOptionPane.showInputDialog("How many do you have?"))); } catch(NumberFormatException nfe){ System.out.println("Number Format Exception in fillFreebies method"); } catch(ArrayIndexOutOfBoundsException e){ System.out.println("Array Index Out Of Bounds Exception in fillFreebies method"); } return n; } private static int fillTaxable(Item [] list, int number) { int n = num("Taxable Items"); for (int i = number ; i < n + number; i++) try{ list [i] = new TaxableItem(JOptionPane.showInputDialog("What taxable item will you sell?"), Double.parseDouble(JOptionPane.showInputDialog("How much will you charge (not including tax) for each?")), Integer.parseInt(JOptionPane.showInputDialog("How many do you have?"))); } catch(NumberFormatException nfe){ System.out.println("Number Format Exception in fillTaxable method"); } catch(ArrayIndexOutOfBoundsException e){ System.out.println("Array Index Out Of Bounds Exception in fillTaxable method"); } return n; } private static int fillNonTaxable(Item [] list, int number) { int n = num("Non-Taxable Items"); for (int i = number ; i < n + number; i++) try{ list [i] = new SaleItem(JOptionPane.showInputDialog("What non-taxable item will you sell?"), Double.parseDouble(JOptionPane.showInputDialog("How much will you charge for each?")), Integer.parseInt(JOptionPane.showInputDialog("How many do you have?"))); } catch(NumberFormatException nfe){ System.out.println("Number Format Exception in fillNonTaxable method"); } catch(ArrayIndexOutOfBoundsException e){ System.out.println("Array Index Out Of Bounds Exception in fillNonTaxable method"); } return n; } private static String listEm(Item [] all, int n, boolean numInc) { String list = "Items: "; for (int i = 0; i < n; i++) { try{ list += "\n"+ (i+1)+". "+all[i].toString() ; if (all[i] instanceof SaleItem) list += " (taxable) "; if (numInc) list += " (Number in Stock: "+all[i].getNum()+")"; } catch(ArrayIndexOutOfBoundsException e){ System.out.println("Array Index Out Of Bounds Exception in listEm method"); } catch(NullPointerException npe){ System.out.println("Null Pointer Exception in listEm method"); } } return list; } private static void sellStuff (Item [] list, int n) { int choice; do { try{ choice = Integer.parseInt(JOptionPane.showInputDialog("Enter item of choice: "+listEm(list, n, false))); } catch(NumberFormatException nfe){ System.out.println("Number Format Exception in sellStuff method"); } }while (JOptionPane.showConfirmDialog(null, "Another customer?")==JOptionPane.YES_OPTION); JOptionPane.showMessageDialog(null, "Remaining "+listEm(list, n, true)); } }

    Read the article

  • Java textfile I/O problem

    - by KáGé
    Hello, I have to make a torpedo game for school with a toplist for it. I want to store it in a folder structure near the JAR: /Torpedo/local/toplist/top_i.dat, where the i is the place of that score. The files will be created at the first start of the program with this call: File f; f = new File(Toplist.toplistPath+"/top_1.dat"); if(!f.exists()){ Toplist.makeToplist(); } Here is the toplist class: package main; import java.awt.Color; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.prefs.Preferences; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextArea; public class Toplist { static String toplistPath = "./Torpedo/local/toplist"; //I know it won't work this easily, it's only to get you the idea public static JFrame toplistWindow = new JFrame("Torpedó - [TOPLISTA]"); public static JTextArea toplist = new JTextArea(""); static StringBuffer toplistData = new StringBuffer(3000); public Toplist() { toplistWindow.setSize(500, 400); toplistWindow.setLocationRelativeTo(null); toplistWindow.setResizable(false); getToplist(); toplist.setSize(400, 400); toplist.setLocation(0, 100); toplist.setColumns(5); toplist.setText(toplistData.toString()); toplist.setEditable(false); toplist.setBackground(Color.WHITE); toplistWindow.setLayout(null); toplistWindow.setVisible(true); } public Toplist(Player winner) { //this is to be done yet, this will set the toplist at first and then display it toplistWindow.setLayout(null); toplistWindow.setVisible(true); } /** * Creates a new toplist */ public static void makeToplist(){ new File(toplistPath).mkdir(); for(int i = 1; i <= 10; i++){ File f = new File(toplistPath+"/top_"+i+".dat"); try { f.createNewFile(); } catch (IOException e) { JOptionPane.showMessageDialog(new JFrame(), "Fájl hiba: toplista létrehozása", "Error", JOptionPane.ERROR_MESSAGE); } } } /** * If the score is a top score it inserts it into the list * * @param score - the score to be checked */ public static void setToplist(int score, Player winner){ BufferedReader input = null; PrintWriter output = null; int topscore; for(int i = 1; i <= 10; i++){ try { input = new BufferedReader(new FileReader(toplistPath+"/top_"+i+",dat")); String s; topscore = Integer.parseInt(input.readLine()); if(score > topscore){ for(int j = 9; j >= i; j--){ input = new BufferedReader(new FileReader(toplistPath+"/top_"+j+".dat")); output = new PrintWriter(new FileWriter(toplistPath+"/top_"+(j+1)+".dat")); while ((s = input.readLine()) != null) { output.println(s); } } output = new PrintWriter(new FileWriter(toplistPath+"/top_"+i+".dat")); output.println(score); output.println(winner.name); if(winner.isLocal){ output.println(Torpedo.session.remote.name); }else{ output.println(Torpedo.session.remote.name); } output.println(Torpedo.session.mapName); output.println(DateUtils.now()); break; } } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(new JFrame(), "Fájl hiba: toplista frissítése", "Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { JOptionPane.showMessageDialog(new JFrame(), "Fájl hiba: toplista frissítése", "Error", JOptionPane.ERROR_MESSAGE); } finally { if (input != null) { try { input.close(); } catch (IOException e) { JOptionPane.showMessageDialog(new JFrame(), "Fájl hiba: toplista frissítése", "Error", JOptionPane.ERROR_MESSAGE); } } if (output != null) { output.close(); } } } } /** * This loads the toplist into the buffer */ public static void getToplist(){ BufferedReader input = null; toplistData = null; String s; for(int i = 1; i <= 10; i++){ try { input = new BufferedReader(new FileReader(toplistPath+"/top_"+i+".dat")); while((s = input.readLine()) != null){ toplistData.append(s); toplistData.append('\t'); } toplistData.append('\n'); } catch (FileNotFoundException e) { JOptionPane.showMessageDialog(new JFrame(), "Fájl hiba: toplista betöltése", "Error", JOptionPane.ERROR_MESSAGE); } catch (IOException e) { JOptionPane.showMessageDialog(new JFrame(), "Fájl hiba: toplista betöltése", "Error", JOptionPane.ERROR_MESSAGE); } } } /** * * @author http://www.rgagnon.com/javadetails/java-0106.html * */ public static class DateUtils { public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; public static String now() { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); return sdf.format(cal.getTime()); } } } The problem is, that it can't access any of the files. I've tried adding them to the classpath and at least six different variations of file/path handling I found online but nothing worked. Could anyone tell me what do I do wrong? Thank you.

    Read the article

  • using Object input\ output Streams with files and array list

    - by soad el-hayek
    hi every one .. i'm an it student , and it's time to finish my final project in java , i've faced too many problems , this one i couldn't solve it and i'm really ubset ! :S my code is like this : in Admin class : public ArrayList cos_info = new ArrayList(); public ArrayList cas_info = new ArrayList(); public int cos_count = 0 ; public int cas_count = 0 ; void coustmer_acount() throws FileNotFoundException, IOException{ String add=null; do{ person p = new person() ; cos_info.add(cos_count, p); cos_count ++ ; add =JOptionPane.showInputDialog("Do you want to add more coustmer..\n'y'foryes ..\n 'n'for No .."); } while(add.charAt(0) == 'Y'||add.charAt(0)=='y'); writenew_cos(); // add_acounts(); } void writenew_cos() throws IOException{ ObjectOutputStream aa = new ObjectOutputStream(new FileOutputStream("coustmer.txt")); aa.writeObject(cos_info); JOptionPane.showMessageDialog(null,"Added to file done sucessfuly.."); aa.close(); } in Coustmer class : void read_cos() throws IOException, ClassNotFoundException{ person p1= null ; int array_count = 0; ObjectInputStream d = new ObjectInputStream(new FileInputStream("coustmer.txt")); JOptionPane.showMessageDialog(null,d.available() ); for(int i = 0;d.available() == 0;i++){ a.add(array_count,(ArrayList) d.readObject()); array_count++; JOptionPane.showMessageDialog(null,"Haaaaai :D" ); JOptionPane.showMessageDialog(null,array_count ); } d.close(); JOptionPane.showMessageDialog(null,array_count +"1111" ); for(int i = 0 ; i it just print JOptionPane.showMessageDialog(null,d.available() ); and having excep. here a.add(array_count,(ArrayList) d.readObject()); p.s : person object from my own class and it's Serializabled

    Read the article

  • How to delegate SwingWorker's publish to other methods

    - by Savvas Dalkitsis
    My "problem" can be described by the following. Assume we have an intensive process that we want to have running in the background and have it update a Swing JProgress bar. The solution is easy: import java.util.List; import javax.swing.JOptionPane; import javax.swing.JProgressBar; import javax.swing.SwingWorker; /** * @author Savvas Dalkitsis */ public class Test { public static void main(String[] args) { final JProgressBar progressBar = new JProgressBar(0,99); SwingWorker<Void, Integer> w = new SwingWorker<Void, Integer>(){ @Override protected void process(List<Integer> chunks) { progressBar.setValue(chunks.get(chunks.size()-1)); } @Override protected Void doInBackground() throws Exception { for (int i=0;i<100;i++) { publish(i); Thread.sleep(300); } return null; } }; w.execute(); JOptionPane.showOptionDialog(null, new Object[] { "Process", progressBar }, "Process", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); } } Now assume that i have various methods that take a long time. For instance we have a method that downloads a file from a server. Or another that uploads to a server. Or anything really. What is the proper way of delegating the publish method to those methods so that they can update the GUI appropriately? What i have found so far is this (assume that the method "aMethod" resides in some other package for instance): import java.awt.event.ActionEvent; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JOptionPane; import javax.swing.JProgressBar; import javax.swing.SwingWorker; /** * @author Savvas Dalkitsis */ public class Test { public static void main(String[] args) { final JProgressBar progressBar = new JProgressBar(0,99); SwingWorker<Void, Integer> w = new SwingWorker<Void, Integer>(){ @Override protected void process(List<Integer> chunks) { progressBar.setValue(chunks.get(chunks.size()-1)); } @SuppressWarnings("serial") @Override protected Void doInBackground() throws Exception { aMethod(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { publish((Integer)getValue("progress")); } }); return null; } }; w.execute(); JOptionPane.showOptionDialog(null, new Object[] { "Process", progressBar }, "Process", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); } public static void aMethod (Action action) { for (int i=0;i<100;i++) { action.putValue("progress", i); action.actionPerformed(null); try { Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } } } } It works but i know it lacks something. Any thoughts?

    Read the article

  • Java Hint in NetBeans for Identifying JOptionPanes

    - by Geertjan
    I tend to have "JOptionPane.showMessageDialogs" scattered through my code, for debugging purposes. Now I have a way to identify all of them and remove them one by one, since some of them are there for users of the application so shouldn't be removed, via the Refactoring window: Identifying instances of code that I'm interested in is really trivial: import org.netbeans.spi.editor.hints.ErrorDescription; import org.netbeans.spi.java.hints.ConstraintVariableType; import org.netbeans.spi.java.hints.ErrorDescriptionFactory; import org.netbeans.spi.java.hints.Hint; import org.netbeans.spi.java.hints.HintContext; import org.netbeans.spi.java.hints.TriggerPattern; import org.openide.util.NbBundle.Messages; @Hint( displayName = "#DN_ShowMessageDialogChecker", description = "#DESC_ShowMessageDialogChecker", category = "general") @Messages({ "DN_ShowMessageDialogChecker=Found \"ShowMessageDialog\"", "DESC_ShowMessageDialogChecker=Checks for JOptionPane.showMes" }) public class ShowMessageDialogChecker { @TriggerPattern(value = "$1.showMessageDialog", constraints = @ConstraintVariableType(variable = "$1", type = "javax.swing.JOptionPane")) @Messages("ERR_ShowMessageDialogChecker=Are you sure you need this statement?") public static ErrorDescription computeWarning(HintContext ctx) { return ErrorDescriptionFactory.forName( ctx, ctx.getPath(), Bundle.ERR_ShowMessageDialogChecker()); } } Stick the above class, which seriously isn't much code at all, in a module and run it, with this result: Bit trickier to do the fix, i.e., add a bit of code to let the user remove the statement, but I looked in the NetBeans sources and used the System.out fix, which does the same thing:  import com.sun.source.tree.BlockTree; import com.sun.source.tree.StatementTree; import com.sun.source.util.TreePath; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.netbeans.api.java.source.CompilationInfo; import org.netbeans.api.java.source.WorkingCopy; import org.netbeans.spi.editor.hints.ErrorDescription; import org.netbeans.spi.editor.hints.Fix; import org.netbeans.spi.java.hints.ConstraintVariableType; import org.netbeans.spi.java.hints.ErrorDescriptionFactory; import org.netbeans.spi.java.hints.Hint; import org.netbeans.spi.java.hints.HintContext; import org.netbeans.spi.java.hints.JavaFix; import org.netbeans.spi.java.hints.TriggerPattern; import org.openide.util.NbBundle.Messages; @Hint( displayName = "#DN_ShowMessageDialogChecker", description = "#DESC_ShowMessageDialogChecker", category = "general") @Messages({ "DN_ShowMessageDialogChecker=Found \"ShowMessageDialog\"", "DESC_ShowMessageDialogChecker=Checks for JOptionPane.showMes" }) public class ShowMessageDialogChecker { @TriggerPattern(value = "$1.showMessageDialog", constraints = @ConstraintVariableType(variable = "$1", type = "javax.swing.JOptionPane")) @Messages("ERR_ShowMessageDialogChecker=Are you sure you need this statement?") public static ErrorDescription computeWarning(HintContext ctx) { Fix fix = new FixImpl(ctx.getInfo(), ctx.getPath()).toEditorFix(); return ErrorDescriptionFactory.forName( ctx, ctx.getPath(), Bundle.ERR_ShowMessageDialogChecker(), fix); } private static final class FixImpl extends JavaFix { public FixImpl(CompilationInfo info, TreePath tp) { super(info, tp); } @Override @Messages("FIX_ShowMessageDialogChecker=Remove the statement") protected String getText() { return Bundle.FIX_ShowMessageDialogChecker(); } @Override protected void performRewrite(TransformationContext tc) throws Exception { WorkingCopy wc = tc.getWorkingCopy(); TreePath statementPath = tc.getPath(); TreePath blockPath = tc.getPath().getParentPath(); while (!(blockPath.getLeaf() instanceof BlockTree)) { statementPath = blockPath; blockPath = blockPath.getParentPath(); if (blockPath == null) { return; } } BlockTree blockTree = (BlockTree) blockPath.getLeaf(); List<? extends StatementTree> statements = blockTree.getStatements(); List<StatementTree> newStatements = new ArrayList<StatementTree>(); for (Iterator<? extends StatementTree> it = statements.iterator(); it.hasNext();) { StatementTree statement = it.next(); if (statement != statementPath.getLeaf()) { newStatements.add(statement); } } BlockTree newBlockTree = wc.getTreeMaker().Block(newStatements, blockTree.isStatic()); wc.rewrite(blockTree, newBlockTree); } } } Aside from now being able to use "Inspect & Refactor" to identify and fix all instances of JOptionPane.showMessageDialog at the same time, you can also do the fixes per instance within the editor:

    Read the article

  • If statement is ignored

    - by user2898120
    I am making a simple matchmaker as a learning project in JAVA. My program so far just asks a few questions, but I wanted to do gender specific questions, so I asked for their sex (m or f) and then attempted to add a message that only showed if sex was m. The dialog should say "well done, you are male!". Else it restarts method. Every time, no matter what I type it restarts the program. Here is my code: import javax.swing.JOptionPane; public class Main { public static void main(String[] args){ setVars(); } public static void setVars(){ String name = JOptionPane.showInputDialog(null, "What is your name?"); String sAge = JOptionPane.showInputDialog(null, "What is your age?"); String sex = JOptionPane.showInputDialog(null, "What is your sex?\n(Enter m or f)"); if (sex == "m"){ JOptionPane.showMessageDialog(null, "Well done, you are male.\nKeep Going!"); } int age = Integer.parseInt(sAge); String chars = JOptionPane.showInputDialog(null, "Name three charectaristics"); } }

    Read the article

  • Jdbc - Connect remote Mysql Database error

    - by Guilherme Ruiz
    I'm using JDBC to connect my program to a MySQL database. I already put the port number and yes, my database have permission to access. When i use localhost work perfectly, but when i try connect to a remote MySQL database, show this error on console. java.lang.ExceptionInInitializerError Caused by: java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:454) at java.lang.Integer.parseInt(Integer.java:527) at serial.BDArduino.<clinit>(BDArduino.java:25) Exception in thread "main" Java Result: 1 CONSTRUÍDO COM SUCESSO (tempo total: 1 segundo) Thank you in Advance ! MAIN CODE /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package serial; import gnu.io.CommPort; import gnu.io.CommPortIdentifier; import gnu.io.SerialPort; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.swing.JFrame; import javax.swing.JOptionPane; /** * * @author Ruiz */ public class BDArduino extends JFrame { static boolean connected = false; static int aux_sql8 = Integer.parseInt(Sql.getDBinfo("SELECT * FROM arduinoData WHERE id=1", "pin8")); static int aux_sql2 = Integer.parseInt(Sql.getDBinfo("SELECT * FROM arduinoData WHERE id=1", "pin2")); CommPort commPort = null; SerialPort serialPort = null; InputStream inputStream = null; static OutputStream outputStream = null; String comPortNum = "COM10"; int baudRate = 9600; int[] intArray = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; /** * Creates new form ArduinoTest */ public BDArduino() { //super("Arduino Test App"); initComponents(); } class Escrita extends Thread { private int i; public void run() { while (true) { System.out.println("Número :" + i++); } } } //public void actionPerformed(ActionEvent e) { // String arg = e.getActionCommand(); public static void writeData(int a) throws IOException { outputStream.write(a); } public void action(String arg) { System.out.println(arg); Object[] msg = {"Baud Rate: ", "9600", "COM Port #: ", "COM10"}; if (arg == "connect") { if (connected == false) { new BDArduino.ConnectionMaker().start(); } else { closeConnection(); } } if (arg == "disconnect") { serialPort.close(); closeConnection(); } if (arg == "p2") { System.out.print("Pin #2\n"); try { outputStream.write(intArray[0]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p3") { System.out.print("Pin #3\n"); try { outputStream.write(intArray[1]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p4") { System.out.print("Pin #4\n"); try { outputStream.write(intArray[2]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p5") { System.out.print("Pin #5\n"); try { outputStream.write(intArray[3]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p6") { System.out.print("Pin #6\n"); try { outputStream.write(intArray[4]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p7") { System.out.print("Pin #7\n"); try { outputStream.write(intArray[5]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p8") { System.out.print("Pin #8\n"); try { outputStream.write(intArray[6]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p9") { System.out.print("Pin #9\n"); try { outputStream.write(intArray[7]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p10") { System.out.print("Pin #10\n"); try { outputStream.write(intArray[8]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p11") { System.out.print("Pin #11\n"); try { outputStream.write(intArray[9]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p12") { System.out.print("Pin #12\n"); try { outputStream.write(intArray[10]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } if (arg == "p13") { System.out.print("Pin #12\n"); try { outputStream.write(intArray[11]); }//end try catch (IOException e12) { e12.printStackTrace(); System.exit(-1); }//end catch } } //******************************************************* //Arduino Connection *************************************** //****************************************************** void closeConnection() { try { outputStream.close(); } catch (Exception ex) { ex.printStackTrace(); String cantCloseConnectionMessage = "Can't Close Connection!"; JOptionPane.showMessageDialog(null, cantCloseConnectionMessage, "ERROR", JOptionPane.ERROR_MESSAGE); } connected = false; System.out.print("\nDesconectado\n"); String disconnectedConnectionMessage = "Desconectado!"; JOptionPane.showMessageDialog(null, disconnectedConnectionMessage, "Desconectado", JOptionPane.INFORMATION_MESSAGE); }//end closeConnection() void connect() throws Exception { String portName = comPortNum; CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName); if (portIdentifier.isCurrentlyOwned()) { System.out.println("Error: Port is currently in use"); String portInUseConnectionMessage = "Port is currently in use!\nTry Again Later..."; JOptionPane.showMessageDialog(null, portInUseConnectionMessage, "ERROR", JOptionPane.ERROR_MESSAGE); } else { commPort = portIdentifier.open(this.getClass().getName(), 2000); if (commPort instanceof SerialPort) { serialPort = (SerialPort) commPort; serialPort.setSerialPortParams(baudRate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); outputStream = serialPort.getOutputStream(); } else { System.out.println("Error: Only serial ports are handled "); String onlySerialConnectionMessage = "Serial Ports ONLY!"; JOptionPane.showMessageDialog(null, onlySerialConnectionMessage, "ERROR", JOptionPane.ERROR_MESSAGE); } }//end else //wait some time try { Thread.sleep(300); } catch (InterruptedException ie) { } }//end connect //******************************************************* //*innerclasses****************************************** //******************************************************* public class ConnectionMaker extends Thread { public void run() { //try to make a connection try { connect(); } catch (Exception ex) { ex.printStackTrace(); System.out.print("ERROR: Cannot connect!"); String cantConnectConnectionMessage = "Cannot Connect!\nCheck the connection settings\nand/or your configuration\nand try again!"; JOptionPane.showMessageDialog(null, cantConnectConnectionMessage, "ERROR", JOptionPane.ERROR_MESSAGE); } //show status serialPort.notifyOnDataAvailable(true); connected = true; //send ack System.out.print("\nConnected\n"); String connectedConnectionMessage = "Conectado!"; JOptionPane.showMessageDialog(null, connectedConnectionMessage, "Conectado", JOptionPane.INFORMATION_MESSAGE); }//end run }//end ConnectionMaker /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { btnp2 = new javax.swing.JButton(); btncon = new javax.swing.JButton(); btndesc = new javax.swing.JButton(); btnp3 = new javax.swing.JButton(); btnp4 = new javax.swing.JButton(); btnp5 = new javax.swing.JButton(); btnp9 = new javax.swing.JButton(); btnp6 = new javax.swing.JButton(); btnp7 = new javax.swing.JButton(); btnp8 = new javax.swing.JButton(); btn13 = new javax.swing.JButton(); btnp10 = new javax.swing.JButton(); btnp11 = new javax.swing.JButton(); btnp12 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); btnp2.setText("2"); btnp2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp2MouseClicked(evt); } }); btncon.setText("Conectar"); btncon.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnconMouseClicked(evt); } }); btndesc.setText("Desconectar"); btndesc.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btndescMouseClicked(evt); } }); btnp3.setText("3"); btnp3.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp3MouseClicked(evt); } }); btnp4.setText("4"); btnp4.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp4MouseClicked(evt); } }); btnp5.setText("5"); btnp5.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp5MouseClicked(evt); } }); btnp9.setText("9"); btnp9.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp9MouseClicked(evt); } }); btnp6.setText("6"); btnp6.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp6MouseClicked(evt); } }); btnp7.setText("7"); btnp7.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp7MouseClicked(evt); } }); btnp8.setText("8"); btnp8.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp8MouseClicked(evt); } }); btn13.setText("13"); btn13.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btn13MouseClicked(evt); } }); btnp10.setText("10"); btnp10.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp10MouseClicked(evt); } }); btnp11.setText("11"); btnp11.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp11MouseClicked(evt); } }); btnp12.setText("12"); btnp12.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { btnp12MouseClicked(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addComponent(btncon) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btndesc)) .addGroup(layout.createSequentialGroup() .addComponent(btnp6, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnp7, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnp8, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnp9, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(btnp10, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnp11, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnp12, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn13, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() .addComponent(btnp2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnp3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnp4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(btnp5, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(20, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btncon) .addComponent(btndesc)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 20, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnp2) .addComponent(btnp3) .addComponent(btnp4) .addComponent(btnp5)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnp6) .addComponent(btnp7) .addComponent(btnp8) .addComponent(btnp9)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnp10) .addComponent(btnp11) .addComponent(btnp12) .addComponent(btn13)) .addGap(22, 22, 22)) ); pack(); }// </editor-fold> private void btnp2MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p2"); } private void btnconMouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("connect"); } private void btndescMouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("disconnect"); } private void btnp3MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p3"); } private void btnp4MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p4"); } private void btnp5MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here action("p5"); } private void btnp9MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p9"); } private void btnp6MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p6"); } private void btnp7MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p7"); } private void btnp8MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p8"); } private void btn13MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p13"); } private void btnp10MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p10"); } private void btnp11MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p11"); } private void btnp12MouseClicked(java.awt.event.MouseEvent evt) { // TODO add your handling code here: action("p12"); } /** * @param args the command line arguments */ public static void main(String args[]) throws IOException { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new BDArduino().setVisible(true); } }); //} while (true) { // int sql8 = Integer.parseInt(Sql.getDBinfo("SELECT * FROM arduinoData WHERE id=1", "pin8")); if (connected == true && sql8 != aux_sql8) { aux_sql8 = sql8; if(sql8 == 1){ writeData(2); }else{ writeData(3); } } int sql2 = Integer.parseInt(Sql.getDBinfo("SELECT * FROM arduinoData WHERE id=1", "pin2")); if (connected == true && sql2 != aux_sql2) { aux_sql2 = sql2; if(sql2 == 1){ writeData(4); }else{ writeData(5); } } try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } } // Variables declaration - do not modify private javax.swing.JButton btn13; private javax.swing.JButton btncon; private javax.swing.JButton btndesc; private javax.swing.JButton btnp10; private javax.swing.JButton btnp11; private javax.swing.JButton btnp12; private javax.swing.JButton btnp2; private javax.swing.JButton btnp3; private javax.swing.JButton btnp4; private javax.swing.JButton btnp5; private javax.swing.JButton btnp6; private javax.swing.JButton btnp7; private javax.swing.JButton btnp8; private javax.swing.JButton btnp9; // End of variables declaration }

    Read the article

  • using Object input\ output Streams with files and array list

    - by soad el-hayek
    hi every one .. i'm an it student , and it's time to finish my final project in java , i've faced too many problems , this one i couldn't solve it and i'm really ubset ! :S my code is like this : in Admin class : public ArrayList cos_info = new ArrayList(); public ArrayList cas_info = new ArrayList(); public int cos_count = 0 ; public int cas_count = 0 ; void coustmer_acount() throws FileNotFoundException, IOException{ String add=null; do{ person p = new person() ; cos_info.add(cos_count, p); cos_count ++ ; add =JOptionPane.showInputDialog("Do you want to add more coustmer..\n'y'foryes ..\n 'n'for No .."); } while(add.charAt(0) == 'Y'||add.charAt(0)=='y'); writenew_cos(); // add_acounts(); } void writenew_cos() throws IOException{ ObjectOutputStream aa = new ObjectOutputStream(new FileOutputStream("coustmer.txt")); aa.writeObject(cos_info); JOptionPane.showMessageDialog(null,"Added to file done sucessfuly.."); aa.close(); } in Coustmer class : void read_cos() throws IOException, ClassNotFoundException{ person p1= null ; int array_count = 0; ObjectInputStream d = new ObjectInputStream(new FileInputStrea ("coustmer.txt")); JOptionPane.showMessageDialog(null,d.available() ); for(int i = 0;d.available() == 0;i++){ a.add(array_count,(ArrayList) d.readObject()); array_count++; JOptionPane.showMessageDialog(null,"Haaaaai :D" ); JOptionPane.showMessageDialog(null,array_count ); } d.close(); JOptionPane.showMessageDialog(null,array_count +"1111" ); for(int i = 0 ; i<a.size()&& found!= true ; i++){ count++ ; p1 =(person)a.get(i); user=p1.user; pass = p1.pass; cas_checkpass(); } } it just print JOptionPane.showMessageDialog(null,d.available() ); and having excep. here a.add(array_count,(ArrayList) d.readObject()); p.s : person object from my own class and it's Serializabled

    Read the article

  • Why do I keep on getting an exception-illegal operation on ResultSet?

    - by eli1987
    Here is the code-admittedly I'm terrible at Java, but surely I catch a null result set with the if....else statement....sorry its the whole Class: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * SearchParts.java * * Created on 08-Mar-2010, 12:14:31 */ package garits; import java.sql.*; import javax.swing.*; /** * * @author Deniz */ public class SearchParts extends javax.swing.JFrame { /** Creates new form SearchParts */ public SearchParts() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { if (!jTextField1.getText().equals("")) { String result = ""; int Partnumber = Integer.parseInt(jTextField1.getText()); DB db = new DB(); try { db.connect(); String query = "Select * from Stock Where Part_no =" + "'" + jTextField1.getText() + "'"; ResultSet rs = db.execSQL(query); if (rs.equals(null)) { PartNotFound nf = new PartNotFound(); nf.setVisible(true); } else { ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); int RowCount = 0; for (int i = 1; i < numberOfColumns; i++) { rs.getString(i); result += i + "/n"; } if (!result.equals("")) { Receptionist_FranchiseePartFound part = new Receptionist_FranchiseePartFound(); part.setVisible(true); while (rs.next()) { RowCount++; } part.getTable().addRowSelectionInterval(0, RowCount); } else { PartNotFound nf = new PartNotFound(); } } } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(jButton1, "More information needed for search", "Error Message", JOptionPane.ERROR_MESSAGE); } } else if (!jTextField2.getText().equals("")) { String result = ""; DB db = new DB(); try { db.connect(); String query = "Select * from Stock Where Part_name =" + "'" + jTextField2.getText() + "'"; ResultSet rs = db.execSQL(query); if (rs.equals(null)) { PartNotFound nf = new PartNotFound(); nf.setVisible(true); } else { ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); int RowCount = 0; for (int i = 1; i < numberOfColumns; i++) { rs.getString(i); result += i + "/n"; } // Receptionist_FranchiseePartFound part = new Receptionist_FranchiseePartFound(); // part.setVisible(true); if (!result.equals("")) { Receptionist_FranchiseePartFound part = new Receptionist_FranchiseePartFound(); part.setVisible(true); while (rs.next()) { RowCount++; } part.getTable().addRowSelectionInterval(0, RowCount); } else { PartNotFound nf = new PartNotFound(); nf.setVisible(true); } } } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(jButton1, "More information needed for search", "Error Message", JOptionPane.ERROR_MESSAGE); } } else if (jTextField1.getText().equals("") && jTextField2.getText().equals("")) { String result = ""; DB db = new DB(); try { db.connect(); String query = "Select * from Stock Where Manufacturer =" + "'" + jTextField3.getText() + "'AND Vehicle_type ='" + jTextField4.getText() + "'"; ResultSet rs = db.execSQL(query); if (rs.equals(null)) { PartNotFound nf = new PartNotFound(); nf.setVisible(true); } else{ ResultSetMetaData rsmd = rs.getMetaData(); int numberOfColumns = rsmd.getColumnCount(); int RowCount = 0; for (int i = 1; i < numberOfColumns; i++) { rs.getString(i); result += i + "/n"; } // Receptionist_FranchiseePartFound part = new Receptionist_FranchiseePartFound(); // part.setVisible(true); if (!result.equals("")) { Receptionist_FranchiseePartFound part = new Receptionist_FranchiseePartFound(); part.setVisible(true); while (rs.next()) { RowCount++; } part.getTable().addRowSelectionInterval(0, RowCount); } else { PartNotFound nf = new PartNotFound(); nf.setVisible(true); } } } catch (Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(jButton1, "More information needed for search", "Error Message", JOptionPane.ERROR_MESSAGE); } } else if (jTextField3.getText().equals("") || jTextField4.getText().equals("")) { JOptionPane.showMessageDialog(jButton1, "More information needed for search", "Error Message", JOptionPane.ERROR_MESSAGE); } } /** * @param args the command line arguments */ // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; // End of variables declaration }

    Read the article

1 2 3 4 5 6  | Next Page >