 |
 |
Index ‹ java-programmer
|
- Previous
- 2
- 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
- 2
- 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
- 3
- 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
- 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);
}
}
- 7
- 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.
- 8
- 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?
- 9
- 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
- 12
- 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
- 13
- 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?
- 13
- 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?
- 13
- 13
- 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.
- 14
- 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.
- 16
- 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);
- 16
- 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.
|
| Author |
Message |
Oliver Hirschi

|
Posted: 2005-8-16 17:33:00 |
Top |
java-programmer, JFrame to Front
Hi,
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
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Java code obfuscationHey all,
I'm looking at using a tool to obfuscate some java code and have a 3
part question:
1. If price were not a factor, what obfuscator would you use?
2. If price were a factor and you wanted a midrange cost product (say
under $500) what obfuscator would you use?
3. If you wanted a free obfuscator which one would you use?
Something of note about my product is that there is a fair amount of
reflection going on as I do a lot of dynamic class loading. I've played
around with RetroGuard, and while it's nice, the script creation looks
like it will be quite painful with the amount of reflection I'm going to
have to work with. Anyway, I'd appreciate any thoughts you might have.
Thanks.
Matthew Zimmer
- 2
- Lists: XQuery engines, JDBC and ODBC drivers, OLE DB and .NET providers, DB2 extendersUpdated driver, provider and extender lists are now available at SQLSummit.com.
The newest list is XQuery processors.
JDBC drivers (112)
www.SQLSummit.com/jdbcvend.htm
XQuery engines (29)
www.SQLSummit.com/XQueryProc.htm
ODBC drivers (212)
www.SQLSummit.com/odbcvend.htm
.NET providers (20)
www.SQLSummit.com/dataprov.htm
OLE DB providers (53)
www.SQLSummit.com/oledbven.htm
DB2 Extenders (18)
www.SQLSummit.com/extendven.htm
-----------------------------------
Ken North
www.WebServicesSummit.com
www.SQLSummit.com
www.GridSummit.com (coming soon)
- 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
- ligatures in Java 2DI've been trying to work out how to get Java to handle ligatures such
as "fi" correctly, but without much success. Various online documents
have suggested that I need to be intervening in the rendering process
and laying out my own GlyphVectors based on information associated
with Fonts, but I can't find out the details I need to actually do
that systematically.
I have discovered (<http://mindprod.com/jgloss/ligature.html>) that
'fi' has its own code point (\ufb01) in Unicode - should I be manually
checking whether my Font has specific glyphs for such ligatured
characters and manually substituting them into my char[] to feed to
layoutGlyphVector? Do Fonts come with lists of ligatures they
support, and if so how do I get at them?
And most of all, what is TFM that I am currently foolishly neglecting
to R?
Des
- 5
- How to release a free source code?Hi All,
I want to release some free source code, but not all code is done by
me. (ex: I use some code from others into my project... )
I think it is too complicate to check every function/routine belongs to
whom, what should I do to avoid the copyright problem?
Thank you very much.
Best regards,
Boki.
- 6
- [UPD] SQLeonardo MMV.III released[http://querybuilder.sourceforge.net]
SQLeonardo is a database query tool written in Java, distributed under
the GNU GENERAL PUBLIC LICENSE.
Include FreeQueryBuilder to create SQL queries without directly writing
SQL. All queries can be saved in a workspace for later use. Works
with any JDBC compliant database(ORACLE,MySQL,HSQLDB,Firebird,DB2)
*** NEW ***
Edit tables directly via the data grid
Regards Nickyb
- 7
- [SWT] How to enable and disable windows correctly, if using dialogs?Hi,
I am programming a configuration gui for a hardware simulator. There I
wrote some gui elements, which enable the user to set up some
parameters used by the simulator.
For example it is possible to enter values in textfields. I do a check,
if the entered value even is an int, and if not, I create a short error
message. For example like this:
textwidth.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
try {
width = Integer.parseInt(textwidth.getText());
} catch (NumberFormatException nfe){
if (!textwidth.getText().equals("")) {
width = 0;
ErrorHandling error = new ErrorHandling(
"Please enter numbers only!\r\nWidth is
reset to 0.",
selscomposite.getShell());
textwidth.setText("0");
}
}
//modify the scale so it represents the entered value
scalewidth.setSelection(scalewidth.getMaximum() - width
+ scalewidth.getMinimum());
}
});
textwidth is the textfield, representing the value chosen through a
scale and enabling the user to enter a value manually, and the
scale-representation is updated if done so.
ErrorHandling is the class I use throughout the project to display
small error messages. It looks like this:
public class ErrorHandling {
Shell error;
Shell parentshell;
public ErrorHandling(String errormessage, Shell shell) {
//shell displaying the errormessage
error = new Shell(SWT.TITLE | SWT.BORDER);
error.setText("User input error");
//the layout for the error shell
FillLayout filllayout = new FillLayout(SWT.VERTICAL);
filllayout.marginHeight = 5;
filllayout.marginWidth = 5;
filllayout.spacing = 3;
error.setLayout(filllayout);
//disable the parent shell
parentshell = shell;
parentshell.setEnabled(false);
//set the errormessage
CLabel errorlabelmessage = new CLabel(error, SWT.CENTER |
SWT.SHADOW_IN);
errorlabelmessage.setText(errormessage);
//a button to close the errormessage
Button errorreceived = new Button(error, SWT.PUSH |
SWT.CENTER);
errorreceived.setText("Ok, i got it!");
errorreceived.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
parentshell.setEnabled(true);
error.close();
}
});
//create the errorshell
error.setActive();
error.pack();
error.open();
}
}
parentshell is needed, so I can disable the shell, in which the error
occured until the user hast closed the errormessage by using the "Ok, I
got it!"-button. I don't even know if this is good style, but it's all
I know to do so far. I need to have a new shell-variable (e.g.
parentshell), because otherwise I could not use it in the inner class
within the listener-context. This leads to the first question: Is there
no better way to handle this, but the new Object "parentshell"?
The second problem with this implementation is, that if I do not use
the SWT.BORDER and SWT.TITLE constants within the initialization of the
error-Shell-object, the small window displaying the error message looks
real crappy. The title and a window border is needed, but if I have
those, I also have a close-button on the upper right of the window.
Because a disabled the parent shell:
parentshell = shell;
parentshell.setEnabled(false);
I have to enable it, if the error message is closed. I am able to
enable it, if the user choses the button, but if the user closes the
window by the close-button of the window-manager, the parent-shell
never ever gets accessible, because there never came a command to
enable it again.
A last few words: I tried several constants in the creation of the
error-Shell-object, but most of them (like ON_TOP, or several modal
state specifiers) only have the effect, that the error-message has no
border and no title any more. I am using Linux and the X-Server, so I
don't know what the behaviour of these constants would be on other
window-architectures.
Now this was a whole lot of information, but ask me, if you want to
know something more specific. Any comments are welcome, even those,
telling me what I have done is totally crap and I should do it like
this or that.
Thank you in advance!
PS: Sorry for any errors and the bad english.
- 8
- 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?
- 9
- 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 {
}
}
- 10
- 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
- 11
- Shame onJeff Relf wrote:
> Hello John Bailo , You wrote ,
> " You bankrrupted your life with unrecoverable debt ,
> and now you come here to blame others
> for your foolish behavior "
>
> My " Foolish behavior " was when I ejaculated in 1982 ,
> after being tricked by a woman . That's hardly a crime .
Fooled me once, shame on you.
Fooled me twice, shame on me.
>
> It's not like your fantasies of time travel
> could rectify that .
- 12
- strings in javaAs a response to a request to "make a complete and concise statement" and
"to provide some context", I reply here to my own post.
"Boudewijn Dijkstra" <email***@***.com> schreef in bericht
news:40b5afde$0$41748$email***@***.com...
> "Tony Morris" <email***@***.com> schreef in bericht
> news:c91dr1$i3c$email***@***.com...
> > "Ace" <email***@***.com> wrote in message
> > news:s0Usc.167024$email***@***.com...
> > > Now what if you had: String str ="abc"+" "+"def"+"efg";
> >
> > The compiler creates a single String instance with the value "abcdefefg"
>
> It becomes "abc defefg", actually.
> It is
remove "It is"
insert "The exact same string can be"
> created with the following Java statement:
> new StringBuffer().append("abc").append(" ")
> .append("def").append("efg").toString()
Maybe I am just too flexible in my use of language.
- 13
- Tabs on the right side in JTabbedPane ?I wanted to add 4 tabs to a JTabbedPane. Two of them should be on the left
side and two on the right side (all on the top). In other words, I want a
pretty big gap between these two sets of tabs.
______ _____ ______ _____
/__1___\/__2__\________________/___3__\/__4__\
|
|
|
|
Something like the above.
Is there a way to do it ?
Thanks.
RC
- 14
- Question about binary release licenseHi,
I hope I'm wrong, but does the license of binary jdk/jre
released by FreeBSD Foundation prohibit redistribution
of the package ? I think that Sun allows one to redistribute
at least jre with application so why is this different ?
Ari S.
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 15
- How to get the return value by a Sybase stored procedureSuppose I have the following dummy stored procedure on Sybase or MS
SQL Server:
create procedure foo
as
select 'Hello World'
return 12345
With jdbc driver, how can I get both "Hello World" and 12345 back? Or
can I get the return code back at all? Do I have to use output
parameters?
Thanks in advance.
-tony
|
|
|