I have an applet and start some process on Windows from applet. When I start this process just from another code(test), this code works fine and process runs from rt.exec() to proc.destroy(). When I use html call for applet - process runs only for 5 seconds every time (!!!) and then just alive, doesn't work, to proc.destroy(). This is really interesting for me (newbie in applets). I think, this issue caused by AccessController. I use Windows, medium Java security lever and applet is self-signed. It asks me to 'allow', applet works.Here's the code:
I have a jtextfield that I want to make invisible on start. I do not see an option for that in the design side under properties. I am a VB programmer and in VB there is an option under properties to make it visible or invisible.
I want to make installler for my client application in swing using exe4j but after making installer using exe4j When running the exe of application it gives me error as following
java.lang.NoClassDefFoundError: chrriis/dj/nativeswing/swtimpl/components/JFlashPlayer at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getDeclaredMethod(Unknown Source) at com.exe4j.runtime.LauncherEngine.launch(Unknown Source) at com.exe4j.runtime.WinLauncher.main(Unknown Source)
[Code] ....
The source code of my project is as follows:
/* * See the file "readme.txt" for information on usage and redistribution of this file * And for a DISCLAIMER OF ALL WARRANTIES. */
I was developed a simple GUI, in that it requires modification of jtextfield content while JComboBox item selected and vice-versa. I was used itemListener on JComboBox and Document Listener on JTextField. It was gives exception while running the code. Because one listener source effected by another one..
Exceptions are like this:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Attempt to mutate in notification at javax.swing.text.AbstractDocument.writeLock(Unknown Source) at javax.swing.text.AbstractDocument.replace(Unknown Source) at javax.swing.text.JTextComponent.setText(Unknown Source) at ronanki.swing.pcahostsimUI$5.itemStateChanged(pcahostsimUI.java:368) at javax.swing.JComboBox.fireItemStateChanged(Unknown Source)
public class pracDraw extends JFrame { private Color red=Color.red; public int i; private Color white = Color.white; JPanel pr=new JPanel(); JTextField t=new JTextField();
[code]....
If u run it you can see that the JTextField (t1) is drawn on the panel along the line but it does so with a gray border. How do i eliminate that grey border and only draw the text field along the line and finally make the text field green after it reaches the end of line?
So, I have a gameOver() method that should when oval goes out of bounds abort game but, as soon as I start the game it runs the gameOver method. I've been looking over it for a while trying different things. I think what stood out to me is removing the abort sequence the game runs mostly as it should after, popup is closed and that if I replace game.gameOver(); with ya = -1 the ball bounces off the wall.
I am trying to make a puzzle game in java.I have made it successfully.But the problem is,when it starts its already solved.I want it to start unsolved so the user can solve it.My code is:
I am getting the error "Line 54, illegal start of expression". Line 54 is where my "for" starts. It was running ok earlier, now I can't get this error to go away?
Lines 7 , 10 ,13 .... All have a Illegal Start of Expression error.
[color=blue]private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Random rd = new Random(); int random = 0; random=rd.nextInt(6)+1; switch(random){
I'm trying to get a timer to work to decrease the value of a stats bar (like Hunger Level, Energy Level), but it won't paint the bars in the first place, it won't let me start the timer (the start after t.start() is underlined) and now I'm getting an error that won't let me run it at all without putting public static void main (String [] args), even though adding it anywhere is causing other errors
public void hungerTimer () { int delay = 300; int period = 300; interval = 100; hungerBar.setValue(100); hungerBar.repaint(); timer = new Timer();
I made a tiny app that saves notes to a folder within the classes directory where I created the .jar file.Let's say I wanted to add this to Java Web Start. Would I be able to transfer the jar file within a folder(s) or would I have to change the program so that It creates a new folder to save texts In automatically ? Basically , can jar files be transferred with other files/folders ?
why the complier is giving the following error message "illegal start of expression" once it reach the countSpaces method.The way I see it (and I am obviously seeing it wrong), the code is public since why not, int since it returns an int # and the method has return int in it, and static I am not too sure but I get the same error message whether or not it is included
public static void main (String args[]) { Scanner in = new Scanner(System.in); String sentence; System.out.println("type a sentence"); sentence = in.nextLine(); countSpaces (sentence);
am trying to Develop a download manager that will improve the downloading process, by splitting big files into different parts, and download each part of the file parallel and then combine them properly Just like JDownloader not really too complex like it though but more like it especially the split download part of it. I was able to get a script from some eBook but that doesn't really solve my problem as it only downloads pause and resumes which is not really what am looking for.
I've written my program and don't know the algorithm for a postfix notation and how to make one correctly?how to start my algorithm for my enterAction actionPerformed button?
I was tasked to do a 2-4 player network card game. Before I jumped into doing the card game. I decided to try out an a simple program which is the clients taking turns to type in their textfield.
I have a server that listens to 3 incoming client connections. once all 3 clients is being connected,
Steps
1) The first client will send the message first while the second and third client will wait for the first client to finish sending.
2) After the first client finished sending the message, it will be second client turn to send the message and the third client will wait for the second client to send finish.
3) After the third client finished sending the message, it will be third client turn to send the message and the first client will wait for the third client to send finish and (go back to step 1))
**The first client can only start typing once all 3 clients is being connected**
In my server class,I spawn a new Thread once a client is connected, I do a wait() on each time the client is being connected, I stored the thread in a arraylist as well. I have an id to keep track how many clients is currently connected. once the id reaches 3, I used notifyall() to notify all the threads and set the first position of my arraylist as my currentThread so that I can keep track which is the currentThread running.
I started 3 clients. and I typed the textfield of the first client but my server isn't receiving any messages.
class Server implements Runnable { private List<SpawnNewThread> sntList = new ArrayList<SpawnNewThread>(); private SpawnNewThread currentThread; private int id = 0;
I've done basic programming in java using Netbeans IDE. So I've good foundational knowledge in java programming. Now I looking forward to draw shapes in java and eventually learn to make simulations. Now I want to learn to create geometric shapes like circle triangle, rectangle etc. I don't know in which Jcomponent(s) should I set the drawing of the shapes, the codes, the libraries and classes I need to import.
Why does this not work? I get an ']' expected at the y in the fourth line of code and an illegal start of an expression at the actual ] in the same line
int y = 0; JTextField response[] = new JTextField[10]; while(y < 10) { JTextField response[y] = new JTextField(7); add(response[y]); response[y].addItemListener(this); ++y; }