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);
Write a program that continuously asks for an alphabet letter, and stops when a non-alphabet letter is entered. Then output the number of upper case letters, lower case letters, and vowels entered ....
I'm up to an app which includes Alarm clock in it. User selects the date using JSpinners and My Alarm clock class checks if the current date is equal to the selected date and pops up an alarm. That's all i've done so far. What i want is some ideas about how can i manage these alarms in my app. What i think is:
* Getting alarm dates from user and save it in database and creating a thread which runs always and check database whether there is an alarm... (will it make my app) ??
In simple words how to continuously check for upcoming alarms and popup any time any alarm comes up during my app is running
Note: My App is not only about alarms, it also contains a complete management system.
I'm writing a really simple 1 on 1 chatting program thing using java.net.Socket and reading each other's messages b using writeUTF() and readUTF() of java.io.DataOutputStream and java.io.DataInputStream. Thing is, I wanna write a thread for both sides to continuously read from their respective socket's input streams while ignoring the lack of data coming through like when one user is not sending a message or something. I've written a dumbed down version of this that only reads one message from only one side and another one that sends a file, both of which work fine, I guess.
I'm using java.util.Scanner for user input, if that's acceptable, for I am not too familiar with Java's other readers. Also, I just started teaching myself about java.net.Socket, so I may not be too familiar other than the basics like how to set up a connection and how to send data using the getOutputStream() member function and stuff like that.
I'm trying to synchronize two folders and their sub directories between a client and a server. I have a modified version of this class which I've posted below. In my Client class, I create a WatchDir object and call its processEvents() method in an infinite loop. The method returns a myTuple object (a struct containing the event type and a path object) if an event is registered and null if not.
The problem is that this only seems to work for the first event to happen in the directory (i.e. if I add a file to the watched folder, my WatchDir object.processEvents() returns one Tuple with an ENTRY_CREATE event and never returns another Tuple for other file additions/deletions/modifications that happen after). I'd like for processEvents to be continuously called (hence the infinite while) returning a Tuple each time some event occurs.
I have the code below that just keeps getting the user's name and displaying it until the user enter's an empty string. Well, to simulate that, I just hit the keyboard instead of entering any name but for some reasons I am not seeing in my code, the programme just keeps looping.
System.out.println("Enter your name : "); Scanner st = new Scanner(System.in); while(st.hasNext()){ System.out.println("Enter your name : "); String name = st.nextLine(); System.out.println(name); if(name==" ") break; } System.out.println("you are out of the while loop now!!");
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'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?
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`";
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'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: