Double-clicking Jar Files?

Nov 10, 2009

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?

View Replies


ADVERTISEMENT

MouseListener - How To Increase A Value By Clicking It

Dec 25, 2014

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)

[code]...

View Replies View Related

Program Keeps Clicking On MM Continuously

Feb 3, 2014

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);

[Code] ....

View Replies View Related

Clicking Href Button With Java

Dec 1, 2014

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.

<a href="/missions.php?jid=11&cat=2&formNonce=49af09362db790 a6b364401c4ea52a08b515df4a&h=284e4fe4946e6fb8af3a6 62f4583454eebc8bd23" class="actionButton" onclick="return fsb11('5494');">Do It</a>

View Replies View Related

Applets :: Display A Picture By Clicking On Checkbox?

Jan 22, 2014

ItemListener: checkbox component

I want to display a picture by clicking on the checkbox.

Here is my code:

public class Dukes {
String action;
String friend;
public String getActionImage() {
return action;

[Code] .....

View Replies View Related

How To Change JLabel Text By Clicking On JButton

Feb 25, 2015

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 {

[Code] .......

View Replies View Related

Display Data By Clicking Radio Button?

Dec 28, 2014

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();

[code]....

View Replies View Related

Swing/AWT/SWT :: WindowListener Not Being Called When Clicking X To Close Window

Oct 14, 2014

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) {

[code]....

This is resolved, needed to use...

addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});

... instead.

View Replies View Related

Swing/AWT/SWT :: Disable Sorting By Clicking On JTable Headers

Nov 18, 2014

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.

Sort by 3 columns:

table.setAutoCreateRowSorter(true);
table.getRowSorter().toggleSortOrder(6);
table.getRowSorter().toggleSortOrder(7);
table.getRowSorter().toggleSortOrder(5);
table.getRowSorter().toggleSortOrder(5);

but then I want it so the user cannot resort that when the table is displayed..

View Replies View Related

Load Data In Text View By Clicking Button?

Jan 20, 2014

Connection conn = null;
ResultSet rs = null;
PreparedStatement pst = null;

[Code]....

View Replies View Related

Clicking Insert Button - Number Format Exception

Feb 9, 2015

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;

[Code] ....

View Replies View Related

JSP :: Clicking The Submit Button Result Should Be Saved In Database

Jun 26, 2012

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.

View Replies View Related

JavaFX 2.0 :: How To Not Show ListView ContextMenu When Right Clicking On Null

Jun 16, 2015

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(..).

View Replies View Related

JSP :: How To Get Rid Of Webpage Expired Error When Clicking Browser Back Button

Jul 1, 2014

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

<%session.setHeader("Cache-Control", "no-cache");
response.setHeader("Cache-Control", "no-store");
response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");
%>

In my jsp. Still it is not working. I also tried

<script language="JavaScript" type="text/javascript">
window.history.forward(1);
</script>

View Replies View Related

Swing/AWT/SWT :: How To Set Visible Of JScrollPane And JTable To True When Clicking A Button

Feb 13, 2015

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?

Code below:

private void RunQueryButtonActionPerformed(java.awt.event.ActionEvent evt) {
jScrollPane2.setVisible(true);
table_001.setVisible(true);
try {
PreparedStatement st =conn.prepareStatement(SQLTextEditor.getText());
ResultSet rs = st.executeQuery();
table_001.setModel(DbUtils.resultSetToTableModel(rs));
table_001.setAutoResizeMode(table_001.AUTO_RESIZE_OFF);

[code]....

View Replies View Related

Use JTable To Show Contents From MySQL Directly Without Mouse Clicking

Jan 31, 2014

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`";

[Code].....

the adding part seems to be fine

View Replies View Related

How To Remove Focus From JTextfield By Clicking Blank Area In JPanel

May 20, 2013

How to remove focus from jtextfield by click the blank area in a jpanel?

When I click the blank area in a jpanel. i want the cursor in the jtextfiled lost focus

View Replies View Related

How To Create Java Files Into Windows Applications (Exe Files)

Oct 26, 2014

What step to know to develop software..

View Replies View Related

How To Attach External Files To Executable Jar Or Exe Files

Apr 13, 2015

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?

View Replies View Related

JSP :: How Bank Sites Throw User To Session Expire Page By Clicking On Browser Refresh / Back Buttons

Jun 20, 2012

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.

View Replies View Related

How To Use JAXB - Transform TXT Files Into XML Files

Mar 10, 2015

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

<books>
<book>Title</book>
<price>price</price>
<author>Author</author>
</books>

but the second book is composite two author

<books>
<book>Title</book>
<price>price</price>
<author>Author</author>
<author>Author2</author>
</books>

I would have the xml files with the number of authors variables, I can use JAXB for my problem?or not?

View Replies View Related

Putting ImageIcon Into Label (Original Size) By Clicking On Label (Thumbnail Created Before)

Nov 6, 2014

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:
 
private javax.swing.JButton btnOpenfile;
private javax.swing.JFileChooser jFileChooser1;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblBig;
private javax.swing.JPanel panelGrande;
private javax.swing.JPanel panelPreview;

[Code] ....

View Replies View Related

Clicking On TextField Will Show Some Required Text Under Text Field

Mar 15, 2015

I am trying to run a simple program in which on clicking on the TextField will show some required text under the Text Field .Here is my code:
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
 class Awt
{
public static void main(String...s)

[Code] ....

I am expecting the on clicking anywhere inside the text field should show me the Text : "Mouse Clicked" . But i am getting this error:

Awt.java:77: error: cannot find symbol
tf.f.setText("Mouse Clicked");}
^
symbol: variable f
location: variable tf of type Awt
1 error

View Replies View Related

Conversion From Double To Int?

Nov 30, 2014

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

View Replies View Related

How To Compare Double

Jun 17, 2014

how can i compare two double values is this correct

Java Code:

public boolean isEqualToD(double s_src, double s_compareTo)
{
boolean flag = false;
try
{
if(s_src == s_compareTo)
{
flag = true;

[code]...

View Replies View Related

Array With Double And Int

Apr 11, 2015

Okey so i want to make an array like this

km = miles
10 6.214
15 9.321
20 12.428

and so on its a converter between km and miles and i have no clue how to do this...

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved