|
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
public class Post extends Frame
{
public Post()
{
this.addWindowListener(new MyWinAdap());
}
public void paint(Graphics g)
{
g.setColor(Color.black);
Dots d = new Dots();
Text t = new Text();
d.start();
t.start();
}
public static void main(String[] args)
{
Post dtd = new Post();
dtd.setTitle("Dots and Displaying text");
dtd.setSize(500,500);
dtd.setVisible(true);
}
}
class Dots extends Thread
{
public void run()
{
int x,y;
Graphics g;
for(;;)
{
x=(int)(Math.random() * 500);
y=(int)(Math.random() * 500);
g.drawLine(x,y,x,y);
try
{
Thread.sleep(20);
}
catch(Exception ex)
{
}
}
}
}
class Text extends Thread
{
public void run()
{
Graphics g;
g.drawString("Hello!",100,100);
}
}
class MyWinAdap extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
It gives an error - "variable g might not have been intialised".
I want two or more threads working on the same frame displaying different kind of data.
How can I do this??
Is there any solution to this??
I'm a beginner please guide me..
|
|
|
|
|
|
Graphics is a class. so we are creating an object for that class.g variable is not a problem.
create multiple threads and pass POST object to threads which extends FRAME class.
|
|
|
|
|
I installed the sun java application server and am have a big problem. After I installed the application a menu option folder "Sun Microsystems" was added to my All Programs. After the installation it seemed that all of the options were installed except for the actual application server. I ran the uninstall menu option and now the "Sun Microsystems" menu option folder is still on the All Programs list and except the main folder no menu items appear except for the sub folder "Application Server PE" and in it the contents display (empty). Also, after reading several posts it indicated I need several key values from the registry should be removed. After looking at the registry the options key value indicate (default), (value not set). Now when I go back and retry to install the application server again I receive the error "Could not find the required version of the java(TM) Runtime Environment.
I am really stuck and need help bad. Can someone help?
|
|
|
|
|
Install the Java Runtime as suggested by the error message. You may first need to ensure that everything related to both packages is removed from your system first. You also may get better support for the application server issue at the Oracle support forums.
|
|
|
|
|
I am getting the following exception while upgrading the axis2 version from 1.5.4 to 1.6.1.Note i am using OSGi 3.8.2,jetty server version 8.1.3
2015-09-04 19:21:42.250:WARN:oejs.ServletHandler:/services/WebServiceReceiver java.lang.RuntimeException: Undefined 'Security policy namespace cannot be null.' resource property at org.apache.rampart.RampartException.getMessage(RampartException.java:81) at org.apache.rampart.RampartException.(RampartException.java:41) at org.apache.rampart.RampartException.(RampartException.java:57) at org.apache.rampart.RampartMessageData.setWSSecurityVersions(RampartMessageData.java:373) at org.apache.rampart.RampartMessageData.(RampartMessageData.java:261) at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:61) at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65) at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340) at org.apache.axis2.engine.Phase.invoke(Phase.java:313) at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262) at org.apache.axis2.engine.AxisEngine.sendFault(AxisEngine.java:516) at org.apache.axis2.transport.http.AxisServlet.handleFault(AxisServlet.java:433) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:216) at javax.servlet.http.HttpServlet.service(HttpServlet.java:755) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:598) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:413) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111) at org.eclipse.jetty.server.Server.handle(Server.java:350) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454) at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:900) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:954) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:851) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:606) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538) at java.lang.Thread.run(Thread.java:744) [2015-09-04 19:21:42,292] 637744 [Thread-95] ERROR errors - ERROR:CONNECTOR:webserviceconnector:Attempted read on closed stream. [2015-09-04 19:21:42,294] 637746 [Thread-95] ERROR errors - CONNECTOR:webserviceconnector:webservice:Attempted read on closed stream.
Rohit
|
|
|
|
|
This is not a Java programming issue. You should go to the axis2 website for help.
|
|
|
|
|
I need assistant in developing java application student's result transcript
|
|
|
|
|
|
book examples of procedure stored for sqlserver
|
|
|
|
|
|
|
Hello,
I am wondering if following methods in my script are vulnerable for DOM XSS attack? If yes, what is the best practice to write them. Kindly help if you can guide about it.
1. document.createElement()
2. document.getElementsByTagName()
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
Thank you for your time.
Best Regards,
Supriya
|
|
|
|
|
|
I am really sorry for that. Thank you for the correct group link.
Best Regards,
Supriya
|
|
|
|
|
Hi,
I have to learn java quickly in real time .
currently i'm not have that much tough in jav platform please advice how to learn
my email address cutesam.mca@gmail.com
|
|
|
|
|
|
Is anyone doing Mutation Testing?
It is something I recently discovered and Java has a great tool for it called PIT. I honestly feel it is one of the greatest things since sliced bread but no one seems to really be doing it. The concept has been around since '71 so I am really wondering why it has taken so long to catch on.
|
|
|
|
|
good luck!!!
modified 1-Sep-15 8:36am.
|
|
|
|
|
|
This is not even a question, but an assignment. We can provide help if you are stuck, but I don't think anyone will adapt it simply out of boredom.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Hi Experts...
I want to develop an application based on SOA(Service Oriented Architecture).
What is best java solution? my application has a service based core and multiple UI(web, android, desktop and ....)
i study about Spring MVC. Is this framework good solution? Is there any better solution Or Basically is java good tools for such application?
I want to develop my application in modular manner i mean i want to have multiple independent subsystems.
please help me.........
|
|
|
|
|
It is really not possible to give a definitive answer to such a question, as there are too many unknowns to consider. You need to look at all the different frameworks, and decide for yourself which one appears to be the most cost beneficial for your requirements.
|
|
|
|
|
what is the best tools can I use it to write Java code for Android Applications
|
|
|
|