| How to make Netbeans use fixed imports? |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- source compilation problem.when I try to compile a file called check.java which uses file.jar like this
c:\javac -classpath .;file.jar check.java
on PC using MS Windows XP it gives me the following crap:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D32797D
Function=ZIP_Open+0x369
Library=h:\jdk\jre\bin\zip.dll
Current Java thread:
at java.util.zip.ZipFile.getNextEntry(Native Method)
at java.util.zip.ZipFile.access$400(ZipFile.java:26)
at java.util.zip.ZipFile$2.nextElement(ZipFile.java:301)
at com.sun.tools.javac.v8.code.ClassReader.openArchive(ClassReader.java:
972)
at com.sun.tools.javac.v8.code.ClassReader.list(ClassReader.java:1199)
at com.sun.tools.javac.v8.code.ClassReader.listAll(ClassReader.java:1320
)
at com.sun.tools.javac.v8.code.ClassReader.fillIn(ClassReader.java:1340)
at com.sun.tools.javac.v8.code.ClassReader.complete(ClassReader.java:104
9)
at com.sun.tools.javac.v8.code.Symbol.complete(Symbol.java:332)
at com.sun.tools.javac.v8.comp.Enter.visitTopLevel(Enter.java:467)
at com.sun.tools.javac.v8.tree.Tree$TopLevel.accept(Tree.java:390)
at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:442)
at com.sun.tools.javac.v8.comp.Enter.classEnter(Enter.java:456)
at com.sun.tools.javac.v8.comp.Enter.complete(Enter.java:588)
at com.sun.tools.javac.v8.comp.Enter.main(Enter.java:574)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:334)
at com.sun.tools.javac.v8.Main.compile(Main.java:520)
at com.sun.tools.javac.Main.compile(Main.java:36)
at com.sun.tools.javac.Main.main(Main.java:27)
Dynamic libraries:
0x00400000 - 0x00407000 h:\jdk\bin\javac.exe
0x77F50000 - 0x77FF6000 C:\WINDOWS\System32\ntdll.dll
0x77E60000 - 0x77F45000 C:\WINDOWS\system32\kernel32.dll
0x77DD0000 - 0x77E5B000 C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x7806F000 C:\WINDOWS\system32\RPCRT4.dll
0x77C10000 - 0x77C63000 C:\WINDOWS\system32\MSVCRT.dll
0x6D330000 - 0x6D45A000 h:\jdk\jre\bin\client\jvm.dll
0x77D40000 - 0x77DC6000 C:\WINDOWS\system32\USER32.dll
0x77C70000 - 0x77CAE000 C:\WINDOWS\system32\GDI32.dll
0x76B40000 - 0x76B6C000 C:\WINDOWS\System32\WINMM.dll
0x629C0000 - 0x629C8000 C:\WINDOWS\System32\LPK.DLL
0x72FA0000 - 0x72FFA000 C:\WINDOWS\System32\USP10.dll
0x5CD70000 - 0x5CD77000 C:\WINDOWS\System32\serwvdrv.dll
0x5B0A0000 - 0x5B0A7000 C:\WINDOWS\System32\umdmxfrm.dll
0x6D1D0000 - 0x6D1D7000 h:\jdk\jre\bin\hpi.dll
0x6D300000 - 0x6D30D000 h:\jdk\jre\bin\verify.dll
0x6D210000 - 0x6D229000 h:\jdk\jre\bin\java.dll
0x6D320000 - 0x6D32D000 h:\jdk\jre\bin\zip.dll
0x76C90000 - 0x76CB2000 C:\WINDOWS\system32\imagehlp.dll
0x6D510000 - 0x6D58C000 C:\WINDOWS\system32\DBGHELP.dll
0x77C00000 - 0x77C07000 C:\WINDOWS\system32\VERSION.dll
0x76BF0000 - 0x76BFB000 C:\WINDOWS\System32\PSAPI.DLL
Local Time = Tue Aug 03 02:35:56 2004
Elapsed Time = 2
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode)
#
# An error report file has been saved as hs_err_pid2592.log.
# Please refer to the file for further information.
#
what should I do to compile this code.
- 1
- Authentication in different tiersHi
How can I access authentication information in different tiers of a
project? We are working on a multi tier J2EE project, and we want to
authenticate user (we are not sure whether using JAAS or not). Is
there any simple way to have access to authentication information in
all tiers including Service Facade, Business Doman, and Data Access
tiers?
If it was just a web tier we could save authentication information in
user session, but it is not good to couple business tier, data access
tier and ... to web specification (including HttpSession).
A solution is passing authentication object using method parameters
but it is not a very good, solution, and all the inter-tier method
calls should contain authentication information.
Note: we are working on a multi-tier and potentialy distributed
project, so I think attaching authentication info to Thread is not a
good solution.
Amir Pashazadeh
- 1
- Problems with Java Server Faces in JRun4 (and Tomcat)Hi!
I have downloaded Java Server Faces (jsf-1_0.zip) to have a look at
them. First I tried to install them in my JRun4 server, which supports
J2EE 1.3. When starting the server after that I get the following
Exception (and I can't run the JSF application):
"04/23 18:26:57 error Could not pre-load servlet: JSPServlet
[2]jrun.jsp.compiler.JRunTagLibraryInfo$InvalidTLDElementException:
The tag function on line 14 is not a valid TLD element
at
jrun.jsp.compiler.JRunTagLibraryInfo$TLDParser.startElement(JRunTagLibraryInfo.java:627)
at
jrunx.util.SAXReflectionHandler.startElement(SAXReflectionHandler.java:24)
at
org.xml.sax.helpers.XMLReaderAdapter.startElement(XMLReaderAdapter.java:333)"
Then I tried to install them in the Tomcat 4.0.6 server embedded in
Netbeans 3.5.1. I guess it also follows the J2EE 1.3 specification but
without the EJB:s. There when i start the server I get the message:
"Apache Tomcat/4.0.6
PARSE error at line 6 column 19
org.xml.sax.SAXParseException: Element type 'taglib' must be
declared."
I can however run the faces application in Tomcat. The only problem is
when I run the 'jsf-components' demonstration and try to 'view jsp' or
'view source' with ShowSource.jsp. Then I get a compile-error:
"org.apache.jasper.JasperException: This absolute uri
(http://java.sun.com/jstl/core) cannot be resolved in either web.xml
or the jar files deployed with this application"
I've also tried with java.sun.com/jsp/jstl/core, which it says in the
JSTL-documentation, but the same result. It seems that the
JSTL-taglibraries referenced are not found or the server doesn't
support external URI:s. I saw in the documentation that JSF is tested
with J2SE 1.3.1_04 and later (I have 1.4.2_01), but does it need J2EE
1.4 as well? I don't have J2EE 1.4 yet, so must I download another
server as well?
/Erik D
- 4
- CLOB.createTemporary throws ClassCastException...I am also having the same problem. Does anyone have a solution? I read
that the workaround is to somehow extract the underlying connection to
give to the createTemporary method. Problem is I'm not sure how to do
that!
bartleby <email***@***.com> wrote in message news:<email***@***.com>...
> I got the same probleme, have you fond out how to solve the problem ?
- 5
- Non-text based source code. I don't have much to add above what's said at the blog entry, so I'll
just link to it:
http://www.realityinteractive.com/rgrzywinski/archives/cat_ideas.html
It's not a particularly novel idea (Roedy has mentioned it often in this
newsgroup, for example; calls it "SCID" I believe), but it's interesting
because (assuming those screenshots weren't doctored), it looks like we'll
be seeing IDEs with practical support for non-text based source code in the
near future (on the order of single-digit years?)
- Oliver
- 5
- Clipped image when g.drawImage(img, -3, -4, this)Hello,
I've created a class (full source code at the bottom)
which extends java.awt.Component and is supposed to
represent a playing card. If the card is being dragged,
I'd like to draw a shadow underneath it. And the card
itself should be drawn a little bit displaced - to make
the impression that it has been lifted:
public void paint(Graphics g) {
if (this == dragged) {
g.drawImage(shadow, 0, 0, this);
g.drawImage(cardImg, -3, -4, this);
} else {
g.drawImage(cardImg, 0, 0, this);
}
}
My problem is however that the cardImg is being
clipped. Does anybody please have an idea how
to workaround this?
Thank you
Alex
PS: Here is the full source code:
// $Id: Card.java,v 1.2 2007/07/18 10:10:33 afarber Exp $
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
class Card extends Component implements MouseListener,
MouseMotionListener
{
public static final int WIDTH = 70;
public static final int HEIGHT = 100;
public static final int SPADE = 0;
public static final int CLUB = 1;
public static final int DIAMOND = 2;
public static final int HEART = 3;
public static final int NOTRUMP = 4;
private static Card dragged;
private static Image[][] faces;
private static Image back;
private static Image shadow;
public byte rank, suit;
public boolean opened;
public int whose;
public Card(int rank, int suit) {
setSize(WIDTH, HEIGHT);
addMouseListener(this);
addMouseMotionListener(this);
this.rank = (byte) rank;
this.suit = (byte) suit;
}
public Card(char ch) {
setSize(WIDTH, HEIGHT);
addMouseListener(this);
addMouseMotionListener(this);
rank = (byte) (ch >> 8);
suit = (byte) ch;
}
public boolean equals(Card card) {
return (rank == card.rank && suit == card.suit);
}
public char toChar() {
return (char) ((rank << 8) | suit);
}
public void paint(Graphics g) {
if (this == dragged) {
g.drawImage(shadow, 0, 0, this);
// XXX the image below is clipped :-(
g.drawImage(opened ? faces[rank][suit] : back,
-3, -4, this);
} else {
g.drawImage(opened ? faces[rank][suit] : back,
0, 0, this);
}
}
public static void prepImages(Image big) {
ImageProducer source = big.getSource();
// create 32 card images
faces = new Image[8][4];
for (int rank = 0; rank < 8; rank++)
for (int suit = SPADE; suit <= HEART; suit++) {
ImageFilter filter =
new CropImageFilter(rank * WIDTH,
suit * HEIGHT, WIDTH, HEIGHT);
ImageProducer producer = new
FilteredImageSource(source, filter);
faces[rank][suit] = Toolkit.getDefaultToolkit()
.createImage(producer);
}
// create the image of a card's back
ImageFilter filter =
new CropImageFilter(560, 0, WIDTH, HEIGHT);
ImageProducer producer =
new FilteredImageSource(source, filter);
back = Toolkit.getDefaultToolkit().createImage(producer);
// use a card shape to create shadow
int[] pixels = new int[WIDTH * HEIGHT];
PixelGrabber grabber = new PixelGrabber(big, 0, 0,
WIDTH, HEIGHT, pixels, 0, WIDTH);
try {
grabber.grabPixels();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
// turn non-transparent pixels to shadow
for (int i = 0; i < pixels.length; i++)
if (0 != (pixels[i] & 0xFF000000))
pixels[i] = 0x60000000;
shadow = Toolkit.getDefaultToolkit().createImage(
new MemoryImageSource(WIDTH, HEIGHT, pixels, 0, WIDTH));
}
public void mouseExited(MouseEvent event) {
System.out.println("mouseExited:" + event);
dragged = null;
getParent().repaint();
}
public void mouseReleased(MouseEvent event) {
System.out.println("mouseReleased" + event);
dragged = null;
getParent().repaint();
}
public void mousePressed(MouseEvent event) {
System.out.println("mousePressed" + event);
dragged = this;
getParent().repaint();
}
public void mouseEntered(MouseEvent event) {
System.out.println("mouseEntered" + event);
}
public void mouseClicked(MouseEvent event) {
System.out.println("mouseClicked" + event);
}
public void mouseMoved(MouseEvent event) {
System.out.println("mouseMoved" + event);
}
public void mouseDragged(MouseEvent event) {
System.out.println("mouseDragged" + event);
}
public static int randomRank() {
return (int) Math.floor(8.0 * Math.random());
}
public static int randomSuit() {
return (int) Math.floor(4.0 * Math.random());
}
public static void main(String args[]) {
Frame frame = new Frame("Card Test");
frame.setForeground(Color.white);
frame.setBackground(Color.gray);
frame.setLayout(null);
final String PATH = "media/cards.gif";
Image big = Toolkit.getDefaultToolkit().getImage(PATH);
MediaTracker tracker = new MediaTracker(frame);
tracker.addImage(big, 0);
try {
tracker.waitForAll();
} catch (Exception ex) {
ex.printStackTrace();
}
if (tracker.isErrorAny()) {
System.err.println("Image " + PATH + " not found");
return;
}
Card.prepImages(big);
Card card = new Card(randomRank(), randomSuit());
card.opened = true;
frame.add(card);
frame.validate();
card.setLocation(200, 100);
frame.setSize(400, 300);
frame.setVisible(true);
}
}
- 8
- Function for removing Accents?On Wed, 17 May 2006 11:52:25 +0200, I waved a wand and this message
magically appeared from Domagoj Klepac:
> Because internationalization was always expensive, and the IT industry
> was based in the Western countries, and it had no incentive to adapt
> to the new, small markets. For example, I would guess that there is no
> Esperanto Windows version. Or Esperanto Office. Not enough people
> would buy it. And if even mighty Microsoft can't afford to do it,
> other software vendors certainly can't.
Microsoft can afford to. They just aren't interested.
--
http://www.munted.org.uk
Take a nap, it saves lives.
- 8
- showdocument() problem (or bug?)I have a trusted applet that is supposed to generate a pdf file and
save it as a temporary file on the local machine, then display it.
Since display of such an animal can only happen with showDocument(URL,
type) I am trying to build the url using :
URL url = new URL("file:" + File.separator + File.separator +
"filename.pdf");
and this does indeed work IFF I run the applet locally. However, if the
bloody thing is running connected to the server, it does not. Then the
only command that works is
URL url = new URL(getCodeBase(), "filename.pdf");
so I had to bytestream the pdf down to server, have it install it in a
file and make the call. A real waste, considering I'm supposed to be
writing non-polluting software. Any ideas as to what's wrong with this?
Thanks.
- 8
- 9
- java.io.Exception: Too many open files on sun OS 5.6I'm operating on sun OS 5.6
I ping a host every 10 seconds to get knowlegde wheather it is running
or not. After about one and a half hour I get this Exception:
java.io.IOException: Too many open files
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:54)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:546)
at java.lang.Runtime.exec(Runtime.java:413)
at java.lang.Runtime.exec(Runtime.java:356)
at java.lang.Runtime.exec(Runtime.java:320)
at de.optimare.VRX8100.MainControl.pingRecorder(MainControl.java:226)
... and so on.
I set rlim_fd_max = 1024 in /etc/system
I tried to set the ulimit -n 1024 in my script
but it had no effect.
Here is my code: The pingRecorder is called every 10 seconds from a
swing.Timer.
runtime is the Runtime.getRuntime().
// used on unix system
private void pingRecorder() {
logDate = new Date();
try {
ping = runtime.exec(pingPath);
ping.waitFor();
exitValue = ping.exitValue();
switch (exitValue) {
case 0:
// stop the ping timer
if (pingTimer != null) {
pingTimer.stop();
}
if (! processIsInitialized) {
System.out.println(logDate.toString() + " Recorder alive. Now
wait " + initialWaitTime/1000 + " seconds to initialize");
//wait for recorder is booting
Thread.sleep(initialWaitTime);
// now init the VRX8100 process!
initProcess();
}
break;
case 1:
System.out.println(logDate.toString() + " Recorder off.
Memory: " + runtime.totalMemory());
break;
default:
System.out.println(logDate.toString() + " Recorder off.
Memory: " + runtime.totalMemory());
break;
}
} catch (IOException io) {
io.printStackTrace();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
I would be very happy if anyone knows about anything due to this
problem.
Is it a specific sun problem? Is it possible to control the number of
open files by Java?
Many thanks for any help
Gert
- 10
- pattern matching help on logical ORI'm using Java 1.4.2_05 and need some help getting a logical OR to work
within my pattern matcher.
I'm trying to get both string A and B to be recognized by one pattern?
String strA = "04/14:03,blahblahblah\u007F";
String strB = "04/14:03,blahblahblah";
So I'm trying to match:
Two numerals followed by slash followed by 2 numerals followed by a
colon followed by 2 numerals followed by a comma followed by anything
followed by a one or 0 delete character OR the end of the line/string.
Here is the regex:
Pattern.compile("[0-9]{2}[\u002F][0-9]{2}[\u003A][0-9]{2}[\u002C].+[\u007F?]|[$]",
Pattern.DOTALL);
The logical OR doesn't work though. And I've tried the OR a few other
ways as well.
... [\u007F|$]
... [\u007F?|$]
... [\u007f]?|[$]
These don't work either.
I'd appreciate any suggestions.
Thanks,
Shawna
- 10
- xmlencoder/decoder persistence delegateHi,
I am using the xmlencoder/decoder classes to save objects, some of
which do not have no-argument constructors. I understand that one could
use something like:
String[] prop = {"param1", "param2"};
MyEncoder.setPersistenceDelegate(MyClass.class
new DefaultPersistenceDelegate(prop);
My question is, what if one has a class like:
class A{
-----
B objB = new B(C c, D d);
-----
}
class B{
-----
E objE = new E(F f, G g);
-----
}
I need to save an object of A that contains an object of B that does
not have a default constructor and B in turn needs to store an object
of E which again does not have a default constructor. Assuming that all
attributes of all classes that need to be saved do have the required
setter and getter methods, I couldn't find a way to save all those
objects because I can set the persistence delegate for only one class.
Is it possible to save all the objects?
TIA.
--Jo
- 11
- MIDP JVM for Palm and Pocket PCStephan Erlank wrote:
> I've heard of J9 that comes with Visual Age Micro Edition, but I don't have
> time to download 122mb over a 56k dial-up connection.
VAME is discontinued and has been replaced by WebSphere Studio Device
Developer.
http://www-3.ibm.com/software/wireless/wsdd/
But maybe that's what you meant.
--
Josef Garvi
"Reversing desertification through drought tolerant trees"
http://www.eden-foundation.org/
new income - better environment - more food - less poverty
- 12
- decoding utf8I've got a J2ME application that is doing a writeUTF() of a byte array
that I need to decode and store in a flat file (it's a jpeg) from my
perl socket application. I can't seem to find a way to have Perl
decode it into it's byte representation.
As a test I put a byte array of just control-A's on the wire using
writeUTF. The length of the scalar I get in Perl is exactly twice (128)
as I sent (64). I've tried doing: $decoded =
Encode::decode_utf8($netbuf) and it doesn't convert the data at all.
Obviously, I must be missing how Perl handles a scalar that contains
UTF-8 data.
Can someone point me in a direction? Thanks.
- 16
- Socket latenciesHi all,
I am working on a Java project and I am interested in measuring TCP
performance over long delay links. Do you know if there is any way to
simulate delay using Sockets, keeping the TCP protocol behaviour
intact? I wrote a FilterInputStream that waits for some time and then
reads from the stream, but I am afraid it could be not very accurate.
Thank you.
Daniela B
|
| Author |
Message |
Scirious

|
Posted: 2006-6-23 6:07:00 |
Top |
java-programmer, How to make Netbeans use fixed imports?
People, how can I get netbeans to use fixed imports instead of full
qualified name for each variable?
TIA,
Scirious.
|
| |
|
| |
 |
IchBin

|
Posted: 2006-6-23 6:28:00 |
Top |
java-programmer >> How to make Netbeans use fixed imports?
Scirious wrote:
> People, how can I get netbeans to use fixed imports instead of full
> qualified name for each variable?
>
> TIA,
> Scirious.
Select your program into the editor. Select from the Menu: Source \ Fix
imports or ( Alt+shift+F )
This should resolve and add all of the required imports at the top of
you program. I know it worked for Netbeans 5. It seems not to be working
for Netbeans 5.5.
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.awardspace.com
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- calling java from DOTNET 2? how stable or painfull?hi.. (sorry but i posted this in a dotnet newsgroup as well becoue i
don't know which would be better handling this question).
i have a java application server whish uses RMI as a delivery transport
for it's apis (it's gets the command in XML but the underlying protocol
needs to be RMI)..
so i need to write an RMI CLIENT to this thing, and expose it microsoft
land.
at first we thought to have it exposed as web service and consume this
service via dotnet dll. the dll would be given to desktop application
developers which canno parse XML.
then i was told i could expose it as JNI and have the dll access it
directly. then the dll in dot net 2.0 would either be given to desktop
developers or exposed as a web service in biztalk if web services are
needed.
btw can i do all of this with express edition versions?
- 2
- JFrame to FrontHi,
First of all sorry for my german posting before!
Here is my question in english:
By starting my application I construct a JFrame. By clicking onto a
JButton on this JFrame, it construct a NON-MODAL JDialog, which gets as
parentComponent the JFrame.
Now, if I switch between the Frame and the Dialog, they are correctly
activated, but the Frame does never come to foreground, i.e. it is ever
ovelapped by the Dialog.
I tryed with "Frame.setVisible(true)", "Frame.toFront()" and
"Frame.show()", but unfortunately, it does not work.
Is my desired behavior in this case even possible, or is there only the
way of setting the parentComponent of the Dialog to null?
Thanks!
--
Oliver Hirschi
http://www.FamilyHirschi.ch
- 3
- clearing outputHello,
I've looked far and wide for the answer to this question without any
success. Is there a method in Java that clears output to
System.out.println? My goal is to pass output to the line then erase it
so that I don't have repeating lines in my loop. Any help is much
appreciated.
Thanks,
Ben
- 4
- Target Frame?After installing the latest Java version an applet on my homepage doesn't
work as it did before!
Instead of showing a new window in the selected target frame, a new popup
window is openend!
Who can help?
- 5
- eclipse and CDT errorHi,
Somebody got CDT working in eclipse ? What do you have to download ?
I use mingw g++. When I install CDT I get a Java null pointer exception
error
any idea ?
Johan
- 6
- Batch image compression problem. Help!I am using Java to develop a web application that lets user to upload images
to the web server, and the server will automatically resize and compress the
images. It lets users to upload maximum 5 images at one time. The system
works fine. But sometimes a very strange problem occurs. When the users
upload the image, the images are able to be uploaded to the system
successfully, but the system is hanged on the image compression stage. The
system message returns that the uploaded images are under compression, but
never ended, even one hour.
I have checked the system log and find there is nothing mentioned in the log
file. This problem doesn't happen regularly, but it does happen sometimes.
Please kindly advise me what mistake I have made.
Thanks,
Chris
Herebelow is the part of source code:
==============================================================
/**
* create small image.
* @param oldImage,give a image to create small image.
* @param newImage,the image you want to create.
* @param maxWidth,the max width.
* @param maxHeight, the max height.
* @return the image's name.
* @throws java.lang.Exception
*/
public String createThumbnail(String srcImg,String objImg, int
maxWidth,int maxHeight) throws Exception{
try {
EuwLog.EuwPrint("Begin Thumbnail"+objImg);
ImageIcon ii = new ImageIcon(srcImg);
Image i = ii.getImage();
ii = null;
Image temp = null;
BufferedImage bufferedImage=null;
int iWidth = i.getWidth(null);
int iHeight = i.getHeight(null);
double ratio = getRatio(iWidth,iHeight,maxWidth,maxHeight);
iWidth = (int)(ratio*iWidth);
iHeight = (int)(ratio*iHeight);
if (ratio<1.0f){
temp =
i.getScaledInstance(iWidth,iHeight,Image.SCALE_AREA_AVERAGING);
i.flush();
i = null;
temp = new ImageIcon(temp).getImage();
// Create the buffered image.
bufferedImage = new BufferedImage(iWidth, iHeight,
BufferedImage.TYPE_INT_RGB);
// Copy image to buffered image.
Graphics g = bufferedImage.createGraphics();
// Clear background and paint the image.
g.setColor(Color.white);
g.fillRect(0, 0, iWidth,iHeight);
g.drawImage(temp, 0, 0, null);
g.dispose();
g = null;
// sharpen
float[] sharpenArray = { -0.125f, -0.125f, -0.125f, -0.125f,2,
-0.125f, -0.125f, -0.125f, -0.125f };
Kernel kernel = new Kernel(3, 3, sharpenArray);
ConvolveOp cOp = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP,
null);
bufferedImage = cOp.filter(bufferedImage, null);
cOp = null;
kernel = null;
/* write the jpeg to a file */
//File file = new File(objImg);
FileOutputStream out = new FileOutputStream(objImg);
/* encodes image as a JPEG data stream */
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
JPEGEncodeParam param =
encoder.getDefaultJPEGEncodeParam(bufferedImage);
// writeParam = new JPEGImageWriteParam(null);
//
writeParam.setCompressionMode(JPEGImageWriteParam.MODE_EXPLICIT);
//writeParam.setProgressiveMode(JPEGImageWriteParam.MODE_DEFAULT);
param.setQuality(0.9f, true);
encoder.setJPEGEncodeParam(param);
encoder.encode(bufferedImage);
param = null;
encoder = null;
temp.flush();
temp = null;
bufferedImage.flush();
bufferedImage = null;
out.close();
out = null;
EuwLog.EuwPrint("End Thumbnail"+objImg);
- 7
- Why does we need Inner Class?Hello:
Am I correct? And everyone's words is welcome. Thanks.
class A {
int i;
int geti() {
return i;
}
}
class B {
int j;
int getj() {
return j;
}
}
/* It's wrong to write as follows: */
/*
public class C extends A,B {
}
*/
/* But it's right as follow: */
public class C extends A{
class D extends B {
}
}
- 8
- Design question about data conversion class.I'm looking for a name for my class that reflects what it does. Its a
class with functions that converts data.
For example, my current class is called ArticleValueObjectCreator. It
has a method that converts resultsets to an article value object bean.
I now need to create a method which converts an article related
resultset to xml. In the future I may need one that converts a value
object "bean" to xml.
I'm thinking of refactoring the class now that I need to grow it.
What is the best way of acomplishing good design here?
Would renaming the class to something like ArticleDataCovertor, or
ArticleAdaptor tie in with good programming practice, or would it be
better to split these methods up into different classes ( thus making
each class dependent on a fine range particular technologies ) eg, one
which is xml and jdbc only, another that is xml only.
Are there any design patterns like this that emphasise clean
seperation between technologies. Or am I over-engineering?
Thanks
Ben
- 9
- How do you like Richfaces?How do you like Richfaces?
http://labs.jboss.com/jbossrichfaces/
Do you think it is the best way to integrate AJAX capabilities into
JSF?
- 10
- Alioth CVS Read-Only (was: Re: svn repository)-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Maybe we should ask to lock the Alioth's CVS repository of pkg-java
project, so we'll be sure everybody use the svn!
I Cc'd debian-admin but I'm not sure this is the right place. I already
send a mail about the wiki there but never got a response. And I'm not
sure they manage Alioth... If someone can Cc to a better location...
Thanks
Charles Fry wrote:
>>+1, keep only the RELEASE_<VERSION> tags.
>>
>>The directory layout seems ok to me. If there is a problem, we can svn mv.
>>
>>Many thanks for your work Charles,
>
> In that case I'll plan to make the migration on Monday. I'lll send out
> email 15 minutes prior to starting the move, then upon starting and
> finally upon completing the migration.
>
> cheers,
> Charles
- --
.''`.
: :' :rnaud
`. `'
`-
Java Trap: http://www.gnu.org/philosophy/java-trap.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDwlOu4vzFZu62tMIRAtS0AJ9R973xSgRKSS0ZCv6CgCvaTv0MuwCdG29Z
jK7dIKhblWvu5zX3QrgQ7ZE=
=wRbl
-----END PGP SIGNATURE-----
--
To UNSUBSCRIBE, email to email***@***.com
with a subject of "unsubscribe". Trouble? Contact email***@***.com
- 11
- gray boxes instead of the appletHi all,
I'm a newbie, so if I should be posting this to a different group, please
(gently) tell me which one.
I have copied a very small Java applet source off the web and successfully
compiled it. I have taken the resulting Java classes and put them on my
website, using the <applet> html tag. The applet works great for me.
However, most of the people I work with just get a gray box where the applet
should be. (Others can see and use the applet just fine.) The gray box
*does not* have a red X in it. I can detect no pattern whatsoever in the
clients for whom the applet does/doesn't work.
The most mysterious part to me is that even people who do not see the applet
correctly on my website seem to be able to see and use the same applet just
fine on the site I acquired it from. As far as I know, it's identically the
same applet. (I just stole the source and compiled it.) This would tend to
rule out a problem on the client side, but I can't be sure.
I think I've been able to deduce that the problem is not with the location
of the Java classes on my web page; otherwise, there would be a red X in the
upper-left corner of the gray box, right? (And in that case it probably
wouldn't work for anyone, including me.)
Anyone have a clue what's going on? What other information can I provide?
TIA,
Gnome
- 12
- URL Class Loader & file deletionHello,
The following code always displays "File cannot be deleted".
Any idea on the way to allow a file to be deleted when it has been used
by a URL class loader to load code ?
public class ClassLoaderTester {
public static void main( String[] args ) {
try {
String s = "c:\\zob.jar";
URLClassLoader oCL = new URLClassLoader(
new URL[] {
new File(s).toURL()
} );
Class c = oCL.loadClass("com.mysql.jdbc.Driver");
Object o = c.newInstance();
o = null;
c = null;
oCL = null;
System.gc();
System.runFinalization();
File oFile = new File(s);
if ( !oFile.delete() ) {
System.err.println("File cannot be deleted");
}
}
catch ( Exception e ) {
e.printStackTrace();
}
}
}
Thank's in advance.
- 13
- Trouble with reading and appending to lines in a file...Hi there,
Please bare with me on this, I'm a newbie :o). Ok, I'm trying to read a
file (a bunch of 1 word lines), find the last line with the word "SKIP" at
the end, and get the next line. After getting the desired line, I want to
append the word "SKIP" to that line as well and save and close the file.
I also want the class to have an input parameter (integer), which will be
the same name of the file (example: input = 1234 --> filname = 1234.txt).
Here is what I've got so far:
import java.io.*;
public class GetLine {
int number; //let's say the lines in the file are all 5 digit
numbers, with no spaces
public boolean evaluate(String str) {
//
//I'm not sure how to evaluate if the end of the line
has the word SKIP and the following doesn't work????
//
if ( StringBuffer.indexOf("SKIP\n") )
return true;
}
public void get(int c) throws IOException, FileNotFoundException {
String line;
boolean b;
FileReader fr=new FileReader(number + ".txt");
BufferedReader br=new BufferedReader(fr);
while((line=br.readLine())!=null )
{
b = evaluate(line);
if (b==false)
{
//
//not sure if I can just do a "return
line" to get the first line found without SKIP???
return line;
//
//not sure if I can do the following
either???
//
line = line + "SKIP";
}
}
}
}
Please, any suggestions are apprciated. Thanks for your help.
scopp
- 14
- how to combine paintComponent with add(component)?I have a Java application with several classes that extend JPanels and
that, till now, didn't have any internal Swing components. They did
display text that was antialiased and sometimes animated by overriding
paintComponent in each of these custom classes. And this worked fine.
But now on one of the panels I want to add in the northeast corner
another customized JPanel extending object. When I just call
basePanel.add(newPan) the newPan would show up when first displayed
but then dissapear the next time repaint() is called on the basePanel.
I imagine I have to do something in the basePanel's paintComponent
method to make sure the new panel is repainted every time. But I'm not
sure how that is handled. Anyone have some advice? Maybe a quick
example?
- 15
- Wholesale all laptops,Apple Ipods Nano, Xbox 360, Sony PS3, Sony PSP.wii ,SONY SD.SONY USB.GPS http://www.new-nikeshoes.cnhi
We are the biggest wholesale suppliers..........We have a lot of very
nice quality merchandises with the very special price
Our main markets are the USA, the UK, Germany, France, Italy, Greece,
Jordan, Australia, Canada,Sweden, and many other countries in Europe
and the Middle East regions.
Ipod nano 1G 45$ ,2G 55$, 4G 65$,8G 70$, 30G 100$ ,60G 120$
ps3 60GB 400$ 40GB 350$ 80GB 450$
psp 150$
wii 220$
X360 300$
SONY Scandisk or Kingston MicroSD
16GB 50$ 8GB 30$ 4GB 18$ 2GB 13$ 1GB 10$
SONY Kingston USB & Flash
16GB 50$ 8GB 30$ 4GB 18$ 2GB 13$ 1GB 10$
We wholesale all laptops
Sony VGN-CR13/B 380$
Sony VGN-CR13/L 350$
Sony VGN-CR15/B 320$
Sony VGN-CR13/P 480$
Sony VGN-C21CH 450$
Sony VGN-SZ44CN 580$
Sony VGN-C22CH/W 620$
Sony VGN-N17C 480$
Sony VGN-CR13/W 580$
Sony VGN-FZ15 560$
Apple MacBook 580$
Apple MacBook Pro(MA896CH/A)680$
Apple MacBook Pro(MA896CH/A) 630$
Apple MacBook (MB063CH/A) 580$
Apple MacBook Pro(MA895CH/A) 580$
Apple MacBook(MB062CH/A) 590$
Apple MacBook(MA700CH/A) 580$
Apple MacBook(MA701CH/A) 550$
Apple MacBook Pro (MA610CH/A) 650$
Apple MacBook Pro (MA611CH/A) 680$
Apple MacBook (MA699CH/A) 580$
(1).all products are all original and new
(2).they have 1year international warranty.
(3).free shipping include ems, tnt, dhl, ups. you may choose one kind
(4).deliver time is in 5 days to get your door
We insist the principia: Prestige first,high-quality,competitive
price,
best services,and timely delivery.
Website: http://www.new-nikeshoes.cn
msn: email***@***.com
Hong-da Co., Ltd.
|
|
|