| JTable(A few more queries ) |
|
 |
Index ‹ java-programmer
|
- Previous
- 1
- Something a bit goofy about Generics
Iterable<? extends JavaFileObject>
You'd think a JavaFileObject[] or a JavaFileObject... would fullfil
that requirement, but it doesn't. It fills it sufficiently to do a
for:each but not to satisfy this parameter.
That is like a piece of purple lint on a white sweater.
People say arrays and generics don't mix, but they damn well SHOULD.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
- 1
- Printing EPS (embedded postscript) from Java.
Hello all,
I need to print .eps (also called .epsf, .epi, .epsi) from inside a
java program. My target platforms are windows and mac-- although
windows is first.
The new 1.4 printing API has aupport for printing normal postscript
but does not have .eps support.
I've been looking around the internet to see what solutions people
have come up with and unfortonately I didn't get what I would call a
solid answer by doing this....
I looked at the source of two open source programs the support .eps.
They both have origianal source but esstenially did it almost exactly
the same way. They took the .ps file the the standard Java classes
generated and just stuck an .eps header on it. They then stick the .ps
inside a box as required. They then searched the .ps file for commands
that are illegal in the .eps and if they are there they just die.
I've got some serious problems with this:
(1) It assumes that the Sun classes are going to generate a .ps that
is easily converted to an eps. Maybe they do now but what about future
versions of Java?
(2) It makes big assumptions about future .ps and .eps formats.
(3) It stinks of just being a hack. Does anyone really know this is
going to work all the time and on all platforms?
Does anyone have any experience with making .eps from Java that has
any sugestions? I want to translate my Garphics2D objects to .eps. I
want the .eps to be accepted by major publishing programs on windows and
mac.
Thanks
Glen Pepicelli,
http://www.glenp.net
(reply to group)
- 4
- how to do synchronization profiling and RepaintManager and performance issuesSome day ago I've posted about a problem with
javax.swing.SystemEventQueueUtilities.queueComponentWorkRequest
and some performance problem.
(http://groups.google.com/group/comp.lang.java.programmer/browse_frm/thread/afcd152d02c4d4cb/#)
My doubt is that the system spend too much time in symchronization
problems.
Someone suggested that it can be all the repaint stuff, but I've tried
to reduce it...(the paint component method in the reduced version is
something like
{ super.paintComponent..
draw an oval}
while in the complex versions is {
{ super.paintComponent..
draw 400 lines
draw 400 oval
}
and the first one takes the 20% of resources while the last the 40%
Moreover the time spent in the paint method is less and the repaint
manager should be decoubled from the component...
so how can I do a better profiling of the system?
I was thinking to override the repaint method and using directly the
invoke later paint..
but I'd like that the new method would be able to merge more call to
repaint in only one paint.. if the last paint hasnt stopped...
I hope that this info will sufficent, otherway askme
Thanks to all
Dimitri
- 5
- sentmail problemhi
i am doing a project using JavaMail API with JSP and James server
i have implemented sendmail,compose. but i wanna know how can i
implement sentmail as it is seen in the real application.
I wanna know what can i should do to retrieve the mails sent from an
account using James
- 6
- Programatically deducing VARCHAR2 length?Hi,
I'm using WebLogic 5.1 sp12 and Oracle 8.1.7 with JDBC 1.2 drivers.
I was wondering, if I know that a column is a vARCHAR2 column, how
could i deduce the maximum length of that column, short of repeatedly
inserting larger and larger strings until I genertae an exception. I
know with SQL*Plus I can describe the table and find out lengths that
way, but I was hoping for a more general automated method.
Thanks for any help anyone can provide - Dave
- 6
- looking for a Java decompilerHello!
Is there a good byte-code de-compiler in the ports? It does not
need to be fancy/GUI -- just a straghtforward .class->.java utility.
Thanks for any pointers. Thanks!
-mi
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 7
- Check class file for annotationDoes anyone know of a simple way to determine whether a marker
annotation is present in a given class file?
TIA
--
========================================================================
Ian Pilcher email***@***.com
========================================================================
- 14
- 14
- Update of JProgressBarHi,
in my program i use a JProgressBar. I know, that i have to use another
Thread for updating the progressbar.
But with the following code it isn't working. What's wrong?
public class Parser1CheckVisitor{
int iCount = 0;
JFrameJRespCheck m_JFrameJRespCheck;
ResponseFile m_ResponseFile;
public Object visit(ASTrecord node, Object data) {
if (data != null) {
m_JFrameJRespCheck.jProgressBarPanelStatus.setMinimum(0);
m_JFrameJRespCheck.jProgressBarPanelStatus.setMaximum(m_ResponseFile.
m_iCount);
makeProgressThread().start();
for (iCount = 0; iCount < m_ResponseFile.m_iCount; iCount++) {
m_ChipFile.readRecord(iCount + 1);
data = node.childrenAccept(this, data);
}
}
return "OK";
}
Thread makeProgressThread() {
return new Thread() {
public void run() {
while (iCount != m_ResponseFile.m_iCount) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {}
m_JFrameJRespCheck.jProgressBarPanelStatus.setValue iCount);
//System.out.println(iCount);
}
}
};
}
}
- 15
- Java Training QuestionI am an unemployed web developer with php, perl, and asp programming
experience and in order to be able to widen my job search I am considering
getting some formal training in Java. I am looking for training
recommendations in order to be able to do Java web development. Also will
this training be appealing to prospective employers or just a waste of my
time and money. Any feedback I get will be greatly appreciated.
- 15
- [ANN] SwingEmpire FormBuilder - New Preview 0.9.4
SwingEmpire FormBuilder helps in quickly building GUIs with JGoodies
Forms.
The new/updated features include:
* pluggable custom layout styles for grid elements and borders
* enhanced support of custom component factories
The preview is available at
http://www.swingempire.de/palace/FormBuilder
For your convenience a summary of "old" features
* rapid visual design of form-oriented GUIs
* targeted on JGoodies Forms
* re-usable layout data
* immediate preview in choosable LookAndFeels
* persisting layout data separated from application code
* persisting via standard XMLEncoder
* pluggable custom components
* pluggable persistence format
Test and (hopefully :-) enjoy - I'm eagerly awaiting your feedback.
Regards
Jeanette Winzenburg, Berlin
- 15
- Little ProblemI have three numbers - 1, 2 & 3.
A randomly selected one of the three are stored in 'var1', and another
randomly selected one is in 'var2'.
How do I find out the number that is left over?
I tried a while loop but I couldn't get it to work...
TIA
- 15
- JNI Trouble calling FindClass from Worker threadHello
I am able to get the class object when i call FindClass in the main
thread. Now when i spawn a worker thread and attempt the same call
after caching the JVM and creating a new Env . it fails and triggers an
exception on the Java side .
My code for a DLL looks like this
JMVM *jvm = NULL ;
..
DLLMain()
{
}
JNIEXPORT jint JNICALL Initialize
(JNIEnv *pEnv, jclass)
{
pEnv->GetJavaVM(&jvm);
ASSERT(jvm!=NULL);
jclass cls = pEnv->FindClass("demoflashplugin/views/Objfactory");
if(cls!=NULL)
AfxMessageBox("cls found");
AfxBeginThread(WindowThread , NULL);
}
UINT WindowThread(LPVOID p)
{
JNIEnv *env = NULL ;
jclass cclass ;
if(jvm!=NULL)
{
if (0==jvm->AttachCurrentThread((void**)&env,NULL))
{
if ((env)->ExceptionOccurred()) {
AfxMessageBox("Exception occured");
(env)->ExceptionDescribe() ;
}
if(env!=NULL)
{
AxMessageBox(getenv("CLASSPATH"));
cclass = env->FindClass(demoflashplugin/views/Objfactory");
if(cclass!=NULL)
{
AfxMessageBox("Class is not Null");
}
else
AfxMessageBox("Class is s Null");
}
else
{
AfxMessageBox("env is NULL ");
}
AfxMessageBox("Finished checking for string");
}
else
{
AfxMessageBox("JVM IS Null");
}
}
}
- 15
- Applet using jdbc (ms sqlserver)Hi,
After reading lots of docs, a got the impression that it is possible to
write an Java Applet, that uses jdbc to connect to MS SQLServer (Without
flushing all security permissions down to drain).
Here is what I've done:
1. Downloaded the Microsoft JDBC driver for SQL Server 2000 SP 3.
2. Downloaded the app from Microsoft's site:
http://support.microsoft.com/default.aspx?scid=kb;en-us;313100
3. Tried to compile.
I get the java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Error establishing socket.
I have tested every possible error that I can find in MS's site. I have
tried to alter policies granting "permission java.net.SocketPermission",
with no luck. I think that before granting this permission, I also got
some security exceptions..
So here's my question: is it possible to create an applet (UnTrusted)
that uses SQL server, that can be run in browser, that doesn't need any
security alternations?
Best Regards,
Mika
- 15
- Swing Worker Pause/ResumeHello all,
I am dealing with a class that extends SwingWorker and Inside that
class there is another class defined. I'll refer to the inside define
class as the "helper class" for sake of clarity.
What i am try to do is to pause/resume the class that extends
SwingWorker, when i used flags to do that it outputed errors from the
"helper class". These errors came from a method that fires Custom
Events and they were NullPointerExceptions. After the errors were
printed the classes continued executing.
How can i pause/resume successfully ?
Thanx in advance for any help :D
Ahmed Ashmawy
|
| Author |
Message |
hellbent4u

|
Posted: 2006-4-5 18:25:00 |
Top |
java-programmer, JTable(A few more queries )
I had a couple of more queries -
1) how to prevent swapping of the columns as in, by default the columns
in the JTable are not fixed in terms of their placement. They can be
very well swapped with one another. I want to prevent this.
2) Also after feeding the JTable with the data in database, i want to
be keep one row always empty so that a row can be inserted. It's like
we have in MS-Access.
hope i was clear in explaining the query properly.
Thanx,
Ankur
|
| |
|
| |
 |
IchBin

|
Posted: 2006-4-9 14:53:00 |
Top |
java-programmer >> JTable(A few more queries )
email***@***.com wrote:
> I had a couple of more queries -
>
> 1) how to prevent swapping of the columns as in, by default the columns
> in the JTable are not fixed in terms of their placement. They can be
> very well swapped with one another. I want to prevent this.
>
> 2) Also after feeding the JTable with the data in database, i want to
> be keep one row always empty so that a row can be inserted. It's like
> we have in MS-Access.
>
> hope i was clear in explaining the query properly.
>
> Thanx,
> Ankur
>
1 - To prevent swapping columns:
jTable.getTableHeader().setReorderingAllowed(false);
2 - Once you have loaded the data from that database just insert a blank
row[?]. Either using a Vector or Object.
Object[] yourRowData = {" "," "," ",.....};
yourTableModel.addRow(Object[] yourRowData[]);
Vector yourRowData;
yourTableModel.addRow(Vector yourRowData);
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
| |
|
| |
 |
IchBin

|
Posted: 2006-4-9 15:00:00 |
Top |
java-programmer >> JTable(A few more queries )
email***@***.com wrote:
> I had a couple of more queries -
>
> 1) how to prevent swapping of the columns as in, by default the columns
> in the JTable are not fixed in terms of their placement. They can be
> very well swapped with one another. I want to prevent this.
>
> 2) Also after feeding the JTable with the data in database, i want to
> be keep one row always empty so that a row can be inserted. It's like
> we have in MS-Access.
>
> hope i was clear in explaining the query properly.
>
> Thanx,
> Ankur
>
- To prevent table columns swapping use this:
yourJTable.getTableHeader().setReorderingAllowed(false);
- Just to append a blank row at the end: You can use either a
Vector or an an Object:
Object[] yourRowData = {"","","",....}
yourTableModel.addRow( yourRowData )
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- how to mail a form in JSPhi this is ravin. i m a last year IT student and i am doing my project
at a govt. organization. i have to do one thing in my project that:
> there is a feedback form which is to be filled by any user.
> it is having four fields.
1) name
2) tel.no
3) e-mail address
4) comments
> i simply have to mail this fields to the org.'s mail address when user hits submit button. there is nothing to do with this fields.
please send releated help as early as possible.
- 2
- Asking help for a java io problemHello, guys! I have a problem running the following code with eclipse
showing that:
java.io.IOException: Stream closed
at sun.nio.cs.StreamDecoder.ensureOpen(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at HtmlFileParser.parseHtmlDoc(HtmlFileParser.java:32)
at HtmlFileParser.main(HtmlFileParser.java:52)
//code here:
try{
FileInputStream fin = new FileInputStream("test.html");
InputStreamReader fr = new InputStreamReader(fin);
for(i=0; i<2048; i++) buf[i] = '0';
fr.read(buf, 0, 2048); //problem here (line 32)
FileWriter fw = new FileWriter("bufWriteTest.txt");
fw.write(buf);
fw.flush();
}
catch(FileNotFoundException e) {
e.printStackTrace();
}
catch(IOException e) {
e.printStackTrace();
}
There are no syntax erro in the above code, it just dosen't work,
please help me finding out what the problem is, thank you.
- 3
- EMPTY_SET.iterator() and generics
In the old days, before generics, I wrote
private SortedSet onhand;
Iterator getInventoryIterator() {
return (onhand == null ? Collections.EMPTY_SET ? onhand)
.iterator();
}
... the idea being to create the SortedSet only if there are
actually some Inventory objects to store in it, and to return
a suitable Iterator whether or not the SortedSet exists.
Now, in an effort to leave prehistory behind me and adopt
generics with all their benefits, I change the SortedSet to a
SortedSet<Inventory> and change the return type of the method
to Iterator<Inventory> -- but how do I rewrite the guts of the
method to get the compiler to understand that all is well? The
problem seems to be that Collections.EMPTY_SET.iterator() returns
an Iterator<Object>, and the compiler complains when I try to
return this in place of the desired Iterator<Inventory>. I've
tried a few variations, but have only succeeded in moving the
warning message around, not in eliminating it:
return (onhand == null
? (Set<Inventory>)Collections.EMPTY_SET : onhand)
.iterator();
return (Iterator<Inventory>)
(onhand == null ? Collections.EMPTY_SET ? onhand)
.iterator();
This seems like a lot of trouble to take over the empty set,
but there ought to be *some* clean way to do it. Ideas?
--
Eric Sosman
email***@***.com
- 4
- Read contents of a web pageI need to read the entire contents of any webpage, and return it as a
String. The other part of my assignment was to read a file and return its
contents. I did that with the following code:
private String filename;
private String contents;
public TextFileReader(String aFileName){
filename = aFileName;
}
public String readText() throws IOException{
String lineSep = System.getProperty("line.separator");
BufferedReader input = new BufferedReader(new
FileReader(filename));
String nextLine = " ";
StringBuffer contents = new StringBuffer();
while((nextLine = input.readLine()) != null){
contents.append(nextLine);
contents.append(lineSep);
}
return contents.toString();
}
----------
So, what do I have to change to be able to read webpages?
- 5
- JavaHelp and root nodehi,
Simplifying i have a java help set as this
ROOT -> C
-> B -> b1
-> b2
-> b3
->C
I can set B as current visualized node with these instructions:
helpBroker =(DefaultHelpBroker)coreHelpSet.createHelpBroker();
helpBroker.setCurrentID(B);
my problem is that i'd like to hide the other nodes setting B as tree
root node so that i could only see B and its children b1,b2,b3.
This is because entire help set is recovered from a big manual
describing a lot of applications and i'd like to show only one referred
by node B avoiding to show others that couldn't be installed.
Can you help me?
thanks
- 6
- Problem in connecting to a proxyHi,
i need to see if a user enters the correct username/password to
authenticate to a proxy. My problem is... through the following code,
i am
able to connect to a proxy with even invalid username/passwords.
Suppose
if the valid username and password to a proxy is test/test , i am able
to connect to the proxy using x/x . the response code returned is
always 200. Please advice..
################################
public static boolean isValidProxyAccount(String proxyServer,String
proxyPort,String proxyLogin,String proxyPassword) throws IOException
{
String go_url = new String ("http://www.google.com/");
boolean VALID_STATUS = true;
try{
URL url = new URL(go_url);
System.getProperties().put("proxySet",
"true");
System.getProperties().put("http.proxyHost", proxyServer);
System.getProperties().put("http.proxyPort", proxyPort);
HttpURLConnection con = (HttpURLConnection)
url.openConnection();
Base64Encoder b1 = new
Base64Encoder(proxyLogin+":"+proxyPassword);
con.setAllowUserInteraction(true);
String enStrProxy = "Basic "+ b1.processString();
con.setRequestProperty("Proxy-Authorization", enStrProxy);
int code = con.getResponseCode();
String retMsg = con.getResponseMessage();
System.out.println("code::"+code);
System.out.println("retMsg::"+retMsg);
System.getProperties().put("proxySet", "false");
System.getProperties().remove("http.proxyHost");
System.getProperties().remove("http.proxyPort");
con.disconnect();
if (code != 200){
VALID_STATUS = false;
throw new IOException("Failed to connect to CCO: "+retMsg);
}
}catch (Exception ex){
System.out.println(ex.getMessage());
throw new IOException(ex.getMessage());
}//catch
return VALID_STATUS;
}
- 7
- Hiding default console in Windows Hello. Is it possible to hide the default console window in MS-Windows
in Java? If so, how?
When writing a Swing/JFC application in Java, it would be really nice to
somehow hide the DOS window that appears.
Thanks in advance.
--
Randolf Richardson - kingpin+email***@***.com
The Lumber Cartel, local 42 (Canadian branch)
http://www.lumbercartel.ca/
- 8
- Clients are bad ?Hello John Bailo , You say :
" Open source is just about old style client software
catching of to the Web economy "
You obviously don't believe that yourself ,
otherwise you'd be using Google ... Not Moz .
- 9
- jbuilder 2005 backward compatabilityHi
I have a project that created by jbuilder X, in the "design" panel,
everything work great, but when i use jbuilder 2005 to open it, it
only display gray. Do you know why?
thanks
from Peter (email***@***.com)
- 10
- 11
- Reflection and access to type parameter?Given the SSCCE below, the need to pass A.class and B.class in
lines 25 and 25 seems redundant. However, I can find nothing in
the language that would let that be done in the constructor,
between lines 18 and 19. The obvious would be
Class<T> x = T.class;
but that of course does not work. Is there any bridge at all
between reflection and generics? I suspect the answer is no
and the code below is the best that can be done, but I'm
not sure.
1 import java.lang.reflect.Method;
2 public class TestEnums
3 {
4 public static enum A
5 {
6 V1,
7 V2;
8 }
9 public static enum B
10 {
11 X1,
12 X2,
13 X3;
14 }
15 public static class C<T extends Enum<?>>
16 {
17 public C(Class<T> x) throws Exception
18 {
19 T[] eVal = x.getEnumConstants();
20 for (Enum<?> v : eVal) System.out.println(v.toString());
21 }
22 }
23 public static void main(String[] args) throws Exception
24 {
25 C<A> ca = new C<A>(A.class);
26 C<B> cb = new C<B>(B.class);
27 }
28 }
- 12
- how to set row height at runtime in a JTableHi
i am trying to set rowheight of row in a JTable using
setRowHeight(row,rowheight)
it is not affecting on Table.but if i use setRowheight(rowheight) it
applying
entire table ,please help me to solve this problem
after setRowHeight(row,rowheight), i am calling firechanged() method
also ,i t will not affecting please hemp me
- 13
- Riddle me thisOn Mon, 07 Nov 2005 11:35:27 GMT, "Sharp Tool"
<email***@***.com> wrote, quoted or indirectly quoted someone
who said :
>All these distribution dont include negative numbers?
A normal is clustered about a mean, nominally 0, with symmetric tails
left and right.
Poisson is a distribution of positive numbers.
Just what do these numbers measure?
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
- 14
- JacOrb Multihomed serverHi everybody,
we have problems running a corba-server on a multi-homed Win2k-Box.
The machine has two network-cards. JacOrb is using the wrong IPAddress
for IOR's.
I tried the property OAIAddr. Only setting the property to 127.0.0.1
and running server and client on the same machine was successful.
Using the real address failed.
Does anyone have an advise for me ?
Thanks in advance
Ruediger
- 15
|
|
|