This is what the gui looks like at run time. The question is how do I compact it so there is not so much space between the labels and the textArea. I've tried using different numbers on my GridLayout, but not a lot of success.
I use a bluetooth module (dwengo) in combination with a microcontroller (PIC16F877A). I want write a bluetooth client program in java to communicate with the microcontoller. Examples of clients on internet do not work or give errors I cant'n resolve. There is one program ( SampleSPPClient ) that give no errors and shows the bluetooth devices present.
But when I choose my bluetooth module I got an error (Device does not support Simple SPP Service). I think that I have to use an other service of bluetooth but I don't know how to implement. Here is the program I tried to use ....
I need to take the users input from 2 boxes and reference that to a sqlite database and populate the fields with the data in the database. I know the database code work.
In a project for school. I have a program that links several GUI's as a menu based program. What I am trying to accomplish is when one of the previous GUI's is closed that it doesn't terminate the entire program. There is a lot of classes in the entire project so I'd prefer not to paste all the code here, but if it is necessary I will do so.
I have an application written in Java on the Linux platform. My application will work the following way:
User A will open application. User B will open application.User A will need to send User B a message but without a socket connection.User B will need to send User A a message but without a socket connection.The user should be able to identify the messages sent to each other.If User A reads user B's message the message will no longer be available in the channel of communication.If one user exits their application their message should be removed.User C should not be able to read user A and user B message (This is only via the application design, no real security here).Applications should be able to work on different machines however they will utilize a shared network mount to access files modified by each other.
I do have to note that the messages being sent is rather small and only 1 message is sent from each user, so in that regard I did not want to setup a client/server model to do this using sockets.
Basically I am looking for a similar concept as a message queue but more relevant to my requirements done in Java. What are some good options to use that will address some of my requirements? I have not touched Java in a long time and only have used it for certain usage so I am trying to get an idea of which current technologies are best for what I need.
I'm supposed to write a computer based testing program using files. I have started writing however, I am stuck. I am to prompt the user to enter the file name 'test.dat" and if something different is entered then a error message should be displayed. Also the file will create an input stream for the data using the file. I am to have the user enter other information about an employee and then write the record to the file.
The program should be created so when the user enters "quit" the loop is terminated and the file is closed. I'm not asking for code. I was just giving a brief synopsis of the project. Where I am stuck is I wrote the first part of the program that creates the file; however when I enter a wrong file name the exception error message does not display. The code is below:
import java.io.*; import java.lang.*; import java.util.*; public class Project5Write { private Formatter x; public void openFile(){
I am trying to create a program that will estimate a child height based on the height of the parents. It should ask the user to enter a String representing the gender, so m or M for a male and f or F for a female. The program must handle both upper or lower case gender entries. I need it to ask the user for the height of both parents in two parts:
1. for Feet and store in an int variable. 2. for inches and store and int variable.
So for example if the father is 6' 2'', the user would enter 6 when asked for feet and 2 when asked for inches. Convert the height of the each parent to inches. hint 12" in one foot.
Apply the following formulas based on gender (must use an if statement(s)):
i have a problem in connecting my jsp program in MSsql 2005 i want to create a connection in my jsp program to MSsql database but theres an error of my work here is my code
I have written java program which can extract online data from url and i want to store it in data base in new token row in table so than i can use in my application . how could it be done using type4 drive ..
These are my code ...
import javax.swing.text.html.parser.*; import javax.swing.text.html.*; import javax.swing.text.*; import java.io.*; import java.util.StringTokenizer; import java.net.*; public class ParseTest extends HTMLEditorKit.ParserCallback {
I am writing a java program which searchs data from a database on a website , my problem is that the url does not works on IE but works fine in other browsers..
Can we cance/stop a long running database query execution instantly so that we can do any another task.
As i know swing uses a single thread i,e Event Dispatch Thread (EDT), But at the same time we can use Swingworker class for better use of UI. When we use Swingworker class the process goes to a different thread and our basic UI is not Frozen. Infact we can do another task. But what I want is I want to stop of cancel the execution of swingworker thread ( Because I that thread takes long time to execute). How can I do that??
I used ProgressMonitor and in the cancel option i canceled the task ( worker.cancel(true) also i closed the connection and statement for executing the database query using stmt.close() and conn.close() methods.
But it does not work. How to cancel a long running database background process in a Java Swing Program.
OK very similar to switches & cases & ifs, but I'm wondering if I can do something like that:
public Method[] method; method[0] = walk(); method[1] = run(); method[2] = stop(); for (int i = 0; i < x; i++){ if (i == myNumber) { run m[i]; return; } }
I am implementing a console based interface for an assigment. I've got a DAO interaces and implementations ready and I am stuck on a loop that checks whether to display logged in menu or logged out menu.
public static void main(String[] args) throws SQLException { Main consoleInterface = new Main(); boolean runningLoop = consoleInterface.isRunning(); boolean loggedOutLoop, loggedInLoop; while(runningLoop) {
[Code] ....
So when this runs it should show loggedIn() method only and only if the condition is not met. At the start when program runs I set loggedOutLoop = true and loggedInLoop = false. When I handle login I set loggedOut = false and loggedIn = true
What seems to happen is that the else statement doesnt work and the output I've got is only loggedOut() method displayed where I only want loggedIn() to be displayed without loggedOut().
I'm trying to create a tile based map JPanel but all I get is a white screen. I'm fairly new to the Java Swing and AWT package so I've been watching tutorials on YouTube so learn as much as I can.
I've got three classes: Window.java which includes the Main method, Panel.java which is the JPanel and Tile.java to draw all the images into an array.
Window.java:
import javax.swing.JFrame; public class Window extends JFrame { public Window() { setTitle("Project"); setSize(500, 400);
[Code] .....
I've checked through everything and still cannot find what I'm doing wrong. I did try different codes but I just got errors instead.
I'm relatively new to Java, I'm trying to create a text based game, like those old ones where you type "north" or "east" to move as such, and "look" to inspect the area. My only problem thus far has been trying to figure out just how I should... "structure?" the movement. As in, what's the best overall way to approach this? I've tried making a new method for every area and just passing a variable called "location," but along with passing the inventory and stat arrays, it's just become messy. Or is this a good way to do it? I have a separate method for when the player enters something, but then how will it know which description to give when the player types "look?"
I have to write Scanner and Parser for the C-Code based on Java and obtain Abstract syntax tree(AST) . I am allowed to use tools like ANTLR, CUP. But i should be able to expand all macros in my code to its basic low level data type like int, boolean and whats the best approach?How to start initially?
I started a text based game, but I am dissatisfied with the console that PrintF prints to. How can I set up a window and have text output to that window, and have my player type responses in the window?
I am new to JSP !! and I'm developing a web-based chatting system using JSP and socket.
The problem I am facing is that the sender can send message but on the receiver side we have to manually refresh the page. The sender stays into blocking mode until the receiver refresh its page !
After that I've implemented auto-refresh on the receiver side and "Connection Refused" exception is generated.
For some time i've been trying to rewrite my XML configurated webapp into one that has Java Based cofiguration. Unfortunately ,even after going through many tutorials i've been unable to do so.
So, I've been working on creating a text-based game engine that would create games similar to Achaea. It's been working pretty well so far. I just finished creating a great mapping system, but now I've run into a problem. I have a mapping system, but actually creating a map would prove to be quite a lot of work. Each location that the player can be inside of has a name, description, map symbol, and an array of the things inside of it. How can I make some sort of map creation program or something so that I can create my maps more easily?
I thought perhaps making a constructor that accepts a list of files, the first containing a table of strings for the names, the second containing a table of strings for the descriptions, etc.; but it seems that would be quite tedious and may be more complex than actually just hard-programming maps.
i'm totally new to Java.I'm making a small text based RPG and this is what i've come up for now.
Java Code:
import java.util.Scanner; class Main { public static void main(String args[]){ Scanner input = new Scanner(System.in); Player playerObject = new Player();
[code]....
My thing is that i want the user to enter 'Caucasian' or another race in the console below and i want it to be saved in a variable or something else in the Player Class that i can later use it in texts or something else. My question is how can i do it?
I tried like 'int Mongoloid = 1; int Caucasian = 2;'
And the same with the others, and after that i tried to use them with the Switch Statement but it did not work.
I'm currently trying to build a DAO based application where you use a text file as a data source. It have worked out well until I tried to delete lines from the file.
I've managed to fill out the temp file with everything except the line I wanted to remove, but when I try to replace the original file with the temp file it won't work. It casts the error: "temp.txt -> databilar.txt".
I've also tried to use the renameTo method without any success...