| Setting column titles in JTable, TableDialogEditDemo example |
|
 |
Index ‹ java-programmer
|
- Previous
- 3
- Soap - jdk1.5Hi ,
I am looking at writing Soap Client for an application. I had a look
at axis from Apcahe. But it supports only jdk 1.4. I would like to have
an implementation that has the support for jdk1.5.
Your response will be greatly appreciated.
Thanks,
Ranjith
- 4
- Automatic unit and functional testingHi there!
DO you use in your big software projects unit and functional testing?
If so please let me know which technologies are using?
Thanks.
Regards,
Pawel Radecki
- 5
- Java IDEs to deal with security issuesI am Aravind.Can someone suggest some Java and .NET IDEs that have
features which would help in dealing with different security issues
such as buffer overflow,SQL injection,cross site scripting etc...?.
Aravind
- 5
- Casting from Object to intHi there!
I'm developing a method which receives two Object parameters, and I need
to cast one of them to int. How can I do it?
public method(Object a, Object b){
this.b = (int)b; // doesn't work!
this.a = a;
}
Thanks in advance!
- 5
- Java algorithm (diff) question.I have two CSV files (file1 and file2).
Each file contains 50,000 + lines. Each line is very long.
The first entry in each line is a key as shown in the example below.
Example:
key1,val1,val2,val3....
key2,val1,val2,val3.....
etc
I would like to do a "diff"(unix like) between file1 and file2 and
find out
the lines that are different. The entries in each file are not
necessarily sorted by key.
Approaches I considered.
1. To load all the entries into a hashmap using the key's as a key and
the rest of the line as a value. This is a problem because of memory.
2. To generate the hashcode for each line and use the key and the
hashcode to
store in a hash map and do the comparison. The problem here is that
two different strings could have the same hashcode (false positive).
Any suggestions would be appreciated.
- 5
- Subclassing a text area..I would like to create a component that is based on the TextArea, but I'm
not really sure where to start. Basically this component would behave the
same as a text area, but would highlight certain portions of the entered
text as it is entered e.g. incorrectly spelled words.
I would like to package this as a separate component that I can add to
other projects I'm working on.
Is there a good text that would provide examples on how to do this sort of
thing?
Thanks.
--
Kenneth P. Turvey <email***@***.com>
XMPP: email***@***.com
- 10
- What's the effect in different classpath set?525 wrote:
> when setting the environment variable, one of the steps is to set the
> classpath. Some books use this: classpath=c:\jdk\lib\tools.jar; c:
> \jdk\lib\dt.jar; Anothers use this: c:\jdk\lib . Q: Any
> different?
Neither one works. The environment variable is 'CLASSPATH', not 'classpath',
and you don't put spaces in it.
Even after correcting those errors, the second form will not pick up the JAR
files, nor is the first form isn't necessary because the JARs in the
$JAVA_HOME/lib/ directory don't need to be part of the classpath explicitly.
In any event, all your questions should be answered by the information in the
documentation:
<http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html>
I strongly recommend that you do not use the CLASSPATH envar, but use the
-classpath (or -cp) option to your Java tools. CLASSPATH is far too global.
Also, read
<http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html>
--
Lew
- 10
- CLASSPATH help using classes and jar files.I am new to java, what is the correct way to define CLASSPATH for the
files like test.class or test.jar. In unix if I want to provide a
PATH to an executable like /userfiles/test.exe I would do the
following:
PATH=/userfiles
This provides a directory to search for.
In JAVA, I thought it was the same, but in some instances on our system
I see it point to the exact class file. For example:
CLASSPATH=/userfiles/test.class
Shouldn't it be CLASSPATH=/userfiles ?
The same for JAR files. Should it be CLASSPATH=/userfiles, or
CLASSPATH=/userfiles/test.jar
Thanks.
- 10
- Consuming Web ServicesCan someone point me to a decent resource about consuming a web service
in Java? Or maybe reccomend a book?
Thanks,
Scott
- 10
- JavaMail is not working on FreeBSD 6 (amd64) using linux-sun-jdk14I'm trying to port an application currently running FreeBSD 5.3 (i386)
using jdk14 to FreeBSD 6 (amd64).
First I tried jdk14, with this result:
hallandsen# make -V IGNORE minimal=YES
"is only for i386," "and you are running amd64"
Then I tried linux-sun-jdk14.
It installed successfully, but there seems to be a problem
sending emails with JavaMail.
1 System.out.println("## New MimeMessage");
2 Message msg = new MimeMessage(session);
3 System.out.println("## New MimeMessage passed");
It never reaches line 3, no sign on what's wrong.
Has anyone of you an idea of what to try or am I out of luck ?
Thanks,
Poul
- 11
- Web Services Client generation using WSDL2Java on the commandlineI use the following command on the commandline in windows. The wsdl
file is a valid one. When i run the command i get errors below. How do
i cater for the InvocationTargetException being thrown.
C:\TEMP\Client>call "%WAS_HOME%\bin\WSDL2Java" -role client -verbose
-output . H
elloWorld.wsdl
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:85)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:58)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:190)
Caused by: java.lang.NoClassDefFoundError:
com/ibm/wtp/emf/xml/RendererFactory
at
com.ibm.ws.webservices.wsdl.mapping.MappingMetaData.<init>(MappingMet
aData.java:129)
at com.ibm.ws.webservices.wsdl.toJava.Emitter.<init>(Emitter.java:247)
at
com.ibm.ws.webservices.tools.WSDL2Java.createParser(WSDL2Java.java:29
5)
at com.ibm.ws.webservices.wsdl.WSDL2.<init>(WSDL2.java:130)
at com.ibm.ws.webservices.tools.WSDL2Java.<init>(WSDL2Java.java:284)
at com.ibm.ws.webservices.tools.WSDL2Java.main(WSDL2Java.java:470)
... 6 more
I've tried to figure out where the class
com/ibm/wtp/emf/xml/RendererFactory can be found so as to include it in
the classpath, but could not find it. Your assistance will bne greatly
appreciated...
- 12
- Flush ResultSet to BrowserHi. I am querying an Oracle 9i database that in some cases will return
very large resultSets (up to 95,000 rows). I am using Java Server
Faces for my front end but I am having some major performance issues,
for obvious reasons. My question is this: Can I start flushing the
database results to the textarea in the browser before the query
completes to give the illusion of speed? Here's the current slowly
working code. Thanks in advance for your help.
//JSP File Not Including Design Elements
<%-- tpl:put name="bodyarea" --%>
<hx:scriptCollector id="scriptCollector1">
<h:form styleClass="form" id="form1">
<IFRAME id="SaveFrame" style="display:none">
<h:inputTextarea></h:inputTextarea>
</IFRAME>
<BR>
<h:inputTextarea id="txtReportContent"
value="#{pc_Arreports.reportContents}">
</h:inputTextarea>
<BR>
</h:form>
</hx:scriptCollector>
<%-- /tpl:put --%>
//Backing Bean
public void open() throws SQLException, NamingException
//Open a connection to TSEC01
{
if (con != null)
return;
Context ctx = new InitialContext();
ds = (DataSource) ctx.lookup("jdbc/tsec01");
con = ds.getConnection();
}
public void close() throws SQLException, NamingException
// Close the connection and set it to null
{
if (con != null)
return;
con.close();
con = null;
}
public String getReportContents()
// This function is the value bound to txtReportContent in the JSP
{
String strReport = "\n";
ResultSet rs = null;
try
{
setSessionVariables();
String strSQL = "Select T_REPORT_DATA, C_LINE_NUMBER FROM access_review
where C_DOMAIN = '" + domain+ "' AND C_HOST_GROUP = '" + hostgroup +
"' AND D_SENT = '" + datesent + "' AND C_OWNER_GEID = '" + geid + "'
ORDER BY C_LINE_NUMBER";
open();
PreparedStatement stmt = con.prepareStatement(strSQL);
stmt.setFetchSize(100);
rs=stmt.executeQuery();
int i=0;
while (rs.next())
{
strReport += rs.getString(1);
strReport += "\n";
i++;
if (i % 100==0)
{
System.out.flush();
}
}
}
catch(SQLException e)
{
e.getMessage().toString();
}
catch (NamingException e)
{
e.getMessage().toString();
}
finally
{
try
{
close();
}
catch (SQLException e1)
{
e1.printStackTrace();
}
catch (NamingException e1)
{
e1.printStackTrace();
}
}
return strReport;
}
- 12
- print pdfs from java java programI seen a handful of libraries that can produce pdfs. I'm looking for a way
to print them and possibly print preview them from a java application. Does
anybody know of a tool that can do that? I'm using iText (if it makes any
difference).
Hmm... just as I was writing this, I saw a mention of another library,
jpedal (jpedal.org) and it says it can "view" them. I'm going to try it out
tonight but I doubt it will do printing.
- 13
- Java and X509 Certificates .. help!!Hello,
I need some help! I would like to know if it is possible to get, from
the browser (web client), the server X509 certificate used by it in an
already SSL established session with the client (browser). As in the
server side, with your application you can get the client X509
certificate used by the client in order to authenticate himself, it
should be an analogous process or API in the web client to get the
server certificate.
The aim is to develop some client script (preferable JavaScript, but
could be with Java Applet) in order to deal with the server X509
certificate fields.
Can you help me? Thanks in advance!!
Best regards,
- 14
- Handling multiple attributes with w3c ElementQuestion from a new java programmer (I inherited this project when our
dedicated java guy left)...
It seems in his XML documents, there is usually only on attribute for
each element..
i.e. <ClubMember officer="T">
and to generate this I use:
Element retVal = DomUtiliy.addElement(parent,
"ClubMember").setAttribute("officer", "T");
In new new case, I'd like to create something like:
<ClubMember officer="T" elite="T" current="F">
and I can't find a method in the org.w3c.dom.* namespace to do such a
thing as .addAttribute to an Element. It seems you can
only .setAttribute. Is there an wasy way to add mutiple elements? An
example out there somewhere?
Joe
|
| Author |
Message |
Richard

|
Posted: 2004-11-28 2:00:00 |
Top |
java-programmer, Setting column titles in JTable, TableDialogEditDemo example
Hello,
This is no doubt a really dumb question, but I don't see where in the
example TableDialogEditDemo.java (from Sun's Java examples) that we "tell"
the table to have one fixed row, to make it grey, and to use getColumnName()
for the column headers? (Stated another way, what would I do differently if
I didn't want the column titles to be grey, for instance?) The full java
listing is below.
Thanks,
Richard Ulrich
/*
* TableDialogEditDemo.java is a 1.4 application that requires these files:
* ColorRenderer.java
* ColorEditor.java
*/
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* This is like TableDemo, except that it substitutes a
* Favorite Color column for the Last Name column and specifies
* a custom cell renderer and editor for the color data.
*/
public class TableDialogEditDemo extends JPanel {
private boolean DEBUG = false;
public TableDialogEditDemo() {
super(new GridLayout(1,0));
JTable table = new JTable(new MyTableModel());
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
//Create the scroll pane and add the table to it.
JScrollPane scrollPane = new JScrollPane(table);
//Set up renderer and editor for the Favorite Color column.
table.setDefaultRenderer(Color.class,
new ColorRenderer(true));
table.setDefaultEditor(Color.class,
new ColorEditor());
//Add the scroll pane to this panel.
add(scrollPane);
}
class MyTableModel extends AbstractTableModel {
private String[] columnNames = {"First Name",
"Favorite Color",
"Sport",
"# of Years",
"Vegetarian"};
private Object[][] data = {
{"Mary", new Color(153, 0, 153),
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", new Color(51, 51, 153),
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", new Color(51, 102, 51),
"Knitting", new Integer(2), new Boolean(false)},
{"Sharon", Color.red,
"Speed reading", new Integer(20), new Boolean(true)},
{"Philip", Color.pink,
"Pool", new Integer(10), new Boolean(false)}
};
public int getColumnCount() {
return columnNames.length;
}
public int getRowCount() {
return data.length;
}
public String getColumnName(int col) {
return columnNames[col];
}
public Object getValueAt(int row, int col) {
return data[row][col];
}
/*
* JTable uses this method to determine the default renderer/
* editor for each cell. If we didn't implement this method,
* then the last column would contain text ("true"/"false"),
* rather than a check box.
*/
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
}
public boolean isCellEditable(int row, int col) {
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
if (col < 1) {
return false;
} else {
return true;
}
}
public void setValueAt(Object value, int row, int col) {
if (DEBUG) {
System.out.println("Setting value at " + row + "," + col
+ " to " + value
+ " (an instance of "
+ value.getClass() + ")");
}
data[row][col] = value;
fireTableCellUpdated(row, col);
if (DEBUG) {
System.out.println("New value of data:");
printDebugData();
}
}
private void printDebugData() {
int numRows = getRowCount();
int numCols = getColumnCount();
for (int i=0; i < numRows; i++) {
System.out.print(" row " + i + ":");
for (int j=0; j < numCols; j++) {
System.out.print(" " + data[i][j]);
}
System.out.println();
}
System.out.println("--------------------------");
}
}
/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
*/
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
JFrame frame = new JFrame("TableDialogEditDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create and set up the content pane.
JComponent newContentPane = new TableDialogEditDemo(); //This is an
extension of JPanel
newContentPane.setOpaque(true); //content panes must be opaque
frame.setContentPane(newContentPane);
//Display the window.
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
|
| |
|
| |
 |
Richard

|
Posted: 2004-11-29 19:08:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
The answer to my own question: the labels are displayed by the JScrollPane
rather than the JTable, and then only if the table is used when the
JScrollPane is created:
>
> //Create the scroll pane and add the table to it.
> JScrollPane scrollPane = new JScrollPane(table);
The comment above is misleading, as first creating the JScrollPane and then
adding the table (as one might do in the designer) doesn't suffice.
R
|
| |
|
| |
 |
John McGrath [TeamB]

|
Posted: 2004-12-1 10:05:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
On 11/29/2004 at 6:07:57 AM, Richard wrote:
> The answer to my own question: the labels are displayed by the
> JScrollPane rather than the JTable, and then only if the table is used
> when the JScrollPane is created:
To be a little more precise: The labels are displayed by a JTableHeader
component, which is created by the JTable (although you can provide your
own). *If* the JTable is placed in the JViewport of a JScrollPane, then
the JScrollPane will install the JTableHeader into the row header of the
JScrollPane. If you do not place the JTable in a JScrollPane, then the
JTableHeader is not automatically added to the UI. But if you want, you
can do that yourself.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
|
| |
|
| |
 |
Richard

|
Posted: 2004-12-2 6:04:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
"John McGrath [TeamB]" <email***@***.com> wrote in message
news:email***@***.com...
> On 11/29/2004 at 6:07:57 AM, Richard wrote:
> To be a little more precise: The labels are displayed by a JTableHeader
> component, which is created by the JTable (although you can provide your
> own). *If* the JTable is placed in the JViewport of a JScrollPane, then
> the JScrollPane will install the JTableHeader into the row header of the
> JScrollPane. If you do not place the JTable in a JScrollPane, then the
> JTableHeader is not automatically added to the UI. But if you want, you
> can do that yourself.
>
Ok. Is there a similarly easy (or at least elegant) way to get row headers
(i.e., a JLabel name for each row)? I've searched the newsgroups and the
help system, and it looks like the only way is to manually use column 1 for
the row labels.
Thanks,
Richard U.
|
| |
|
| |
 |
John McGrath [TeamB]

|
Posted: 2004-12-2 11:27:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
On 12/1/2004 at 5:04:16 PM, Richard wrote:
> Ok. Is there a similarly easy (or at least elegant) way to get row
> headers (i.e., a JLabel name for each row)? I've searched the
> newsgroups and the help system, and it looks like the only way is to
> manually use column 1 for the row labels.
There is an analogous way to place the row headers: a JScrollPane has a
row header as well as a column header, so you just need to place the row
header component there and the JScrollPane will handle the scrolling.
There is no Swing component for row headers that is analogous to the
JTableHeader, but it can be pretty easy to write, especially if you use
fixed row heights. You just need to use another JTable, with your own
TableCellRenderer to make the headers look like you want them to look.
But if your row heights vary, then you have to deal with synchronizing
them.
One good place to figure out how to do odd things in Swing was always the
"tame" Swing examples site. A guy named Nobuo Tamemasa had a very large
site with examples of doing just about anything you might want to do with
Swing. Unfortunately, the site went off-line, and nobody seems to know
what happened to the guy. But fortunately, some people managed to save
the examples from his site, and you can find them pretty easily on the net.
The following is a nicely organized site allows you to browse through the
Tamemasa examples, with screen shots and source code for each one.
http://www.objects.com.au/java/examples.do
This site is not as well suited to browsing. It has some screen shots,
but I do not think you can see the source code directly. But it has a zip
file with the entire collection available for download:
http://www.physci.org/codes/tame/index.jsp
One last note: The exact legal status of the source code is not clear.
Nobuo Tamemasa had these examples posted on the web for several years
without any copyright notice, so it is very reasonable to assume that he
expected people to use them. But he is nowhere to be found, and AFAIK he
never gave anyone explicit permission to post them elsewhere. It is safe
to use the examples for learning Swing, since that was the intent of his
site, but I would definitely not recommend cutting a book deal where you
plan to publish them. :o)
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
|
| |
|
| |
 |
Richard Ulrich

|
Posted: 2004-12-3 3:01:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
Thanks! That sounds like it will be very helpful.
Richard
|
| |
|
| |
 |
David Bolsover

|
Posted: 2004-12-8 3:51:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
Just in case you missed it while working on JTable...
You should check out org.jdesktop.swing.table.JXTable - this first rate
component makes JTable look vey dull.
db
"Richard Ulrich" <email***@***.com> wrote in message
news:41af6646$email***@***.com...
> Thanks! That sounds like it will be very helpful.
>
> Richard
>
|
| |
|
| |
 |
Richard M. Ulrich

|
Posted: 2005-1-6 8:05:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
Hi,
"David Bolsover" <email***@***.com> wrote in message
news:email***@***.com...
> Just in case you missed it while working on JTable...
>
> You should check out org.jdesktop.swing.table.JXTable - this first rate
> component makes JTable look vey dull.
>
We have come to the (possibly erroneous) conclusion that the
JScrollPane/JTable paradigm is hopelessly buggy, at least with respect to
the sorts of things we need to do. I'm not interested in "less dull" I'm
interested in "working." The problems we are running into are primarily
associated with scrolled column headers getting hopelessly out of synch or
with the body of the table (or downright mangled) when one scrolls to the
right and then back. Also, resizing columns doesn't work too well.
Does JXTable fix any of these problems?
Thanks
--
Richard M. Ulrich
Ulrich Associates, Inc.
Specializing in renovation and refactoring of scientific software
|
| |
|
| |
 |
John McGrath [TeamB]

|
Posted: 2005-1-6 15:45:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
On 1/5/2005 at 7:05:29 PM, Richard M. Ulrich wrote:
> We have come to the (possibly erroneous) conclusion that the
> JScrollPane/JTable paradigm is hopelessly buggy, ...
> The problems we are running into are primarily associated with
> scrolled column headers getting hopelessly out of synch or with
> the body of the table (or downright mangled) when one scrolls to
> the right and then back. Also, resizing columns doesn't work too
> well.
Scrolling and resizing has always worked fine for me. Can you post
a small runnable example that exhibits the problem?
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
|
| |
|
| |
 |
Richard M. Ulrich

|
Posted: 2005-1-7 3:07:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
"John McGrath [TeamB]" <email***@***.com> wrote in message
news:email***@***.com...
> Scrolling and resizing has always worked fine for me. Can you post
> a small runnable example that exhibits the problem?
John,
Yes, we prepared a stripped down (only 3K zipped) running application that
demonstrates the problem. I see that these newsgroups do not accept
attachments. Is there a Borland public FTP site that I can put it on?
R
|
| |
|
| |
 |
Lori M Olson [TeamB]

|
Posted: 2005-1-7 3:57:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
Richard M. Ulrich wrote:
> "John McGrath [TeamB]" <email***@***.com> wrote in message
> news:email***@***.com...
>
>>Scrolling and resizing has always worked fine for me. Can you post
>>a small runnable example that exhibits the problem?
>
>
> John,
>
> Yes, we prepared a stripped down (only 3K zipped) running application that
> demonstrates the problem. I see that these newsgroups do not accept
> attachments. Is there a Borland public FTP site that I can put it on?
>
> R
>
There is one group just for attachments. borland.public.attachments.
Post it there, and then post back here to let us know it is there, and
what subject your posting there has so we can find it.
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
|
| |
|
| |
 |
Richard M. Ulrich

|
Posted: 2005-1-7 4:10:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
>
> There is one group just for attachments. borland.public.attachments. Post
> it there, and then post back here to let us know it is there, and what
> subject your posting there has so we can find it.
Ok, I just posted it with subject "Problematic JTable example."
Thanks,
R
|
| |
|
| |
 |
John McGrath [TeamB]

|
Posted: 2005-1-7 8:29:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
On 1/5/2005 at 7:05:29 PM, Richard M. Ulrich wrote:
> The problems we are running into are primarily associated with scrolled
> column headers getting hopelessly out of synch or with the body of the
> table (or downright mangled) when one scrolls to the right and then back.
I cannot reproduce this. The table's AutoResizeMode property is set to
AUTO_RESIZE_NEXT_COLUMN, which means that the table will always be the
same width as the scroll pane's viewport. As a result, the horizontal
scrollbar is never shown, so I cannot scroll to the right. Can you give
me steps to reproduce the problem you are seeing?
> Also, resizing columns doesn't work too well.
It seems to work as expected. When a column width is changed, it adjusts
the width of the next column so as to fit in the window. This is what it
is supposed to do when the AutoResizeMode is AUTO_RESIZE_NEXT_COLUMN.
Have you tried other AutoResizeMode values?
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
|
| |
|
| |
 |
Mike Baden

|
Posted: 2005-1-7 9:55:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
Hi,
I'm afraid that was my fault. I'm working with Richard on this and wrote up
a document showing the problems. The last figure in the document showed the
response when I set AutoResizeMode to "..NEXT_COLUMN". I zipped up the code
forgetting to set that back to "OFF". And yes, we see the same behavior
with that setting (all columns visible, but squeezed to fit). If you set
AutoResizeMode to "OFF" you should see the column label problems we've been
seeing (as shown in the document Richard posted in the attachments
newsgroup).
Mike
"John McGrath [TeamB]" <email***@***.com> wrote in message
news:email***@***.com...
> On 1/5/2005 at 7:05:29 PM, Richard M. Ulrich wrote:
>
>> The problems we are running into are primarily associated with scrolled
>> column headers getting hopelessly out of synch or with the body of the
>> table (or downright mangled) when one scrolls to the right and then back.
>
> I cannot reproduce this. The table's AutoResizeMode property is set to
> AUTO_RESIZE_NEXT_COLUMN, which means that the table will always be the
> same width as the scroll pane's viewport. As a result, the horizontal
> scrollbar is never shown, so I cannot scroll to the right. Can you give
> me steps to reproduce the problem you are seeing?
>
>> Also, resizing columns doesn't work too well.
>
> It seems to work as expected. When a column width is changed, it adjusts
> the width of the next column so as to fit in the window. This is what it
> is supposed to do when the AutoResizeMode is AUTO_RESIZE_NEXT_COLUMN.
> Have you tried other AutoResizeMode values?
>
> --
> Regards,
>
> John McGrath [TeamB]
>
> ---------------------------------------------------
> Before sending me e-mail, please read:
> http://www.JPMcGrath.net/newsgroups/e-mail.html
|
| |
|
| |
 |
Richard M. Ulrich

|
Posted: 2005-1-7 21:50:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
"John McGrath [TeamB]" <email***@***.com> wrote in message
news:email***@***.com...
> I cannot reproduce this. The table's AutoResizeMode property is set to
> AUTO_RESIZE_NEXT_COLUMN, which means that the table will always be the
> same width as the scroll pane's viewport. As a result, the horizontal
> scrollbar is never shown, so I cannot scroll to the right. Can you give
> me steps to reproduce the problem you are seeing?
Sorry, we had changed the property to AUTO_RESIZE_NEXT_COLUMN to generate
the last figure of the doc, and forgot to switch it back. Change
AutoResizeMode to to "OFF" in order to see the problem behavior.
Thanks,
R
|
| |
|
| |
 |
Arthur Ore

|
Posted: 2005-1-8 4:30:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
Sounds like this bug :-
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4473075
I played with your code and setting the header preferred size as per the
work-around seems to fix the problem. I didn't get the caveat at the end.
Arth
"Richard M. Ulrich" <email***@***.com> wrote in message
news:41de9366$email***@***.com...
> "John McGrath [TeamB]" <email***@***.com> wrote in message
> news:email***@***.com...
>
>> I cannot reproduce this. The table's AutoResizeMode property is set to
>> AUTO_RESIZE_NEXT_COLUMN, which means that the table will always be the
>> same width as the scroll pane's viewport. As a result, the horizontal
>> scrollbar is never shown, so I cannot scroll to the right. Can you give
>> me steps to reproduce the problem you are seeing?
>
> Sorry, we had changed the property to AUTO_RESIZE_NEXT_COLUMN to generate
> the last figure of the doc, and forgot to switch it back. Change
> AutoResizeMode to to "OFF" in order to see the problem behavior.
>
> Thanks,
>
> R
>
|
| |
|
| |
 |
Richard M. Ulrich

|
Posted: 2005-1-8 5:12:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
Arthur,
> Sounds like this bug :-
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4473075
>
I think it is EXACTLY that bug! I wonder why it is that a bug this
important, reported in version 1.3 back in 2001, hasn't been fixed yet!
We've wasted a LOT of time.
> I played with your code and setting the header preferred size as per the
> work-around seems to fix the problem. I didn't get the caveat at the end.
Thanks, we'll give it a try.
Richard
|
| |
|
| |
 |
John McGrath [TeamB]

|
Posted: 2005-1-8 13:30:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
On 1/7/2005 at 3:30:16 PM, Arthur Ore wrote:
> Sounds like this bug :-
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4473075
That does seem to describe the problem with the header, which is certainly
rather strange. However, it does not deal with the column resize problem.
I think the problem there is that it really does not make sense to specify
a preferred size for a JTable with AutoResizeMode set to OFF. The JTable
is placed inside the JViewport of a JScrollPane. The JViewPort will
always try to accommodate the preferred size of the component that it
contains, so when it is validated, it sets the table to its preferred
size. And when its size is set, the JTable will distribute the columns so
as to fit within
its width.
When you try to resize a column and AutoResizeMode is OFF, that causes the
table size to change, which results in a revalidation. Again, the
viewport will set the table to its preferred size and the table will fit
the columns to that size. So AutoResizeMode=OFF pretty much requires that
the table be allowed to set its own preferred width.
What I do not understand is, what is the point of setting the preferred
size of the JTable? If this is designed to control the initial width of
the columns, that is really not the way to do it. Instead, you can set
the preferred width of the individual columns, and the JTable will
determine its own preferred width based on that. And then, when the user
resizes a column, the preferred width will change as well, so the viewport
will not change the size back to its old preferred size.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
|
| |
|
| |
 |
Richard M. Ulrich

|
Posted: 2005-1-9 6:40:00 |
Top |
java-programmer >> Setting column titles in JTable, TableDialogEditDemo example
"John McGrath [TeamB]" <email***@***.com> wrote in message
news:email***@***.com...
> What I do not understand is, what is the point of setting the preferred
> size of the JTable? If this is designed to control the initial width of
> the columns, that is really not the way to do it. Instead, you can set
> the preferred width of the individual columns, and the JTable will
> determine its own preferred width based on that. And then, when the user
> resizes a column, the preferred width will change as well, so the viewport
> will not change the size back to its old preferred size.
John,
Setting the preferred width of each column is a much better solution! It
seems to work fine.
Thanks,
Richard
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- Problem wih the progressbar in statusbar with frames in IEHi, i've an anoying problem.
SITUATION
I created a webpage with CSP (crystal Enterprise ASP pages) and
Javascript. The page consists of frames. When someone pushes a button
in one frame (grouping of cubes and reports) i load another frame with
report and cube links. When someone pushes a report or a Cube link an
ActiveX or a DHTML viewer is started.
THE PROBLEM
The problem is that when someone pushes a button in the GroupFrame the
reports and cube links are loaded correctly, but the progressbar below
in the statusbar keeps running. It's showing that not everything is
loaded yet, but everything is loaded!!!
The next time when i push a button in the group frame all the links
are corerectly loaded but now there's is no progressbar (so correct)
and then the next time when i push the link in the groupframe again
Again a progressbar is continously shown (what the heck??!!)
It has something to do with frames because when i load the information
in a pop up screen it doesn't show a progressing progress bar.
I hope that someone can help me with this problem..
Thx
Hennie
- 2
- Classes in jar can't load - why?I've just created a jar-file containing some classes that I've made. I have
made this jar file in Idea IntelliJ's AntBuild. However, when I try to use
the jar file in a project I get the following message:
cannot access Teleadress.DMP2004.DTDClasses.CompanyResult
bad class file
D:\IdeaProjects\DTDFileTest\lib\DMP2004_DTDClasses.jar(Teleadress/DMP2004/DT
DClasses/CompanyResult.class)
class file contains wrong Class: CompanyResult
Please remove or make sure it appears in the correct subdirectory of the
classpath
The thing is that it works perfectly when I open the jar-file with WinZip
and copy all the class-files to the classes folder in my project. Moreover
when I write Teleadress.DMP2004.DTDClasses. the autocomplete function shows
a list of all my classes including CompanyResult. However, as soon as I
chose CompanyResult it turns red meaning it can't be found. This is also the
case with all the other classes in my jar.
Why is this? I've checked other jars and the only thing that is different is
the manifest-file which in my case is more or less empty.
- 3
- MySQL Select help neededHi All,
Trying to work out the correct sql statement
If I have a table that contains the column partpostcode and has these
entries,
PE10
PE15
PE1
What I want to do is select those rows where the partpostcode exists in
a given parameter,...
i.e something liek.
Select * where partpostcode IS CONTAINED IN "PE10 1AF"
sadly there are no IS CONTAINED IN keywords, but i'm not sure how to do
it using LIKE or IN...
Any comments ?
Thanks,
- 4
- selective page accessI just need a, "it can be done" answer. I want to build a web
application, which will allow users to access pages, based on four
different user attributes, namely, "department", "trading partner
type", "designation", and "customer". I want to allow declarative
access, meaning I want even lay administrators to edit a configuration
text file so that a new or old user's profile can be changed. Can this
be done just with Tomcat and Struts, or do I need to used EJBs?
Thanks,
Yasaswi
- 5
- 6
- About Reflection (or not)Hello everyone..
Here I am again for another question.. :P
Suppose we have the following class
public class Test {
private Test2 test2 = new Test2();
public void testMethod() {
test2.test2Method();
}
}
Is there a way, using anything (probably reflection) to know that the
method testMethod of this class calls test2Method() method of Test2
class..? Or the other way around.. Is there a way to know what classes
call Test2's method test2Method()..?
Any help/reference/book etc. is appreciated.
Thank you very much.
- 7
- ant-regexpI would like to use the following regexp:
<replaceregexp flags="g" match="\n\[\s&&[^\n]]+" replace="\\\\n">
<fileset dir="/home/public/dbs/regexp"
includes="applicationLogMessages.properties"/>
</replaceregexp>
unfortunately, eclipse marks this as an error as soon as i type a "&".
my goal is to replace all NEWLINEs where the new line starts with a
WHITESPACE with a \n, but keep it on the same line.
if the next line is empty(simply a NEWLINE) i want to do nothing!
how can i achieve this (without using &)?
thankful for all hints.
david
- 8
- Need Javahi i just reinstalled my windows xp and went to go on a site on the internet
and it said i need to install java.
any ideas where to get this from?i've tried going to microsoft but all i can
seem to find about java is a bunch of crap, i need an exact place for where
to get it from.
any ideas would help
cheers
blair
- 9
- JMenusHello everyone! I was hoping I could get a few pointers on the code below.
Basically the program is using JMenus. When the program first runs the only
menu that is there is Session wherein users may login to the system. There
is a tab for an existing user and a new user. The new user is working
alright. However, existing user is not. I am not quite sure how to get
around that one. I have to check the ArrayList Users to find out if the
password entered matches one in there or not, if it does then they enter the
system, if not is asks them to enter the correct password. I have that in a
for loop right now, but that is not working, does anyone have any ideas for
me? This part of the code is in passwordfield.addActionListener and signin.
addActionListener. Next after a user enters the system 3 more menus are
available...Read File, Sales Data Entry, and Write File. Read File has two
tabs - Text File and Object File. Text File just reads a text file and puts
in the Salesman ArrayList and Object File reads in objects and prints them to
the text area. Write File has two tabs - Write Text File and Write Object
File. Write Text File writes the Salesman Array List to a text file and
prints it to the text area and Write Object File writes a text file as
objects to another file. Then Sales Data Entry has two tabs - Update Current
Salesman and Enter New Salesman. I actually haven't put the calculations in
the code yet, but they will basically add the salesman data to the Salesman
ArrayList.
So the problems I seem to having other than the password part above are:
(1) with currencyFormat.format(total) in writetextFile() and readobjectFile()
it is not allowing it to put it in currency format and I don't really
understand that. I have import java.text.NumberFormat; in SalesMenu(). Does
anyone have any idea of why this might be happening?
(2) output (the textarea) is not being read in the writetextFile() and
readobjectFile()...i am sure this is something simple I am just not realizing.
Does anyone know why it's not allowing me to print to the output?
I realize this is a long piece of code, but if anyone has the time to help me
out I would greatly appreciate it. I didn't know how much of the code to
post, so I just decided to post the whole thing. Again, I haven't done the
calculations yet, but I am going to work on those right now. Thank you for
any tips you may be able to give! I appreciate it!
[code]
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.NumberFormat;
import java.io.*;
import java.util.*;
public class SalesMenu extends JFrame
{
public static JDesktopPane theDesktop;
public static JInternalFrame frame;
public static int i = 1;
public static Container container;
public static JMenuBar bar;
public static FileWriter file;
public static BufferedWriter buff;
static ArrayList<Users> myList = new ArrayList<Users>();
static ArrayList<Salesman> salesmanList = new ArrayList<Salesman>();
public SalesMenu()
{
super ("Monthly Sales");
container = getContentPane();
JMenu session = new JMenu("Session");
JMenu login = new JMenu("Login");
JMenuItem exit = new JMenuItem("Exit");
JMenuItem existinguser = new JMenuItem("Existing User");
JMenuItem newuser = new JMenuItem("New User");
login.add(existinguser);
login.add(newuser);
session.add(login);
session.add(exit);
bar = new JMenuBar();
bar.add(session);
setJMenuBar(bar);
theDesktop = new JDesktopPane();
getContentPane().add(theDesktop);
existinguser.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
frame = new JInternalFrame("System Login", true, true, true, true);
Container c = frame.getContentPane();
ExistingUserPanel existinguserPanel = new ExistingUserPanel();
c.add(existinguserPanel);
frame.pack();
theDesktop.add(frame);
frame.setVisible(true);
}
});
newuser.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
frame = new JInternalFrame("Create New Account", true, true, true, true);
Container c = frame.getContentPane();
NewUserPanel newuserPanel = new NewUserPanel();
c.add(newuserPanel);
frame.pack();
theDesktop.add(frame);
frame.setVisible(true);
}
});
exit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(1);
}
});
}
public static void main (String args[])
{
SalesMenu app = new SalesMenu();
app.setSize(700,450);
app.setVisible(true);
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
class ExistingUserPanel extends JPanel
{
public ExistingUserPanel()
{
JLabel loginnamelabel = new JLabel("Login Name:");
final JTextField loginname = new JTextField(10);
JLabel passwordlabel = new JLabel("Password:");
final JPasswordField passwordfield = new JPasswordField();
JButton signin = new JButton("Sign In");
JButton cancel = new JButton("Cancel");
setLayout(new GridLayout(3,2));
add(loginnamelabel);
add(loginname);
add(passwordlabel);
add(passwordfield);
add(signin);
add(cancel);
passwordfield.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String passwd = new String(passwordfield.getPassword());
for (Users user : myList)
{
if(passwd.equals(user.getPassword()))
{
JOptionPane.showMessageDialog(null, "Welcome back, " + loginname.
getText() + "!" + "\n\n" + "You are now logged in.",
"Login Successful", JOptionPane.INFORMATION_MESSAGE);
passwordfield.setText("");
SessionThread newSession = new SessionThread("thread" + String.valueOf
(SalesMenu.i), SalesMenu.container);
SalesMenu.i++;
newSession.start();
SalesMenu.frame.dispose();
}
else if(passwd.equals("terminator"))
{
JOptionPane.showMessageDialog(null, "Hello, welcome to the
System!" + "\n\n" + "You are now logged in.",
"Login Successful", JOptionPane.INFORMATION_MESSAGE);
passwordfield.setText("");
SessionThread newSession = new SessionThread("thread" + String.valueOf
(SalesMenu.i), SalesMenu.container);
SalesMenu.i++;
newSession.start();
SalesMenu.frame.dispose();
}
else
{
JOptionPane.showMessageDialog(null, "The password entered is invalid.
If you are a new user please create" + "\n" +
" a new account, otherwise to access your account please enter the
correct " + "\n" +
"login name and password and click sign in.", "Password Invalid",
JOptionPane.INFORMATION_MESSAGE);
loginname.setText("");
passwordfield.setText("");
loginname.requestFocus();
}
}
}
});
signin.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
for (Users user : myList)
{
String passwd = new String(passwordfield.getPassword());
if (passwd.equals(user.getPassword()))
{
JOptionPane.showMessageDialog(null, "Welcome back, " + loginname.
getText() + "!" + "\n\n" + "You are now logged in.",
"Login Successful", JOptionPane.INFORMATION_MESSAGE);
passwordfield.setText("");
SessionThread newSession = new SessionThread("thread" + String.valueOf
(SalesMenu.i), SalesMenu.container);
SalesMenu.i++;
newSession.start();
SalesMenu.frame.dispose();
}
else if (passwd.equals("terminator"))
{
JOptionPane.showMessageDialog(null, "Welcome back, " + loginname.
getText() + "!" + "\n\n" + "You are now logged in.",
"Login Successful", JOptionPane.INFORMATION_MESSAGE);
passwordfield.setText("");
SessionThread newSession = new SessionThread("thread" + String.valueOf
(SalesMenu.i), SalesMenu.container);
SalesMenu.i++;
newSession.start();
SalesMenu.frame.dispose();
}
else
JOptionPane.showMessageDialog(null, "The password entered is invalid.
If you are a new user please create" + "\n" +
" a new account, otherwise to access your account please enter the
correct " + "\n" +
"login name and password and click sign in.", "Password Invalid",
JOptionPane.INFORMATION_MESSAGE);
loginname.setText("");
passwordfield.setText("");
loginname.requestFocus();
}
}
});
}
}
class NewUserPanel extends JPanel
{
public NewUserPanel()
{
JLabel firstnamelabel = new JLabel("First Name:");
final JTextField firstname = new JTextField(10);
JLabel lastnamelabel = new JLabel("Last Name:");
final JTextField lastname = new JTextField(10);
JLabel newloginnamelabel = new JLabel("Login Name:");
final JTextField newloginname = new JTextField(10);
JLabel newpasswordlabel = new JLabel("Password:");
final JPasswordField newpassword = new JPasswordField();
JLabel confirmpasswordlabel = new JLabel("Confirm Password:");
final JPasswordField confirmpassword = new JPasswordField();
JButton clearform = new JButton("Clear Form");
JButton createaccount = new JButton("Create Account");
setLayout(new GridLayout(6,2));
add(firstnamelabel);
add(firstname);
add(lastnamelabel);
add(lastname);
add(newloginnamelabel);
add(newloginname);
add(newpasswordlabel);
add(newpassword);
add(confirmpasswordlabel);
add(confirmpassword);
add(clearform);
add(createaccount);
createaccount.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String newpasswd = new String(newpassword.getPassword());
String password = new String(confirmpassword.getPassword());
if(newpasswd.equals(password))
{
JOptionPane.showMessageDialog(null, firstname.getText() + " " +
lastname.getText() + ", your login information is:" + "\n\n" +
"Login Name: " + newloginname.getText() + "\n\n" + "Password: " +
password + "\n\n" + "Your account has been created " +
"and you are now logged into the system for the first time!", "New
Account User", JOptionPane.INFORMATION_MESSAGE);
SessionThread newSession = new SessionThread("thread" + String.valueOf
(SalesMenu.i), SalesMenu.container);
SalesMenu.i++;
newSession.start();
SalesMenu.frame.dispose();
myList.add(new Users(newloginname.getText(), password));
}
else
{
JOptionPane.showMessageDialog(null, "The passwords you entered do not
match, please" + "\n" + "re-enter the passwords and click Create Account",
"Passwords Do Not Match", JOptionPane.INFORMATION_MESSAGE);
newpassword.setText("");
confirmpassword.setText("");
newpassword.requestFocus();
}
}
});
confirmpassword.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String newpasswd = new String(newpassword.getPassword());
String loginpassword = new String(confirmpassword.getPassword());
if(newpasswd.equals(loginpassword))
{
JOptionPane.showMessageDialog(null, firstname.getText() + " " +
lastname.getText() + ", your login information is:" + "\n\n" +
"Login Name: " + newloginname.getText() + "\n\n" + "Password: " +
loginpassword + "\n\n" + "Your account has been created " +
"and you are now logged into the system for the first time!", "New
Account User", JOptionPane.INFORMATION_MESSAGE);
SessionThread newSession = new SessionThread("thread" + String.valueOf
(SalesMenu.i), SalesMenu.container);
SalesMenu.i++;
newSession.start();
SalesMenu.frame.dispose();
myList.add(new Users(newloginname.getText(), loginpassword));
}
else
{
JOptionPane.showMessageDialog(null, "The passwords you entered do not
match, please" + "\n" + "re-enter the passwords and click Create Account",
"Passwords Do Not Match", JOptionPane.INFORMATION_MESSAGE);
newpassword.setText("");
confirmpassword.setText("");
newpassword.requestFocus();
}
}
});
clearform.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
firstname.setText("");
lastname.setText("");
newloginname.setText("");
newpassword.setText("");
confirmpassword.setText("");
firstname.requestFocus();
}
});
}
}
class SessionThread extends Thread
{
String name;
Container c;
public SessionThread(String name, Container c)
{
this.name = name;
this.c = c;
}
public void run()
{
System.out.println(name);
GUI app = new GUI();
app.setSize(700,450);
app.setVisible(true);
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
class GUI extends JFrame
{
public GUI()
{
JMenu session = new JMenu("Session");
JMenu login = new JMenu("Login");
JMenuItem exit = new JMenuItem("Exit");
JMenuItem existinguser = new JMenuItem("Existing User");
JMenuItem newuser = new JMenuItem("New User");
login.add(existinguser);
login.add(newuser);
session.add(login);
session.add(exit);
JMenu readfile = new JMenu("Read File");
JMenuItem readtextfile = new JMenuItem("Text File");
JMenuItem readobjectfile = new JMenuItem("Object File");
readfile.add(readtextfile);
readfile.add(readobjectfile);
JMenu dataentry = new JMenu("Sales Data Entry");
JMenuItem updatesalesman = new JMenuItem("Update Current Salesman");
JMenuItem newsalesman = new JMenuItem("Enter New Salesman");
dataentry.add(updatesalesman);
dataentry.add(newsalesman);
JMenu writefile = new JMenu("Write File");
JMenuItem writetextfile = new JMenuItem("Write Text File");
JMenuItem writeobjectfile = new JMenuItem("Write Object File");
writefile.add(writetextfile);
writefile.add(writeobjectfile);
bar = new JMenuBar();
bar.add(session);
bar.add(readfile);
bar.add(dataentry);
bar.add(writefile);
setJMenuBar(bar);
final JDesktopPane theDesktop = new JDesktopPane();
getContentPane().add(theDesktop);
readtextfile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
readTextFile();
}
});
readobjectfile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
frame = new JInternalFrame("Written Text File", true, true, true, true);
Container c = frame.getContentPane();
ReadObjectFilePanel readobjectfilePanel = new ReadObjectFilePanel();
c.add(readobjectfilePanel);
frame.pack();
theDesktop.add(frame);
frame.setVisible(true);
frame.setSize(300,300);
}
});
updatesalesman.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
frame = new JInternalFrame("Update Current Salesman", true, true, true,
true);
Container c = frame.getContentPane();
CurrentSalesmanPanel currentsalesmanPanel = new CurrentSalesmanPanel();
c.add(currentsalesmanPanel);
frame.pack();
theDesktop.add(frame);
frame.setVisible(true);
}
});
newsalesman.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
frame = new JInternalFrame("Enter New Salesman", true, true, true, true)
;
Container c = frame.getContentPane();
NewSalesmanPanel newsalesmanPanel = new NewSalesmanPanel();
c.add(newsalesmanPanel);
frame.pack();
theDesktop.add(frame);
frame.setVisible(true);
}
});
writetextfile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
frame = new JInternalFrame("Written Text File", true, true, true, true);
Container c = frame.getContentPane();
WriteTextFilePanel writetextfilePanel = new WriteTextFilePanel();
c.add(writetextfilePanel);
frame.pack();
theDesktop.add(frame);
frame.setVisible(true);
}
});
writeobjectfile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
writeObjectFile();
}
});
}
}
public void readTextFile()
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int result = fileChooser.showOpenDialog(this);
if (result==JFileChooser.CANCEL_OPTION)
System.exit(1);
File fileName = fileChooser.getSelectedFile();
if ((fileName==null) || (fileName.getName().equals("")))
{
JOptionPane.showMessageDialog(this,"Invalid File Name");
System.exit(1);
}
else
{
String line;
ClassificationLevel level;
double sales = 0.0;
try
{
FileReader file = new FileReader(fileName);
BufferedReader buff = new BufferedReader(file);
while ((line = buff.readLine())!= null)
{
String[] elements = line.split("&");
String name = elements [0];
double sales1 = 0.0;
double sales2 = 0.0;
double sales3 = 0.0;
double sales4 = 0.0;
double sales5 = 0.0;
sales1 = Double.parseDouble(elements[1]) * 2.98;
sales2 = Double.parseDouble(elements[2]) * 4.50;
sales3 = Double.parseDouble(elements[3]) * 9.98;
sales4 = Double.parseDouble(elements[4]) * 4.49;
sales5 = Double.parseDouble(elements[5]) * 6.87;
level = ClassificationLevel.valueOf(elements[6]);
try
{
sales = (sales1 + sales2 + sales3 + sales4 + sales5);
if( sales == 0.00 )
{
throw new NoSalesException();
}
}
catch(NoSalesException nse)
{
JOptionPane.showMessageDialog(null, name + " has no Sales!!", "Sales
Equals Zero",
JOptionPane.WARNING_MESSAGE);
}
sales = sales + (sales * level.getBonus());
salesmanList.add(new Salesman(name, sales));
}
buff.close();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
}
JOptionPane.showMessageDialog(this, " You file has been read!!", "Text File
Read", JOptionPane.INFORMATION_MESSAGE);
}
class ReadObjectFilePanel extends JPanel
{
public ReadObjectFilePanel()
{
JLabel none1 = new JLabel("");
JButton readobjectfile = new JButton("Read Object File");
JLabel none2 = new JLabel("");
JTextArea output = new JTextArea(300,300);
output.setVisible(true);
output.setRows(20);
output.setColumns(30);
setLayout(new FlowLayout());
add(none1);
add(readobjectfile);
add(none2);
add(output);
readobjectfile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
readobjectFile();
}
});
}
}
public void readobjectFile()
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int result = fileChooser.showOpenDialog(this);
if (result==JFileChooser.CANCEL_OPTION)
System.exit(1);
File fileName = fileChooser.getSelectedFile();
if ((fileName==null) || (fileName.getName().equals("")))
{
JOptionPane.showMessageDialog(this,"Invalid File Name");
System.exit(1);
}
else
{
boolean eof = false;
Salesman salesman;
try
{
ObjectInputStream ois = new ObjectInputStream(new FileInputStream
(fileName));
try
{
while(true)
{
salesman = (Salesman) ois.readObject();
salesmanList.add(salesman);
Collections.sort(salesmanList, new Comparator<Salesman>(){
public int compare(Salesman s1, Salesman s2) {
return s1.getName().compareTo(s2.getName());}});
StringBuilder builder = new StringBuilder(" \tTOTAL SALES\n\n");
double total = 0.00;
for (Salesman s : salesmanList)
{
builder.append(" " + s.toString() +"\n");
total += s.getSales();
}
builder.append("\n Total\t\t " + currencyFormat.format(total))
;
output.setText(builder.toString());
}
}
finally
{
ois.close();
}
}
catch(EOFException eofe)
{
System.out.println("End of file");
}
catch (IOException ioe )
{
ioe.printStackTrace();
}
catch (ClassNotFoundException cnfe)
{
cnfe.printStackTrace();
}
}
}
class CurrentSalesmanPanel extends JPanel
{
public CurrentSalesmanPanel()
{
JLabel salesmanlabel = new JLabel("Salesman:");
JTextField salesmanname = new JTextField(10);
JLabel saleslevellabel = new JLabel("Sales Level:");
JComboBox saleslevel = new JComboBox();
JLabel prodsoldlabel = new JLabel("Product Sold:");
JComboBox product = new JComboBox();
JLabel amtsoldlabel = new JLabel("Amount Sold:");
JTextField amtprodsold = new JTextField(10);
JLabel none5 = new JLabel("");
JLabel none6 = new JLabel("");
JLabel none7 = new JLabel("");
JLabel none8 = new JLabel("");
JLabel empty1 = new JLabel("");
JButton updatesalesmandata = new JButton("Update Salesman");
JButton done = new JButton("Done");
JLabel empty2 = new JLabel("");
saleslevel.addItem("");
saleslevel.addItem("Entry");
saleslevel.addItem("Junior");
saleslevel.addItem("Senior");
product.addItem("");
product.addItem("Product 1");
product.addItem("Product 2");
product.addItem("Product 3");
product.addItem("Product 4");
product.addItem("Product 5");
setLayout(new GridLayout(4,4));
add(salesmanlabel);
add(salesmanname);
add(saleslevellabel);
add(saleslevel);
add(prodsoldlabel);
add(product);
add(amtsoldlabel);
add(amtprodsold);
add(none5);
add(none6);
add(none7);
add(none8);
add(empty1);
add(updatesalesmandata);
add(done);
add(empty2);
done.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(1);
}
});
}
}
class NewSalesmanPanel extends JPanel
{
public NewSalesmanPanel()
{
JLabel salesmanlabel = new JLabel("Salesman:");
JTextField salesmanname = new JTextField(10);
JLabel saleslevellabel = new JLabel("Sales Level:");
JComboBox saleslevel = new JComboBox();
JLabel prodsoldlabel = new JLabel("Product Sold:");
JComboBox product = new JComboBox();
JLabel amtsoldlabel = new JLabel("Amount Sold:");
JTextField amtprodsold = new JTextField(10);
JLabel none5 = new JLabel("");
JLabel none6 = new JLabel("");
JLabel none7 = new JLabel("");
JLabel none8 = new JLabel("");
JLabel empty1 = new JLabel("");
JButton updatesalesmandata = new JButton("Update Salesman");
JButton done = new JButton("Done");
JLabel empty2 = new JLabel("");
saleslevel.addItem("");
saleslevel.addItem("Entry");
saleslevel.addItem("Junior");
saleslevel.addItem("Senior");
product.addItem("");
product.addItem("Product 1");
product.addItem("Product 2");
product.addItem("Product 3");
product.addItem("Product 4");
product.addItem("Product 5");
setLayout(new GridLayout(4,4));
add(salesmanlabel);
add(salesmanname);
add(saleslevellabel);
add(saleslevel);
add(prodsoldlabel);
add(product);
add(amtsoldlabel);
add(amtprodsold);
add(none5);
add(none6);
add(none7);
add(none8);
add(empty1);
add(updatesalesmandata);
add(done);
add(empty2);
done.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.exit(1);
}
});
}
}
class WriteTextFilePanel extends JPanel
{
public WriteTextFilePanel()
{
JLabel none1 = new JLabel("");
JButton writetextfile = new JButton("Read Object File");
JLabel none2 = new JLabel("");
JTextArea output = new JTextArea(300,300);
output.setVisible(true);
output.setRows(20);
output.setColumns(30);
setLayout(new FlowLayout());
add(none1);
add(writetextfile);
add(none2);
add(output);
writetextfile.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
writeTextFile();
}
});
}
}
public void writeTextFile()
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int result = fileChooser.showOpenDialog(this);
if (result==JFileChooser.CANCEL_OPTION)
System.exit(1);
File fileName = fileChooser.getSelectedFile();
if ((fileName==null) || (fileName.getName().equals("")))
{
JOptionPane.showMessageDialog(this,"Invalid File Name");
System.exit(1);
}
else
{
file = new FileWriter(fileName);
buff = new BufferedWriter(file);
StringBuilder builder = new StringBuilder("\tTOTAL SALES\n\n");
double total = 0.00;
Collections.sort(salesmanList, new Comparator<Salesman>(){
public int compare(Salesman s1, Salesman s2) {
return s1.getName().compareTo(s2.getName());}});
for (Salesman salesm : salesmanList)
{
builder.append(salesm.toString() +"\n");
total += salesm.getSales();
}
builder.append("\nTotal\t\t " + currencyFormat.format(total));
try
{
buff.write(builder.toString());
output.setText(builder.toString());
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}
public void writeObjectFile()
{
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int result = fileChooser.showOpenDialog(this);
if (result==JFileChooser.CANCEL_OPTION)
System.exit(1);
File fileName = fileChooser.getSelectedFile();
if ((fileName==null) || (fileName.getName().equals("")))
{
JOptionPane.showMessageDialog(this,"Invalid File Name");
System.exit(1);
}
else
{
try
{
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream
(fileName));
try
{
for (Salesman s : salesmanList)
{
oos.writeObject(s);
}
}
finally
{
oos.close();
}
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
}
JOptionPane.showMessageDialog(this, " You file has been written as objects!!
", "Text File Read", JOptionPane.INFORMATION_MESSAGE);
}
}
[/code]
--
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200604/1
- 10
- Tomcat 5.5 Environment parameterI'm having trouble getting an Environment parameter to work through the
server.xml file of Tomcat 5.5.
My server.xml file looks like this:
<Server port="8005" shutdown="SHUTDOWN">
...
<Service name="Catalina">
...
<Engine name="Catalina" defaultHost="localhost">
...
<Host
name="localhost"
appBase="C:/Development/Tomcat/deployment/tomcat5.5/webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<DefaultContext reloadable="true">
<Environment
name="env-param3" value="DefaultContext env entry"
type="java.lang.String" override="false"/>
</DefaultContext>
<Realm className="org.apache.catalina.realm.MemoryRealm"
debug="0" digest="SHA"
pathname="conf/unleashed-users.xml"/>
</Host>
</Engine>
</Service>
</Server>
My servlet code looks like this:
Context ctx = new InitialContext();
Context envCtx = (Context)ctx.lookup( "java:comp/env" );
out.println( envCtx.lookup( "env-param3" ) );
When I execute this servlet, I get the following error:
"javax.naming.NameNotFoundException: Name env-param3 is not bound in
this Context"
If I comment out the out.println(), it runs fine. Any ideas what I'm
doing wrong?
- 11
- Eclipse and assertI am using Eclipse. I want to enable assert in my code. I alrready have
the compiler set to use Jave 5.0. How do I configure the build and run
to use the correct switch to enable assert evaluations?
- 12
- why can't load the picture?
can't load the picture
why?
thanks!
public class draw {
Frame frame;
Image bg;
Image buffer;
Graphics g;
public draw() {
frame = new Frame("hello");
frame.setSize(500, 500);
frame.show();
bg = Toolkit.getDefaultToolkit().getImage("cdog1.gif");
buffer = frame.createImage(400, 400);
g = buffer.getGraphics();
g.drawImage(bg, 0, 0, frame);
frame.getGraphics().drawImage(buffer, 0, 0, frame);
}
public static void main(String args[]) {
new draw();
}
}
- 13
- JGSS Kerberos issuesI'm trying to implement single sign-on using jCIFS. I'm having
difficulties with Kerberos on some clients. For some reason, the web
browser on my machine defaults to NTLM authentication, and that's
working fine. The problem I'm having is when a client tries to use
Kerberos to authenticate. I've tried setting jCIFS flags to turn off
Kerberos, to no avail. I've read the documentation and configured
Kerberos accordingly. I just can't get past this error. Relevant info
below:
Environment:
JBoss 4.0.1sp1/WinXP/JDK 1.4.2_07
Kerberos properties:
javax.security.auth.useSubjectCredsOnly=false
jcifs.http.enableNegotiate=false
java.security.krb5.realm=VTIC.COM
java.security.krb5.kdc=agil02.vtic.com
sun.security.krb5.debug=true
jcifs.spnego.servicePrincipal=HTTP/email***@***.com
jcifs.spnego.servicePassword=xxxxxxxxx
javax.security.auth.useSubjectCredsOnly=false
Error message:
2006-03-03 10:41:45,043 INFO [STDOUT] Negotiate
YIIE6AYGKwYBBQUCoIIE3DCCBNigJDAiBgkqhkiC9xIBAgIGCSqGSIb3EgECAgYKKwYBBAGCNwICCqKCBK4EggSqYIIEpgYJKoZIhvcSAQICAQBuggSVMIIEkaADAgEFoQMCAQ6iBwMFACAAAACjggPBYYIDvTCCA7mgAwIBBaEKGwhWVElDLkNPTaImMCSgAwIBAqEdMBsbBEhUVFAbE3dzLWx1bXBraW4udnRpYy5jb22jggN8MIIDeKADAgEXoQMCARGiggNqBIIDZrffE8Fnkd+d+z4KN/T3rGs/8tZ84bxy3aR16SMrfZicPfsA0pyMsFjwpl9KTDZt8LnT6ujlph5xyEC9or5SswLB/XNSe23uuEBX7F80qZZhvcVOkMlaxI8L5xK+773TNMqCYRL0UGWI2ac8PhbrN6Q5RSatAh4sf4aF54ZcvkRH70Dt6r3oH2blBQ4l6oGk4TMZeXw6HIabNFi1/11kcbFfifeWS0+M4hPC9OD+9h8GA/Q1CL0LAWPr+MWT4lZeZ95XQWjNUQh0ZbKtiaaB8j5nQtwhNhRAeu+jay35NH0DnpZLwklCf8sqP+3AfTLBcGFcO7hWfxBMoae4vYfZ1MIkNlInmM+nUBEhhRJ1Vy0KR6/A6TxUo7tuifXpyhmOZPYYkx7xUmqR7F3zmezq60BLS5vjYcVkxlJa5la8jh6PZ/NWrOKR/stUhNyjLCO+TSuy8ZJUjJfaK7V6ONpqSvagHU9Qws/az5CvH/csC01MzhaQuuPfmug5Ebl2VxC2OnOtMi7+9MnDu6zWyUHhvNYGNcsG0KxK6WzP6PGvaQFwlK1qoed2w/8ucZSrjiA4jVZw2ferpc5uZAMyi0aczJwk/xTjPS+yLb4VOH65+TrUdRlCOp9RMNz/A5kzI0KorrEuiN6dptP/Rs5lVjMwBSWQp5/+QB22lHPeP6l0Gex15i+bbQ1ljYdYL76ApzvvimRLjd1I4DNmNNMkuWsXNXHaTCXSDbO+quktPpZS5uw1kIEFNSSQ5nDmAcxbBL0T8SbHirs4kC4ZPhRsYnbeSIQFHpkrEAL699wVvNxairKh/3i6GuVx2Ct2u8xHUkoJs/csawLJigJu1c0FXIxTUEP6ak7aCpTtC9FFbERKJi66Pr710s7aiq0UeCGCP6jKyb/6KsjgL98DrdJiwwHFqiYZDqud7IwAn1HI+3VHI155kw6B2ciRtkRfsHfiv3V7oQoY8fM3Uy90ksV4TJ8tPNvwIsoZo62u4VBcc7d+fYHa1hSM2n2OYUnqVzN5fIG2fodInSMCzRVdrfx8e8HCGkXGqLUkSojNwqa/Paswa5V4+QuXtkGda+htIJyfHbNM6F4AxXXk0f0Ti0RpKL/0fWfJswL7kkwgQ8J8lVeDNXoJZSOdIcN4u10i3E95JoENjPh0m7r9paSBtjCBs6ADAgEXooGrBIGoYcaOOfV1qU0ouvj9Vv6x07iOih9H+UMZknk/u4YSzMySrVrQfaXNh0bZEO/vJ6EF9WEOSWfkjbjxTtOkMdJlyKA6VZHqwIfT3b9E0eL/I19uG8nYl4qM1OaQ2m3JoBscIEP8dTDu23910B9svUw6V8NsjGmOSVB3FMkj3iBQU0Pmvh9igKfbQEt6bs3NReSBlEZwvk/9Z1TH+3sa6AQNNcCVuhreuXXK
2006-03-03 10:41:58,715 INFO [STDOUT]
jcifs.spnego.AuthenticationException: Error performing Kerberos
authentication: java.lang.reflect.InvocationTargetException
2006-03-03 10:41:58,715 INFO [STDOUT] at
jcifs.spnego.Authentication.processKerberos(Authentication.java:447)
2006-03-03 10:41:58,715 INFO [STDOUT] at
jcifs.spnego.Authentication.processSpnego(Authentication.java:346)
2006-03-03 10:41:58,715 INFO [STDOUT] at
jcifs.spnego.Authentication.process(Authentication.java:235)
2006-03-03 10:41:58,715 INFO [STDOUT] at
jcifs.http.Negotiate.authenticate(Negotiate.java:47)
2006-03-03 10:41:58,715 INFO [STDOUT] at
com.agilquest.onboard.auth.IntegratedSsoHelper.authenticateNtlm(IntegratedSsoHelper.java:154)
2006-03-03 10:41:58,715 INFO [STDOUT] at
com.agilquest.onboard.sso.IntegratedSsoFilter.doFilter(IntegratedSsoFilter.java:93)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
2006-03-03 10:41:58,715 INFO [STDOUT] at
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
2006-03-03 10:41:58,731 INFO [STDOUT] at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
2006-03-03 10:41:58,731 INFO [STDOUT] at
java.lang.Thread.run(Thread.java:534)
2006-03-03 10:41:58,731 INFO [STDOUT] Caused by:
java.lang.reflect.InvocationTargetException
2006-03-03 10:41:58,731 INFO [STDOUT] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2006-03-03 10:41:58,731 INFO [STDOUT] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
2006-03-03 10:41:58,731 INFO [STDOUT] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
2006-03-03 10:41:58,731 INFO [STDOUT] at
java.lang.reflect.Method.invoke(Method.java:324)
2006-03-03 10:41:58,731 INFO [STDOUT] at
jcifs.spnego.Authentication$ServerAction.run(Authentication.java:511)
2006-03-03 10:41:58,731 INFO [STDOUT] at
jcifs.spnego.Authentication.processKerberos(Authentication.java:430)
2006-03-03 10:41:58,731 INFO [STDOUT] ... 37 more
2006-03-03 10:41:58,746 INFO [STDOUT] Caused by: GSSException: No
valid credentials provided (Mechanism level: Failed to find any
Kerberos Key)
2006-03-03 10:41:58,746 INFO [STDOUT] at
sun.security.jgss.krb5.Krb5AcceptCredential.getInstance(Krb5AcceptCredential.java:82)
2006-03-03 10:41:58,746 INFO [STDOUT] at
sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Krb5MechFactory.java:75)
2006-03-03 10:41:58,746 INFO [STDOUT] at
sun.security.jgss.GSSManagerImpl.getCredentialElement(GSSManagerImpl.java:149)
2006-03-03 10:41:58,746 INFO [STDOUT] at
sun.security.jgss.GSSCredentialImpl.add(GSSCredentialImpl.java:334)
2006-03-03 10:41:58,746 INFO [STDOUT] at
sun.security.jgss.GSSCredentialImpl.<init>(GSSCredentialImpl.java:44)
2006-03-03 10:41:58,746 INFO [STDOUT] at
sun.security.jgss.GSSManagerImpl.createCredential(GSSManagerImpl.java:102)
2006-03-03 10:41:58,746 INFO [STDOUT] ... 43 more
Any help is appreciated,
Chris
- 14
- Drag and drop an URLHello,
can you give an advice please? I learned how to drag and drop an URL from my
web browser to my Java application. But it does not work as I would like.
For example if I drop URL http://java.sun.com/ my application receives
http://java.sun.com/Java Technology where "Java Technology" is not the part
of URL but page title. Is there any way how to receive pure URL without the
page title? I worry that by cutting off everything after the last slash I
can damage some URLs. I use DataFlavor.stringFlavor.
Thank you! Vojta
- 15
- Broken behavior of java.io.File()I'm seeing several examples of broken behavior with java.io.File():
* mkdirs() sometimes returns false, despite succeeding (the directories
exist afterward on the
filesystem)
* exists() and isDirectory() sometimes return false when called on a
File object right after a
mkdirs() after which the directory and its parents existed, as
observed using Winblows
Exploder.
What is going on here? Is there even a way to test for the existence of
a directory with 100% accuracy?
|
|
|