 |
 |
Index ‹ java-programmer
|
- Previous
- 1
- Override prepareRenderer()I've gathered that in order to change the background color of a row,
one can either use the tablecellrenderer or can override the
prepareRenderer() method. I have chosen to override the
prepareRenderer() method. My question (and a reather silly one) is
exactly how to call this method to then color your rows.
I already have a jtable with is autogenerated by netbeans and all of
the code I've seen, the jtable is created programmatically.
Here is what I TRIED to do (any help is greatly appreciated):
public void updateGUI(String newValue){
DefaultTableModel errorTableModel = (DefaultTableModel)
parentScreen.jTableErrors.getModel();
int numRows = errorTableModel.getRowCount();
numRows++;
errorTableModel.setRowCount(numRows);
parentScreen.jTableErrors.setModel(errorTableModel);
Object newObjectError = (Object) newValue;
parentScreen.jTableErrors.setValueAt(newObjectError, numRows - 1, 0);
JTable coloredTable = new JTable( errorTableModel )
{
public Component prepareRenderer(
TableCellRenderer renderer, int row, int column)
{
Component c = super.prepareRenderer(renderer, row, column);
String message = (String) getValueAt(row, column);
String[] dividedMsg = message.split(":");
if(dividedMsg[0].equals("Error: ")){
this.setBackground(Color.RED);
}
else{
this.setBackground(Color.YELLOW);
}
return c;
}
};
parentScreen.jTableErrors = coloredTable;
}
- 2
- How to simulate a busy taskHi everybody,
I was trying to perform some tests in a multithreading application and
I would like to simulate overloading. That is, I want to simulate
threads performing a task that takes a certain time T. I have thought
of the following possibilities:
-Implement a method that sleeps during T milliseconds. Problem: this
does not overload the computer, during those T milliseconds other
agents can execute.
-Implement a method that performs a busy wait (while(true){...}) and
exits when T milliseconds have passed. Problem: there could be context
switches in between, and so it could happen that another thread
executes in the meantime (and that execution time should not count to
decide when to terminate the busy wait).
-Similar to the previous approach, but we try to count the milliseconds
elapsed "by hand". That is, in every iteration we obtain the
System.currentTimeMillis() and count as much as 1 millisecond (if it is
really at least 1 millisecond greater than the value measured in the
previous iteration). In this way, if the thread is interrupted while
executing the method, nothing happens because we count at most 1
millisecond per iteration. This does not work either too well, because
more than 1 millisecond could have been elapsed between measures.
So I'm not really sure if I can do this with some precision. If you
have any suggestions, please let me know. Thanks in advance,
S.
- 2
- reinventing the wheelhttp://www.ted.com/index.php/talks/view/id/162
This is off topic, but Java folk will like find it amusing. It shows
a Dutch invention to replace the wheel, various mechanical walking
machines. It has a mechanical step counter, a sort of primitive finite
state automaton..
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 4
- hide NullPointerExceptionI have a GUI which throws a nullpointerexception when things go wrong.
Then it closes. That nullpointerexception is expected and I want it
ignored since before that it has already informed the user that
something has gone wrong and its closing. How can I do this? If I just
put the part of the function throwing the exception within try/catch,
it tends to hang. If I leave it as is, it throws the exception but
closes fine. I just don't want the user to see that exception.
- 5
- Problem starting out with Java . . .Hey. Im new to Java, and am having a prroblem with the netbeans IDE.
every time i try to import java.awt.* , I can't use any of the
methods(like they don't exist). I can compile it fine, but when I try to
run it, I get "exception in class main".
Can anyone help me, please?
- 5
- please explain this simple constructmy instructor likes to use this construct in class but never really
explained why/how it works:
while (true)
{
if (something) return; // break from while
}
can someone shed some light how this works?
- 7
- 7
- getDocumentBase and getCodeBase not recognized...Hi, Im having a slight problem.
I am trying to load an image object with the code below, and I am NOT
extending Applet in my class because I am working on an application.
The problem is that getCodeBase AND getDocumentBase are not being
recognized by my application, however I am sure that the required jars
are in the build path... and that I've referenced them... most likely
inapproprirately.
My code is set up like this
Base\
Base\graphics\img.gifs.
Code follows, I trimmed the imports mostly off, but the rest appear
below the code...
Thanks for your advice.
import java.net.URL;
import java.applet.Applet;
............
String strImageUp = "graphics/up.gif";
URL urlUp = getClass().getResource(strImageUp);
Image imgUp = null;
try {
MediaTracker m = new MediaTracker(this);
imgUp = getImage(getDocumentBase(), strImageUp);
m.addImage(imgUp, 0);
m.waitForAll();
}
catch (Exception e) {
e.printStackTrace();
}
................
import javax.crypto.interfaces.PBEKey;
import javax.imageio.*;
import java.awt.image.*;
import java.io.File;
import java.io.IOException;
import java.util.Vector;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.Border;
import java.util.LinkedList;
import java.util.ListIterator;
import java.awt.event.ActionListener; //for buttons
import java.awt.event.ActionEvent; //for button events
import java.awt.event.KeyEvent; //for key shortcuts
import java.math.*; //percentage rounding
- 7
- poster or wallpaperHi all
I need posters or wallpapers which is about programming and computer
science, for hanging
thanks
- 8
- Choosing elements to display in a JSP using StrutsHello,
I am very new to everything web development, so please bear with me.
My development environment is:
Win2k
Tomcat 4.0.30
Apache 2.0.48
mod_jk/2.0.4
j2sdk 1.4.2
Struts 1.1
mysql 4.0.18
I am using Struts to develop my webapp in an MVC fashion. I am using
forms based authentication to a mysql database.
Using the tools in my development environment, I am wondering if it is
possible to choose the elements displayed in a JSP based on the group
the user is in (and still stay withing the MVC framework), or if that
is even the right approach. I prefer to not show options to users if
they do not have permissions to perform them.
Any suggestions or advice would be great. If you know of any
tutorials/books/web resources that you could point me to, that would
be fantastic as well.
Thanks in advance.
Randy
- 10
- Implementing an interface in eclipseUsing IntelliJ, I would be able to implement an interface whilst having
it open in the editor. You could open the context window using the
keyboard and choose to implement interface and magically the
implementation appears complete with the statement "... implements
SomeInterface"
Does anyone know how to do the same in eclipse so I don't have to open
that New Class window and manually choose the interface?
- 10
- Hot-deployment of EAR/JAR files using classloaders (on JBoss app server)Hi,
I am trying the following scenario:
- I deploy an app.ear into the jboss server.
- app.ear invokes a session bean deployed separately (sessionbean.jar)
- everything works fine
- I modify sessionbean.jar
- I redeploy it without restarting the server (hot deployment)
When app.ear invokes the sessionbean, it refers to the previous instance of
the sessionbean. And because I have replaced it, it does not find the
class...
Then I read on, and I find that if you write custom class loaders, you can
load new versions of classes on the fly (dynamic loading).
So I wrote a custom class loader, which works fine when I call a basic java
library, but there does not seem to be a way of 'redeploying' this
sessionbean.jar as a bean (you can't invoke it anymore with the home/remote
interface)....
Can someone help me here ? I am basically trying to redeploy beans without
redeploying the app server and having them immediately rebind to whichever
application needs to use them.
Thanks
Steph
- 12
- Q: Possible to auto-fallback back to MS JVM from Sun JVM ?Hi all.
Ok, so it's no secret, MS can no longer distribute its Java VM with
its OS'.
Naturally, that didn't stop me from installing an old one so
WindowsUpdate would see it and upgrade it to the last (MS) build:
5.00.3810
I also installed the latest SUN Java VM (1.4.2_03)
*** Flash ***
Woaaaah!! Just saw their "Law & Order" game
(http://java.com/en/index.jsp)
Gotta try that!
*** End Flash ***
So what I want in fact, is to use SUN's VM as default, but to
automatically switch back to MS' VM for those sites that still use it
(for example, my bank still uses it, so I can't issue payments if Sun
is default -- annoying).
Of course, this can be done manually in "Set Program Access and
Defaults" in hte Window scontrol panel, but you have to select one or
the other.
Same with Sun's Java Plug-in control panel (Advanced tab).
So... is there a way to perform an auto-fall-back to MS JVM when an
applet cannot load/initialise with the Sun JVM ?
Or create a list of site which must use MS instead of Sun?
Any help appreciated.
M.T.
- 12
- writing email attachment file to diskI'm trying to capture an email attachment and write it to disk.
I've coded the following lines in my attempt. The program seems
to run and creates the local file alex99.pdf. However, when I
tried to open it, it says it's corrupted and/or wasn't properly
decoded. Any ideas?
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
Store store = session.getStore("pop3");
store.connect(host, username, password);
Folder folder = store.getFolder("inbox");
folder.open(Folder.READ_ONLY);
Message message[] = folder.getMessages();
for (int i = 0, n = message.length; i < n; i++) {
System.out.println(i + ": " + message[i].getFrom() + "\t"
+ message[i].getSubject());
Object obj = message[i].getContent();
if (obj instanceof String) {
System.out.println(">>>plain text");
} else if (obj instanceof Multipart) {
System.out.println("Multipart");
Multipart mp = (Multipart) obj;
System.out.println("mp count = " + mp.getCount());
for (int j = 0, nn = mp.getCount(); j < nn; j++) {
Part part = mp.getBodyPart(j);
String disposition = part.getDisposition();
if ((disposition != null)&& ((disposition.equals(Part.ATTACHMENT) ||
(disposition.equals(Part.INLINE))))) {
System.out.println("attachment");
FileOutputStream fos = new FileOutputStream("alex99.pdf");
part.writeTo(fos);
} else if (disposition==null) {
MimeBodyPart mbp = (MimeBodyPart)part;
if (mbp.isMimeType("text/plain")) {
System.out.println("text/plain");
} else {
System.out.println("other mime type");
}................................
- 13
- synchronize vs gateI have a singleton in a web service that provides a collection and
self-updates it on a periodic basis:
doSelfUpdate()
create temporary collection (time consuming)
syncronize
update temporary collection from current collection (fast)
create temporary reference 'old' to current collection
point current collection reference to temporary collection
end syncronize
do stuff with 'old' collection (time consuming)
done
getCollection()
synchronize
just waiting on monitor
end synchronize
return collection
done
It seems to me each thread accessing the getCollection method must
wait on the monitor every time it is accessed -- which is not what I
want. I just want to open and close the gate for a few milliseconds
while the self-update is being done. What do y'all think about
something like this:
boolean isBusy=false;
doSelfUpdate()
create temporary collection
isBusy=true;
update temporary collection from current collection
create temporary reference 'old' to current collection
point current collection reference to temporary collection
isBusy=false;
do stuff with 'old' collection
done
getCollection()
maxWait=10000
waited=0
while(isBusy && waited <maxWait) {
waited+=500
if(waited>=MaxWait) log error;
wait 500
}
return collection
done
IMHO this means each thread consuming getCollection is a tiny bit
slower because it has a condition that must be tested, but as a group
they are not waiting in line for the monitor. Is this right?
|
| Author |
Message |
dbfrager

|
Posted: 2007-8-22 7:25:00 |
Top |
java-programmer, J2ME & Eclipse
I have just started playing with J2ME, using a software example I downloaded
from http://www.garret.ru/~knizhnik/En_Home.htm#Shopper. I can successfully
build the application and run it both in the emulator outside of eclipse
using emulatorw, and also on my Nokia phone.
I just can not run it within Eclipse, with or without debug. I get the
following error message:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.sun.midp.main.Configuration.getProperty0(Ljava/lang/String;)Ljava/lang/String;
at com.sun.midp.main.Configuration.getProperty0(Native Method)
at com.sun.midp.main.Configuration.getProperty(Configuration.java:32)
at com.sun.midp.lcdui.Resource.<clinit>(Resource.java:30)
at com.sun.midp.main.Main.initSystemLabels(Main.java:686)
at com.sun.midp.main.Main.main(Main.java:103)
|
| |
|
| |
 |
Joshua Cranmer

|
Posted: 2007-8-22 8:36:00 |
Top |
java-programmer >> J2ME & Eclipse
dbfrager wrote:
> I have just started playing with J2ME, using a software example I
> downloaded from http://www.garret.ru/~knizhnik/En_Home.htm#Shopper. I
> can successfully build the application and run it both in the emulator
> outside of eclipse using emulatorw, and also on my Nokia phone.
>
> I just can not run it within Eclipse, with or without debug. I get the
> following error message:
>
> Exception in thread "main" java.lang.UnsatisfiedLinkError:
From the JavaDocs page for UnsatisfiedLinkError:
"Thrown if the Java Virtual Machine cannot find an appropriate
native-language definition of a method declared native."
Therefore, there is some native library that is being used that is not
present on your computer. My guess is that your computer does not have a
Java ME installation on it. Since my extent of Java ME knowledge is
"It's a special environment for specialized environments", I cannot help
you further with this information. But better keywords to look for would
be using Java ME on a PC or something similar.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- [Struts] <set-property> how does it works?Hi all
I know that in <action> mapping I can use a sub-tag <set-property
property="" value="">
How can I access to these information inside an action?!
As I can imagine there should be a getProperty/getProperties method to the
ActionMapping class ....but it isn't!!
I appreciate any hint..
thanx
--
ShadowMan
- 2
- How many float values in range 0f - 1f inclusive?
How many float values can be represented
in the range of 0f through 1f inclusive?
--
Yes, I've had elementary arithmetic,
but it was a long time ago, and I
probably wasn't paying enough attention.
- 3
- navigate to webpage and capture whole screen to a JPEG?Is it possible to navigate to a URL, take a "screenshot" of the webpage and
save it to a JPEG? I would like to create a dynamic screensaver which would
show me the latest CSI webpage on my monitor. Is something like this
possible? I figure I can create the URL, goto the webpage, and I can learn
how to steam a JPEG to a file, and even draw it to a panel, but I don't know
how to screen scrape the webpage's screen.
Thanks.
- 4
- search algorithms for searching a body of textIm looking for an efficent search algorithm which searches a body of text
(under 3,000 words) looking for keywords.
What would be the best algorithm to employ.
The body of text may be a XML document (in which case id like to be able to
search the XML elements eg search for 'Alan Turing' in the element tag
author)
Thanks in adavance for any pointers
- 5
- Eclipse HTTP PluginLooking for an eclipse plugin (with source code preferibly) that will
allow me to post an HTTP request. I am trying to integrate3 the IDE
with a proprietary Server side app and want to be able to pass a large
string as a parameter to a JSP page.
Any help is greatly appreciated.
Jason
- 6
- Strange problem with JDBC and Oracle 10gFolks!
Somehow delete statements inside a transaction do not seem to have any
effect when I set the isolation level to *serializable* in Oracle 10g.
With the default isolation level (read committed) everything works fine.
I use the JDBC driver shipped with it. I use no connection pooling, but
am working directly on the Oracle connection. Autocommit is turned off.
When I execute this Java code
> statement =
> connection.prepareStatement("ALTER SESSION SET
SQL_TRACE = TRUE");
> statement.executeUpdate();
> close(statement);
> statement =
> connection.prepareStatement(
> "delete from PROPERTIES p where p.VERSION_ID
= "+id);
> deleted = statement.executeUpdate();
> System.out.println("Deleted: "+deleted);
> close(statement);
> statement =
> connection.prepareStatement(
> "delete from PROPERTIES p where p.VERSION_ID
= "+id);
> deleted = statement.executeUpdate();
> System.out.println("Deleted: "+deleted);
> close(statement);
>
> statement = connection.prepareStatement("select
PROPERTY_NAME, VERSION_ID, PROPERTY_NAMESPACE from PROPERTIES p " +
> "WHERE p.VERSION_ID = "+id);
> rs = statement.executeQuery();
> while (rs.next()) {
> System.out.println("After **** Name
"+rs.getString(1));
> System.out.println("After **** Version-Id
"+rs.getString(2));
> System.out.println("After **** NS "+rs.getString(3));
> }
> close(statement,rs);
>
> statement =
> connection.prepareStatement("ALTER SESSION SET
SQL_TRACE = FALSE");
> statement.executeUpdate();
> close(statement);
both delete statements report to delete the same amount of rows and the
select statement still retrieves them afterwards. How is this possible?
Is there any obvious mistake in the code?
This is what I get as the trace
> =====================
> PARSING IN CURSOR #6 len=34 dep=0 uid=65 oct=42 lid=65
tim=105493947922 hv=3913151867 ad='67f33cac'
> ALTER SESSION SET SQL_TRACE = TRUE
> END OF STMT
> EXEC #6:c=0,e=519,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=105493947908
> =====================
> PARSING IN CURSOR #4 len=48 dep=0 uid=65 oct=7 lid=65
tim=105493978311 hv=3637529011 ad='67da3a90'
> delete from PROPERTIES p where p.VERSION_ID = 28
> END OF STMT
> PARSE
#4:c=15625,e=9852,p=0,cr=12,cu=0,mis=1,r=0,dep=0,og=1,tim=105493978298
> EXEC #4:c=0,e=335,p=0,cr=1,cu=1,mis=0,r=1,dep=0,og=1,tim=105493978772
> STAT #4 id=1 cnt=0 pid=0 pos=1 obj=0 op='DELETE (cr=1 pr=0 pw=0
time=163 us)'
> STAT #4 id=2 cnt=1 pid=1 pos=1 obj=51685 op='INDEX RANGE SCAN
SYS_C007946 (cr=1 pr=0 pw=0 time=86 us)'
> =====================
> PARSING IN CURSOR #6 len=48 dep=0 uid=65 oct=7 lid=65
tim=105493980587 hv=3637529011 ad='67da3a90'
> delete from PROPERTIES p where p.VERSION_ID = 28
> END OF STMT
> PARSE #6:c=0,e=231,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=105493980577
> EXEC #6:c=0,e=259,p=0,cr=1,cu=1,mis=0,r=1,dep=0,og=1,tim=105493980952
> STAT #6 id=1 cnt=0 pid=0 pos=1 obj=0 op='DELETE (cr=1 pr=0 pw=0
time=160 us)'
> STAT #6 id=2 cnt=1 pid=1 pos=1 obj=51685 op='INDEX RANGE SCAN
SYS_C007946 (cr=1 pr=0 pw=0 time=85 us)'
> =====================
> PARSING IN CURSOR #5 len=94 dep=0 uid=65 oct=3 lid=65
tim=105493993679 hv=2310065897 ad='6a3e5ca4'
> select PROPERTY_NAME, VERSION_ID, PROPERTY_NAMESPACE from PROPERTIES
p WHERE p.VERSION_ID = 28
> END OF STMT
> PARSE
#5:c=15625,e=11137,p=0,cr=10,cu=0,mis=1,r=0,dep=0,og=1,tim=105493993668
> EXEC #5:c=0,e=98,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=105493993898
> FETCH #5:c=0,e=146,p=0,cr=1,cu=0,mis=0,r=1,dep=0,og=1,tim=105493995306
> STAT #5 id=1 cnt=1 pid=0 pos=1 obj=51685 op='INDEX RANGE SCAN
SYS_C007946 (cr=1 pr=0 pw=0 time=94 us)'
> =====================
> PARSING IN CURSOR #6 len=35 dep=0 uid=65 oct=42 lid=65
tim=105493997130 hv=4067503723 ad='68daac44'
> ALTER SESSION SET SQL_TRACE = FALSE
> END OF STMT
> PARSE #6:c=0,e=155,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=105493997120
> EXEC #6:c=0,e=512,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=105493997740
Only thing that would make sense to me was if the two deletes and the
select somehow were executed in different transactions. Would that make
sense? If so how could this be possible?
Thanks for *any* help in advance!
Oliver
- 7
- Javascript problem - I don't know what to do about it?!?!Here is the script I have in my page :
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "',
'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=194,height=146,left
= 440,top = 288');");
}
// End -->
</script>
It opens a new window when the user clicks on a certain link.
Well, somewhere else in the page, I embeded a flash media object and
found out now that everytime the page opens, the pop up window opens
too which is NOT what I want. I want the Popup window to only open
when the user clicks on a text link (which it did work perfectly until
I put in the flash object).
So why is the flash object calling the popup window instead of just
playing like it is supposed to?
- 8
- Wholesale Alain Silberstein Architecte Automatic Replica Watches AS019 Discount, Fake WatchWholesale Alain Silberstein Architecte Automatic Replica Watches AS019
Discount, Fake Watch
Wholesale Watches at www.watchec.com
Browse our Alain Silberstein Architecte Automatic Replica Watches fake
watch, which is sure the watch you are looking for at low price. There
are more high quality designer watch replicas for selection
Alain Silberstein Architecte Automatic Replica Watches AS019 Link :
http://www.watchec.com/alain-silberstein-replica-watches-as019.html
Model : AS019
Description : 100% Genuine Replica Alain Silberstein Watches, Gray
Dial - Black Rubber Band
Sale Price : $ 109.00
Alain Silberstein Architecte Automatic Replica Watches AS019
Details :
Superb quality solid stainless steel casing and heavy SS band
Modern contemporary design double locking deployment clasp
Sturdy casing made with high-grade materials
Fully automatic self-winding sweeping second hand movement
Fully function chronograph dials
Fully functional Moonphase
Screw in crown
Solid SS back with the Alain Silberstein engravings
All the appropriate Alain Silberstein markings
We are leading supplier of Wholesale watches including rolex watches,
rolex submariner, rolex daytona, rolex thunderbird, rolex tudor, rolex
oyster, rolex yacht master, swiss pendant watch, rolex sea dweller and
rolex air king etc. We are specialized fashion Watches wholesaler.
If you are looking for the well know brand watch and information about
it, you came to the right place. Here you can find such fine you I top
brand-name watches as Well know brand Rolex Watches, Well know brand
Alain Silberstein Watch,Fake A.Lange & Sohne watch,Well know brand
Audemars Piguet Watches, Baume & Mercier watches, Replica Jacob & Co
watches, well know brand Breitling watches, Well know brand Breguet
watch, Bvlgari, Jaeger leCoultre, and other.
Man watch is the most important accessory a man can own - it is an
essential style element. Well know brand watches are invented for the
people who want to look good, to impress everybody, but they don't
have so much money to buy original expensive watch. Our well know
brand watches are well known for their impeccable quality, the
precision engineering of the watches. Nobody will ever know that it is
not real. Also, it is a very good, pleasant and not expensive present
for your friend, father, husband, wife or any other close person,
witch will serve for many years. This great present will remind about
you to your close man every time. If you are looking for luxury, the
latest watch technology and excellent design take a look at our
collection of well know brand watches.
If you have any other questions please check our other pages or feel
free to email us by email***@***.com
Wholesale Alain Silberstein Architecte Automatic Replica Watches AS019
Discount, Fake Watch
- 9
- page counter in JSP & JSTLHi everyone,
I have a web application which consists of 2 JSP pages. Each page
displays the number of time the page has been accessed. This is
accomplished by using a jsp declaration :
(this sample is taken from the following book : "Servlets and
JavaServer Pages : The J2EE Technology Web Tier")
<%! int pageCount = 0;
void addCount() { pageCount++; }
%>
<html>
<head>
<title>page1.jsp</title>
</head>
<body>
<% addCount(); %>
This page has been visited <%= pageCount %> times.
</body>
</html>
Now, let's say I want to ruse the JSTL tags instead. This will give
something like (not tested) :
<c:set var='pageCount1' scope='application' value='${pageCount1 +1}'/
>
This page has been visited <c:out var='pageCount1/>' times.
I have 2 questions :
Q#1 : with JSP declarations, the page counter can have the SAME name
on each JSP. But if I use an application scoped counter, the counter
will have to have a DIFFERENT name for each page (ie : pageCounter1
for page1.jsp, pageCounter2 for page2.jsp). Is there a way to use the
same name ?
Q#2 : how do I initialize the value of the application scoped counter
if I use JSTL ? (for example, what if I want the counter to start from
100 ?)
Thanks for helping !
- 10
- Java rich client design patterns: where to find?Hi all,
another possible title for this message would be:
Where can I find effective references on design patterns and best
practices to build complete and elegant Swing applications?
I have been developing Swing applications for about 3 years and never
got satisfied with the results. In the begining I was not using any
design pattern, just putting all my code there in the same class, so
you can imagine the mess. After some months I started looking for some
references on "building elegant Swing applications" and what I found
was very frustrating: there are very few _effective_ references on
that.
I think _effective_ is a very important word here. In fact, there are
thousands of sites and books describing Java technologies and another
thousand others explaining how to build a complete Web application
using J2EE technologies. The problem is finding references on building
a complete, real-life, java rich client application. This topic is so
controverse that one will find many terminologies to define the same
type of application: java rich client application, java desktop
application, java GUI application, Swing application. The situation
gets worse by the fact that people used MVC to build Swing. Then you
try googling "swing MVC" and thousands of sites explaining how Swing
was developed show up. The problem is I DO NOT WANT TO KNOW HOW SWING
WAS DEVELOPED, I WANT TO KNOW HOW TO DEVELOP GOOD APPLICATIONS USING
SWING! I have even tried to adapt some J2EE patterns to Swing
applications, but the results were definetly not good.
In fact, there are some sparse references describing how to build
complete Swing applications using patterns like Presentation Model and
Model-View-Presenter (MVP):
- Desktop Java Live: http://www.sourcebeat.com/TitleAction.do?id=10
- JGoodies: www.jgoodies.com
- Martin Fowler home-page: www.martinfowler.com
- Martin Fowler work-in-progress (Patterns of Enterprise Application
Architecture): www.martinfowler.com/eaaDev
- Spring Rich Client Project: www.springframework.org/spring-rcp
- Eclipse Rich Client Platform:
wiki.eclipse.org/index.php/Rich_Client_Platform
- The Humble Dialog Box:
www.objectmentor.com/resources/articles/TheHumbleDialogBox.pdf
The problem with this references is that the information is either not
uniform or not consistent. Each one explains MVP one way, with very
poor examples. It would be very good to see a complete source code
example of a Swing application using MVP and accessing a persistence
layer. Does anybody know where can I find that? Any book talking about
this topic would be very good too.
"It is our belief the only problem with Swing is that there are a
limited number of higher-level abstractions available that assist in
making the toolkit simpler and easier to use, and a limited number of
design best practices. The goal of spring-richclient is to provide
that." Spring Rich Client Project
Thanks in advance,
Diego M. da Rosa
diegomrosa at gmail dot com
- 11
- Get the best browser in the world.Get the best browser in the world.
If you are still using "explorer" download Firefox - it will change
your life.
Get it from here for free:
http://xthost.info/browser/index.htm
- 12
- Question about Database Connection PoolsHi Newsgroup,
i have written an Objectpool for Database connections. All locked
connections are stored within a Vector (called _used) and all unlocked
connections are stored within a second Vector (called _unused).
Now consider the following situation:
------------------- code ---------------------------------------
DbConnectionPool pool = new DbConnectionPool( driver, url, user, passwd);
Connection dbcon = pool.getConnection();
int sizeUsed = pool.getUsed(); // returns 1, thats ok
// ...
// ... lets do some actions with dbcon ....
// ...
// ... programmer does not notice
// ... that dbcon is still in use.
// ... so he checks out a new connection
//
dbcon = pool.getConnection();
sizeUsed = pool.getUsed(); // return 2, uppps!!!
------------------- code ---------------------------------------
Because the programmer checks out a new connections, two database
connections are now marked as _used.
Is there any possibility to avoid such situations?
Thank you in advance
mike
- 13
- Problem with deploying war-files with jbossHello,
our development-team has made a war-file.
When I deploy this war-file in the right folder in jboss.
../server/default/deploy/..
some file (in this case jpeg's) were't unzip/deploy in the temp-folder.
Unzipping the war-file is showing that this files are there.
What can I do to solve this problem?
Any suggestion for an argument, when starting up the jboss or something else.
Every help would be nice.
Regards,
Andreas
- 14
- Java Thread,Hi,
I am spawing a new Thread in my application, which runs as an
background process. I am looking to set -Xmx512mb memory to this new
Thread programatically. How do i do it.
thanks
- 15
- Alternatives to Cobra for GUI<->Backend I/F ?Hi there
Im working on an existing system which has a backend written in C/C++
and we are using J2SE for the GUI forend. The backend end forend can
be on different systems/platforms. Current we are using CORBA as the
interface which works ok but it is tedious having to implement C++
impl's and then also do the same in the java code. One of the problems
is that we are continually adding new interfaces and modify existing
ones. Its my impression that CORBA is more useful for more stable
interfaces possibly between different vendors software.
Are there any other technologies that it may be worth me looking into.
It struck me that plain old CGI may be an alternative, and I've been
told that SOAP maybe a way forward, there are probably others I don't
know anything about and have never heard of. Any views on this matter
would be great as Im a little out of touch because there are so many
new technologies out there now days.
Cheers
Steve
|
|
|