I've been programming for a while, but I never made executables... just ran it from the compiler. Now, however, I really want to have an icon for one of my programs that would be conveniently located and clickable. So, I made a jar file, both in Eclipse and BlueJ. When I run this file in command line, it works fine (with "java -jar ..."). In case of Eclipse, this worked with both "jar" and "Executable jar" options. However, when I double click the icon, nothing happens. First I was getting "can't find main class" error, but that was an easy fix with the manifest file. But now, nothing seems to happen at all. Could this be because the program is supposed to run in the command line or whatever the compiler offers and there is nothing to force the computer to open one of those windows?
I want to make a simple game and learn java by experimenting with it.I don't know how to increase a value by clicking it.I know how to make my objects move in my small game with mouse or keys, but I also got a score var that I want to increase per click. I can increase it over time, but after 2 hours of trying I couldn't progress any further.This is the piece of code I used, I imported the class, got getters n setters and all of that...
if(e.getButton() == MouseEvent.BUTTON3) hud.setScore(hud.getScore() + 555); Whenever I click I get an error, if I remember right "NullPointerException" is when something is missing I'm probably not targeting the value correctly... Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.tutorial.main.MouseListens.mouseClicked(MouseListens.java:22) at java.awt.Component.processMouseEvent(Unknown Source)
I am writing a script for a program, now I am very new to Java. So, issue I am having is the program keeps clicking on the MM continuously. I just want it to click each spot 1 time.
Here is my code :
public class ToPortal implements Strategy { Tile Portal = new Tile(2681, 2591); Tile To = new Tile(2667, 2601);
as there is a button on the website, that I need to click, but it returns a number using javascript that will access the page. Without that number, accessing the page won't work. Therefore, either I need to click the button, or return that data when I access the url. Here is the line in the html.
Here's my coding so far...I want to be able to change what the JLabel says when clicking on one of the buttons for example : when clicking on UP i want it to say "Going Up!"...how do i do this?
import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JLabel; public class BorderLayoutJFrame extends JFrame {
I am writing code for a form in which i want to display data by selecting radiobutton.The code is working for single radiobutton but it not work when i select the other radiobutton.
Capture.PNG1.jpg
the code is given below:]
private void jRadioButton1ActionPerformed(java.awt.event.Action Event evt) { // TODO add your handling code here: int LIMIT = Integer.parseInt(jTextField2.getText()); int ULIMIT = Integer.parseInt(jTextField3.getText()); { DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
I have added a windowListener to my JFrame but for some reason it is not being called when I click X to close the window. I need to send a message to a server to notify it that the client window is closed. Some code snippets below (some lines excluded for brevity):
public class ChatGUI extends javax.swing.JFrame { .... setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); // I have all the window constants here but has no effect other than closing the window without calling the listener... addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosed(java.awt.event.WindowEvent evt) { formWindowClosed(evt); } }); .... private void formWindowClosed(java.awt.event.WindowEvent evt) {
Is there a way to disable sorting by clicking on the JTable headers?I have tried a few ways but because I am sorting the data when I load it that 'breaks' that also. Here is what I am trying to achieve.
Everything is working great except for my back button at line 172. It works good but if I try to click the "insert" button again. It gives me the java.lang.NumberFormatException error. Other than that it works fine, the "insert" button still works.
package userDatabasePack;
import java.sql.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Database{ //Variables private String username2, insertUser, insertPassword; private int insertUserId;
I want to create a online examination system.i want to know to how to get questions 1 by 1 on the same jsp page and on clicking the submit button the result should be saved in database.
I only want the context menu to be showen if the user is clicking on an actual listview item, not if they click anywhere else in the listview. I know this is possible and I found answers to similar problems, but in the end they didn't provide enough infomation for me to solve my issue. I found this example on how to do it with a list view containing String objects, but what if my list view contains another object, in my case a wrapper class? I have a wrapper class to keep track of the key, but I only display the value variable in the listview, through calling the toString method. So the cells still contain a wrapper.
class Wrapper(int key, String value) { .. } public String getValue() { return value; } public SimpleStringProperty getValueAsProperty() { return new SimpleStringProperty(value); } public String toString() { return value; }
[Code]....
But line 05 gives me a NullPointerException, why? I do this after I've set the items of the list view by doing listView.setItems(..).
I am getting Web Page Expired error while clicking the back button of the browser, after submitting a form. The form method is POST. ( I have to keep it that way). I tried this code
In my code where the Button Action Performed is created, I have done the following to ensure that the visibility of the JTable and JScrollPane have been set to true. But it does not work?
i want to make adding into mysql database and then when i click adds, jtable show those data automatically. but it seem to get error at display part, it shows " Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - illegal start of expression" and jtable do not show the added data but in mysql, data is properly kept.
private void jtPropertyChange(java.beans.PropertyChangeEvent evt) { DefaultTableModel model = (DefaultTableModel) jt.getModel(); try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection(url, user, password); String sql = "SELECT * FROM `companya`";
In a program I created, I'm using a text file that contains some texts needed for the program. The method relevant to this is something like the following.
private String wordgen(){ try { BufferedReader reader = new BufferedReader(new FileReader("src/Resources/adjectives.txt")); Random rand = new Random(); int low = rand.nextInt(400); String fil=""; int i=0; while(i!=low){
[Code]...
The program runs fine in netbeans project but once the jar is created it does not corporate with the text file. ("null" is returned) How can I attach text files to jar and exe?
I got one task from my manager, regarding browser back button, refresh button. He asks me the web application has to work like Banks site... means if I refresh or click on Back button(Browser's) then it has to throw the user out of session, I checked lot in internet. But I found like only disabling back button of disabling F5 keys like that. But he’s not accepting that.
How to approach for this? Can we throw the user out of session when he clicks on browser back button or refresh button. I think its possible . But i don't know how to implement.
I need to transformation the txt files into xml files, but each row txt files don't have same elements, for example the first book is composite one author
I'm doing a software Java GUI - JFrame form like this:
1. The user wants to click on a button that opens a bunch of images that will be displayed as thumbnail in the bottom of the JFrame . 2. Then the user wants to select/click one of the thumbnail and make appear the corresponding image in it's original size on above(center) of the JFrame.
For doing this I used 3 JPanel.
One contains a JButton that opens the jfilechoser dialog window, the second "panelPreview" is for putting the thumbnails created, and the third "panelGrande" is for the image in it's original size.
The firs part "1." is ok.
But in the second part : I got one error when I want to put the ImageIcon in to the JLabel with the further intent of displaying it.
lblBig(imgIcoVett[i]);
In this project I'm dealing with arrays of ImageIcons and JLabels, so it's a bit advanced level for me, so I'm not sure that I wrote right the part of the MouseListener too.
The error displayed by netbeans says "cannot find symbol symbol: method lbl (ImageIcon) local variables referenced from an inner class must be final or effectively final"
Here I attach the project I did with netbeans"AAAD Unlayout 2.zip", but if you just need the highlight of the code, here it is too:
I'm having some trouble with a code I am writing for class. I had an 2 errors like this before this one and fixed it by changing int avgRe, avgMiles =0; to double. Now I am getting this error and am stuck on what I need to change. Here is the code:
import java.io.*; import java.util.*; import java.text.*; public class Reimbursement_3_09 { static Toolkit tools = new Toolkit(); public static void main (String [] args) throws Exception {
[Code] ....
This is my error:
[code=Java] Reimbursement_3_09.java:33: error: incompatible types: possible lossy conversion from double to int summary (outFile, totalAmount, ctrMiles, ctrMilesgt0, avgRe, avgMiles); ^ Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error