|
Because it is overriding a method in a base class.
See AbstractList.removeRange.
The javadocs for that method provides the implicit reason for the method. It is intended as a performance assist to children only. It is not intended for public usage.
|
|
|
|
|
I want to create a Netbeans desktop application and use Hibernate to communicate with the database. I wish to use Eclipse to configure the communication with the DB since Hibernate Tools in Eclipse allows you to automatically create the Dao objects (very useful since they receive and return objects i.e Employees object), along with mapping files and Java classes.
How can I make this configuration in Eclipse and then move it to my Netbeans desktop application? Will there be any issues if I do this? I have around 1 year experience using Java and use Hibernate daily, but have never configured Hibernate from scratch or created a Java desktop application from scratch.
|
|
|
|
|
I guess you could copy the config?
Eclipse & Netbeans are just IDE's. The functionality you are after must have some config/code behind being generated that you can use. That said, if you feel the need to use one or other then I would recommend you stick to the one.
As a n aside, at work we have some people who use Eclipse and others use Netbeans, it does not actually make a lot of difference. If i just want to do something quick, I prefer to use notepad++ for editing and the command prompt for builds. But then I am old.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
The problem is that Netbeans provides better tools for creating a desktop application, while the Hibernate Tools of Eclipse to generate my dao files.
|
|
|
|
|
Hi,
I want to draw multiple circle in java applet. actually every single mouse click will draw a circle centered at the mouse pointer with a radius of 15.Below is my program-
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class window extends Applet
{
int mouseX=50, mouseY=50;
public window()
{
addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent me)
{
int x = me.getX();
int y = me.getY();
mouseX = x;
mouseY = y;
repaint();
}
});
}
public void paint(Graphics g)
{
g.setColor(Color.blue);
int circCntrX=mouseX-15,circCntrY=mouseY-15;
g.drawOval(circCntrX,circCntrY,30,30);//draw a circle
}
}
The problem is the every time the screen get refreshed due to multiple calling of repaint() method and i got only the new circle not all the older circle. I want that i can see all the circles. What should i do?
|
|
|
|
|
This is a classic issue in UI programs where the window will get repainted at regular or random intervals. Your code takes the current values of the mouse point and draws a single circle at that point, so every repaint will draw only one circle. You need to create some sort of list of saved mouse points and then in your paint function you should repaint each circle.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
|
Clever, linking back to the same question from someone else.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
heloo...
how to read all pixel of a color image
|
|
|
|
|
A good start would be something like this[^].
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi all,
I'd like to use Java to interact with MS Outlook Exchange to share my calendar (events) with my friends.
Please tell me how I can do that?
Thanks in advance
|
|
|
|
|
Take a look here[^] for some possible solutions.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi Richard MacCutchan,
Before I posted my question here, I had googled for this subject but I did not find what I need so I hope to receive sharing of experiences from you about this.
|
|
|
|
|
Did you look at the link that I posted? There are lots of hits from my Google search, I don't know what keywords you used.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Yes, of course.
I want to use an open source (free) for my app and I don't know what is suitable with my need.
|
|
|
|
|
pcphuc wrote: I want to use an open source (free) for my app and I don't know what is suitable with my need.
You need to research the products that are available and select the one that you think fulfils your need.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Thanks for your help.
I think I'll try JACOB/J-XChange.
Have a nice day
|
|
|
|
|
hi friends...
i was trying to do a sample program got from java tutorials ,where i encountered some errors with the use of assert keyword....can anyone help me to solve the problem..i am doing the program in eclipse...
Below given is my code...
public class Card {
private final int rank;
private final int suit;
public final static int DIAMONDS = 1;
public final static int CLUBS = 2;
public final static int ACE = 1;
public final static int DEUCE = 2;
public Card(int rank, int suit) {
assert isValidRank(rank);
assert isValidSuit(suit);
this.rank = rank;
this.suit = suit;
}
public int getSuit() {
return suit;
}
public int getRank() {
return rank;
}
public static boolean isValidRank(int rank) {
return ACE <= rank && rank <= KING;
}
public static boolean isValidSuit(int suit) {
return DIAMONDS <= suit && suit <= SPADES;
}
public static String rankToString(int rank) {
switch (rank) {
case ACE:
return "Ace";
case DEUCE:
return "Deuce";
default:
return null;
}
}
public static String suitToString(int suit) {
switch (suit) {
case DIAMONDS:
return "Diamonds";
case CLUBS:
return "Clubs";
default:
return null;
}
}
public static void main(String[] args) {
assert rankToString(ACE) == "Ace";
assert rankToString(DEUCE) == "Deuce";
}
}
|
|
|
|
|
When you are comparing strings in java, always use the equals(object) methid:
assert rankToString(ACE).equals("Ace");
assert rankToString(DEUCE).equals("Deuce");
As an aside, when there are a finite set of values - as in card ranks and suits - use an enum and all this checking for valid values goes away.
Panic, Chaos, Destruction.
My work here is done.
or "Drink. Get drunk. Fall over." - P O'H
|
|
|
|
|
Thanks Vilmos ...for your suggestion...
But that didn't work..
i shall give you the error that i am getting:
"assert should not be used as an identifier since it is reserved keyword from source level 1.4"
For the following lines in my code ,
assert isValidRank(rank);
assert isValidSuit(suit);
i am getting the error: "Syntax error on token "assert",assert excepted"
Actually now iam very much confused as of how to use the assert properly....please help me friends..
|
|
|
|
|
I got the exact same error as you did, but only when I compiled the code with version 1.3 of Java. Are you sure that your compiler is set to Java version 1.4 or higher?
|
|
|
|
|
If you use Java 1.4, you need the compiler option "-source 1.4". assert became a keyword in Java 1.4. Prior to that, assert could be legally used as an identifier. In Java 5 and later, you don't need anything special.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
try this
boolean rankToString(ACE) == "Ace";
boolean rankToString(DEUCE) == "Deuce";
assert rankToString(ACE) == "Ace";
assert rankToString(DEUCE) == "Deuce";
for more information read this page
exactly this paragraph
"Do not use assertions to do any work that your application requires for correct operation.
Because assertions may be disabled, programs must not assume that the boolean expression contained in an assertion will be evaluated. Violating this rule has dire consequences. For example, suppose you wanted to remove all of the null elements from a list names, and knew that the list contained one or more nulls. It would be wrong to do this:
assert names.remove(null);
The program would work fine when asserts were enabled, but would fail when they were disabled, as it would no longer remove the null elements from the list. The correct idiom is to perform the action before the assertion and then assert that the action succeeded:
boolean nullsRemoved = names.remove(null);
assert nullsRemoved;
As a rule, the expressions contained in assertions should be free of side effects: evaluating the expression should not affect any state that is visible after the evaluation is complete. One exception to this rule is that assertions can modify state that is used only from within other assertions. An idiom that makes use of this exception is presented later in this document. "
|
|
|
|
|
I would like to write in java (or other language ) application
which will be count area of a suare, rectangle, circle et cetera.
Dimensions are variable.
http://wgrajfoto.pl/pokaz/img1010/symbolcfc1.jpg
How to create that mathematical symbol ? I would also like to create
; integral , derivative and other mathematical symbol.
The result I am going to save to pdf using Itext.
|
|
|
|
|
Your question is not very clear. Do you want to draw the shapes based on dimensions passed by the user, or just print some formula to the screen?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|