Search Results

Search found 15 results on 1 pages for 'newbie123'.

Page 1/1 | 1 

  • JTable listener problem

    - by newbie123
    I added a mouse clicked listner to my jtable, when i double click the row, will pop up an window accordingly. jTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent e) { double amount = Double.parseDouble(jTable.getValueAt(getSelectedRow(), 4).toString()); String remarks = jTable.getValueAt(getSelectedRow(), 3).toString(); String transactionID = jTable.getValueAt(getSelectedRow(), 1).toString(); new EditFrame(...) } }); This code I used to retrieve the row selected row. public int getSelectedRow() { jTable.getSelectionModel().addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { int viewRow = jTable.getSelectedRow(); selectedRow = viewRow; System.out.println(viewRow); } }); return selectedRow; } In my case, I realised when I clicked the second row in the first time, I get null for selectedRow, only when I select first row then second row, I then can get the correct data. And If I removed the mouse listener the problem then be solved. Is it because I doing something wrong at the mouse click listener?

    Read the article

  • How to configure database for exe.file

    - by newbie123
    Recently I had created a Java Desktop Application, I wish to share it with my friends. I was thinking to convert it into exe file using exe4j, but as for the database part I not sure how to configure it so that the application can run on my friends desktop without re-configure the database again. I am using Microsoft Access, anyone can guide me how to do it?

    Read the article

  • How to disable main JFrame when open new JFrame

    - by newbie123
    Example now I have a main frame contains jtable display all the customer information, and there was a create button to open up a new JFrame that allow user to create new customer. I don't want the user can open more than one create frame. Any swing component or API can do that? or how can disabled the main frame? Something like JDialog.

    Read the article

  • PHP Zend Debugger configuration

    - by newbie123
    Hi i am new to php, I currently learning php using eclipse. I know i have to install the zend debugger my php.ini store at c:windows i had added in these line: [Zend] zend_extension=c:/php/ext/ZendDebugger.dll zend_debugger.allow_hosts=127.0.0.1 zend_debugger.expose_remotely=always zend_debugger.connector_port=10013 but on command prompt i tried php -m it shown that i never install zend debugger. I not sure where goes wrong I check phpinfo also never show any zend information.

    Read the article

  • JSP How to scale an image?

    - by newbie123
    Is there anyway to scale an image then display in jsp page? When retrieve and display the images, I want to show all photos in same size. is there any API can do it? I have searched from google, those I found was about scaling images byusing tookit but can't works in web application.

    Read the article

  • JTree keep expanding problem

    - by newbie123
    I want to keep my jTree file expanded. I using below code to expand the jTree : public void expandAll(JTree tree) { int row = 0; while (row < tree.getRowCount()) { tree.expandRow(row); row++; } } It works, but when I add in new file or delete file the jtree collapse back. How can keep the jTree expanded?

    Read the article

  • JSP Upload File Java.lang.NullPointer

    - by newbie123
    I want to develope upload and download file from server. Upload.html <form action="/UploadFile/UploadFile" method="POST" enctype="multipart/form-data">Select a file: <input type="submit" name="button" /> <input type="file" name="first"></form> UploadFile.servlet protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String temp = request.getParameter("first"); System.out.println(temp); File origFile = new File(temp); FileOutputStream out = new FileOutputStream(request.getContextPath() + "pdtImages/" + "FirstFile"); InputStream ins = new FileInputStream(origFile); try { System.out.println(request.getContextPath()); byte[] buf = new byte[1024]; int len; while ((len = ins.read(buf)) > 0) { out.write(buf, 0, len); } out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } When I submitted the file I got null pointer error message. I not very familiar with jsp can anybody help me? I want to store the file to the server directory.

    Read the article

  • How to highlight the new created file in JTree

    - by newbie123
    I want to make it like when I click a button, it will create a new file. Then the jTree will highlight the new file. Below are my code. Currently I create new file, i will show the new file but no highlight the file. class FileTreeModel implements TreeModel { private FileNode root; public FileTreeModel(String directory) { root = new FileNode(directory); } public Object getRoot() { return root; } public Object getChild(Object parent, int index) { FileNode parentNode = (FileNode) parent; return new FileNode(parentNode, parentNode.listFiles()[index].getName()); } public int getChildCount(Object parent) { FileNode parentNode = (FileNode) parent; if (parent == null || !parentNode.isDirectory() || parentNode.listFiles() == null) { return 0; } return parentNode.listFiles().length; } public boolean isLeaf(Object node) { return (getChildCount(node) == 0); } public int getIndexOfChild(Object parent, Object child) { FileNode parentNode = (FileNode) parent; FileNode childNode = (FileNode) child; return Arrays.asList(parentNode.list()).indexOf(childNode.getName()); } public void valueForPathChanged(TreePath path, Object newValue) { } public void addTreeModelListener(TreeModelListener l) { } public void removeTreeModelListener(TreeModelListener l) { } } class FileNode extends java.io.File { public FileNode(String directory) { super(directory); } public FileNode(FileNode parent, String child) { super(parent, child); } @Override public String toString() { return getName(); } } jTree = new JTree(); jTree.setBounds(new Rectangle(164, 66, 180, 421)); jTree.setBackground(SystemColor.inactiveCaptionBorder); jTree.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, new Font("Arial", Font.BOLD, 12), new Color(0, 0, 0))); FileTreeModel model = new FileTreeModel(root); jTree.setRootVisible(false); jTree.setModel(model); expandAll(jTree); public void expandAll(JTree tree) { int row = 0; while (row < tree.getRowCount()) { tree.expandRow(row); row++; } }

    Read the article

  • JTree TreePath casting problem

    - by newbie123
    I got this casting problem java.lang.String cannot be cast to java.io.File, when I trying to do this TreePath p = new TreePath(new Object[] {"src","file","My Diary" }); This is my jtree file model class FileTreeModel implements TreeModel { private FileNode root; public FileTreeModel(String directory) { root = new FileNode(directory); } public Object getRoot() { return root; } public Object getChild(Object parent, int index) { FileNode parentNode = (FileNode) parent; return new FileNode(parentNode, parentNode.listFiles()[index].getName()); } public int getChildCount(Object parent) { FileNode parentNode = (FileNode) parent; if (parent == null || !parentNode.isDirectory() || parentNode.listFiles() == null) { return 0; } return parentNode.listFiles().length; } public boolean isLeaf(Object node) { return (getChildCount(node) == 0); } public int getIndexOfChild(Object parent, Object child) { FileNode parentNode = (FileNode) parent; FileNode childNode = (FileNode) child; return Arrays.asList(parentNode.list()).indexOf(childNode.getName()); } public void valueForPathChanged(TreePath path, Object newValue) { } public void addTreeModelListener(TreeModelListener l) { } public void removeTreeModelListener(TreeModelListener l) { } } class FileNode extends java.io.File { public FileNode(String directory) { super(directory); } public FileNode(FileNode parent, String child) { super(parent, child); } @Override public String toString() { return getName(); } }

    Read the article

  • Java Swing how to create a task reminder

    - by newbie123
    How to create a event reminder. Example, an user created an event which is today 5.00pm and stored it into database. When ruun the program the reminder will pop up if the system time is 5.00pm. Is there any API can do that? From google what I got was those freeware.

    Read the article

  • JSP doPost getAtribute null value

    - by newbie123
    I want to pass value to servlet but I keep get null value. <jsp:useBean id="Helper" class="model.Registration" scope="request"/> <form action="/Project/Registration" method="post" enctype="multipart/form-data"> <input type="text" size="20" name="name" value="<%=Helper.getName()%>"> <input type="submit"> </form> protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Registrationh2 = (Registration) request.getAttribute("Helper"); if(h2!=null){ System. out.println(h2.getName()); } else System. out.println("NULL"); } Is there anything wrong with my code?

    Read the article

1