|
I never really watched Trumpton, but my children used to love it.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
|
Thanks for all your replies. I wanted something like an quiz system .After the particular time getsover the application should stop and also should start after a specific min
|
|
|
|
|
If you need to measure an elapsed time, a simple Thread with a sleep or wait in it may be sufficient.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Tech Mentro is leading of IT Training Center or Institute in Noida,Delhi-NCR,India which provide software course/tutorial
in Java Training,J2EE,.Net,PHP,Struts,Spring,Hibernate,Android,ejb,c++,c,Summer training,6 months project based training,
6 weeks industrial training programme,corporate,computer training for students of MCA/BE/BTech/BCA/MSc(CS&IT)and professionals.
Tech Mentro
http://www.techmentro.com
|
|
|
|
|
Hello
I am using the following code to use createLeafElement from PlainDocument
public class Doc extends PlainDocument {
private static final long serialVersionUID = 1L;
protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1)
{
return createLeafElement(parent, a, p0, p1);
}
}
The above class without the createLeafElement() method works fine .But if I add this method I get runtime error saying program not responding.
My purpose is to use createLeafElement() method.How can I use it?
Thanks
Prithaa
|
|
|
|
|
0. Wrap code in <pre> tags please.
1. What is the exact exception? Try using copy/paste.
2. The method wont work try calling the super implementation:
public class Doc extends PlainDocument {
private static final long serialVersionUID = 1L;
protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1) {
return super.createLeafElement(parent, a, p0, p1);
}
}
3. Finally, why override if you are not changing anything?
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
thanks for your advice
I dont want to override but the method createLeafElemenmt() and createdefaultroot() are not visible when I want to use them directly.
With the following object D1 the methods are not visible.
PlainDocument D1 = new PlainDocument();
Thanks for your time
|
|
|
|
|
The example I gave should work as it calls the protected method on the super class.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
yes it does do the needful
but why are the methods not visible in the subclasses
protected methods should be visible in subclasses,is it not?
thanks
prithaa
|
|
|
|
|
Read this[^] to understand access modifiers. If something is protected it is visible within the package and to any sub-classes. By being visible to the sub-classes, it can be called from the class, but not from classes referencing the class.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
|
I'm in the process of making the specifications for a project that i have to make at my university. The main topic is distributed systems. I've decided to make a distributed anti spam network.
By this i mean:
* Peer-to-peer network
* Each node can request / respond to queries about email identification signatures
* A catalogue of nodes and email signatures are stored locally with each peer
Now i'm just concerned if this could be defined as a distributed system or if it is just a network?
I hope you can answer my question.
Thanks
|
|
|
|
|
You could use Wikipedia as a reference for Distributed Computing[^]:
The computers interact with each other in order to achieve a common goal.
I guess that's the definition.
|
|
|
|
|
Hi every body,,
I write an app on android and i want send a string with sms to my server, because my length of string is bigger than one sms, i have to compress sms and send to my server, in my server i have a app that wrote with .net, and my problem in here!!!
I can`t find a solution for compress data in Android(Java) and decompress in C#....
Please Help......
|
|
|
|
|
you can't find a solution means you can't find a code that is already written in C# and Java, right?
first you should try to reduce the amount of data in that SMS-String. Can values be resized?
For example can you use integers instead of keywords? Every fixed value can be melted down to a short form (acronyms, integer, single char, char/int compbination, ...).
Are there enum in there -> also usable as integer.
141 characters is a lot of data - and to use an old phrase: "141 characters should be enough for everybody".
|
|
|
|
|
Law of diminishing returns.
The SMS limit is very low. Compression requires overhead. Consequently normal compression is unlikely to save space.
Generalizing the other response.
You want to send a message which has content A.
Your first step should be to look at A and find a different way to send the same information which takes less room.
For example say you want to send
item="purple pants"
Steps to reduce above.
1. Create table of common terms (can't be too big
2. Change above to the following
i40,57
|
|
|
|
|
I am a newbie in J2EE. I have installed NetBeans 7.01 package with GlassFish 3.1.1 (and Tomcat 7.0.14). By default NetBeans starts up the GlassFish server whenever I launch a web app. What should I change if I want to use Tomcat, instead of GlassFish with NetBeans? Thanks!
Best,
Jun
modified 6-Dec-11 15:29pm.
|
|
|
|
|
You need to right click the project go to the properties. Under Run you can select which application server you want to deploy the project to.
|
|
|
|
|
In fact, when you're creating your new J2EE project, you've got the option to define where you've installed the App. Server desired for your project, in order to allow the IDE to build the specific artefact with its deployment descriptors.
|
|
|
|
|
I am building an interface that will be run only locally on users computers using HTML (no web servers involved). What I'd like to do as part of this project is to be able to list the contents of local folders related to this project. Meaning I have a parent folder that will contain all the HTML pages as well as folders with PDF files in them. From my main page I'd like to have a link to those folders and when visited, that link would list the files in that folder. This way, when additional files are added or when files are deleted, the listing will reflect the actual folder contents. Right now this works by linking to the folders and getting the raw Directory listing but the listings are not pretty. I am looking for a more elegant way to achieve this.
Anyone know how to do this with HTML or Javascript?
Thanks,
Craig
|
|
|
|
|
Quite possibly, but this is the Java forum.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I would use a CMS. No need to develop that yourself.
try WebsiteBaker[^] as a simple CMS for small projects.
|
|
|
|
|
|
what are the coding is right for out put visualisation hanoi tower in netbeans?
import java.awt.*;
import javax.swing.*;
import no.geosoft.cc.graphics.*;
/**
* G demo program. Demonstrates:
*
*
* - A sample game application
* - Graphics animation
* - GObject reparenting
*
*
* @author Jacob Dreyer
*/
public class Demo14 extends JFrame
{
private TowersOfHanoi towersOfHanoi_;
private GWindow window_;
private Peg[] pegs_;
private int nDiscs_;
private JButton startButton_;
public Demo14 (int nDiscs)
{
super ("G Graphics Library - Demo 14");
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
nDiscs_ = nDiscs;
// Create the graphic canvas
window_ = new GWindow (new Color (200, 230, 200));
getContentPane().add (window_.getCanvas());
// Create scene
GScene scene = new GScene (window_);
double w0[] = {0.0, 0.0, 0.0};
double w1[] = {4.0, 0.0, 0.0};
double w2[] = {0.0, nDiscs_ * 2, 0.0};
scene.setWorldExtent (w0, w1, w2);
// Add title object and add to scene
scene.add (new Title());
// Create the 3 pegs and add to the scene
int nPegs = 3;
pegs_ = new Peg[nPegs];
for (int i = 0; i < nPegs; i++) {
pegs_[i] = new Peg (i + 1.0);
scene.add (pegs_[i]);
}
// Create the discs and add to the first peg
for (int i = 0; i < nDiscs; i++) {
Disc disc = new Disc ((double) (nDiscs - i) / nDiscs);
disc.setPosition (1.0, i);
pegs_[0].add (disc);
}
pack();
setSize (new Dimension (500, 500));
setVisible (true);
// Create the puzzle and execute the solution
towersOfHanoi_ = new TowersOfHanoi();
towersOfHanoi_.solve();
}
public void discMoved (int source, int destination)
{
// This is the disc to move
Disc disc = (Disc) pegs_[source].getChild (pegs_[source].getNChildren()-1);
double y0 = disc.getY();
double y1 = nDiscs_ + 4.0;
double x0 = pegs_[source].getX();
double x1 = pegs_[destination].getX();
// Animate vertical up movement
double step = 0.2;
double y = y0;
while (y < y1) {
disc.setPosition (x0, y);
disc.redraw();
window_.refresh();
y += step;
}
// Reparent peg
pegs_[source].remove (disc);
pegs_[destination].add (disc);
// Animate horizontal movement
step = 0.05;
double x = x0;
while (x != x1) {
disc.setPosition (x, y);
disc.redraw();
window_.refresh();
x += (x1 > x0 ? step : -step);
if (Math.abs (x - x1) < 0.01) x = x1;
}
// Animate vertical down movement
step = 0.2;
y = y1;
y1 = pegs_[destination].getNChildren() - 1;
while (y > y1) {
if (Math.abs (y - y1) < 0.01) y = y1;
disc.setPosition (x, y);
disc.redraw();
window_.refresh();
y -= step;
}
}
/**
* Graphics object for canvas title.
*/
class Title extends GObject
{
private GSegment anchor_;
public Title()
{
GStyle style = new GStyle();
style.setLineStyle (GStyle.LINESTYLE_INVISIBLE);
style.setForegroundColor (new Color (100, 100, 200));
style.setFont (new Font ("serif", Font.PLAIN, 36));
setStyle (style);
anchor_ = new GSegment();
addSegment (anchor_);
GText text = new GText ("Towers of Hanoi", GPosition.SOUTHEAST);
anchor_.setText (text);
}
public void draw()
{
anchor_.setGeometry (20, 20);
}
}
/**
* Graphics representation of a peg.
*/
class Peg extends GObject
{
private double x_;
private GSegment peg_;
private double[] xy_;
public Peg (double x)
{
x_ = x;
GStyle style = new GStyle();
style.setBackgroundColor (new Color (100, 100, 100));
setStyle (style);
peg_ = new GSegment();
addSegment (peg_);
xy_ = new double[] {x_ - 0.05, 0.0,
x_ - 0.05, nDiscs_ + 2,
x_ + 0.05, nDiscs_ + 2,
x_ + 0.05, 0.0,
x_ - 0.05, 0.0};
}
public double getX()
{
return x_;
}
public void draw()
{
peg_.setGeometryXy (xy_);
}
}
/**
* Graphics representation of a disc.
*/
class Disc extends GObject
{
private double size_;
private GSegment disc_;
private double x_, y_;
public Disc (double size)
{
size_ = size;
GStyle style = new GStyle();
style.setForegroundColor (new Color (255, 0, 0));
style.setBackgroundColor (new Color (255, 150, 150));
setStyle (style);
disc_ = new GSegment();
addSegment (disc_);
}
public void setPosition (double x, double y)
{
x_ = x;
y_ = y;
}
public double getY()
{
return y_;
}
public void draw()
{
double[] xy = new double[] {x_ - size_ / 2.0, y_,
x_ - size_ / 2.0, y_ + 1.0,
x_ + size_ / 2.0, y_ + 1.0,
x_ + size_ / 2.0, y_,
x_ - size_ / 2.0, y_};
disc_.setGeometryXy (xy);
}
}
/**
* Class for solving the "Towers of Hanoi" puzzle.
*/
class TowersOfHanoi
{
public void solve()
{
solve (nDiscs_, 0, 2, 1);
}
private void solve (int nDiscs, int source, int destination, int auxiliary)
{
if (nDiscs == 1)
discMoved (source, destination);
else if (nDiscs > 1) {
solve (nDiscs - 1, source, auxiliary, destination);
discMoved (source, destination);
solve (nDiscs - 1, auxiliary, destination, source);
}
}
}
public static void main (String[] args)
{
int nDiscs = 8;
Demo14 demo = new Demo14 (nDiscs);
}
}
help me please
|
|
|
|
|