Help coderanch get a
new server
by contributing to the fundraiser

Shane Roylance

Ranch Hand
+ Follow
since Aug 29, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shane Roylance

Let's say I got over-ambitious and decided to rewrite the text package in swing. So I have my own javax.swing.text package (I know that is not koshur). Is there any way to ensure that when my application is run (executable jar file), it uses my text package instead of the regular text package in rt.jar? Will it use mine by default if it is in my jar file? If I change the class path to always include my jar file before the rt.jar file, will that work?

Thanks
Shane
19 years ago
I found the answer. If you place this code before you instantiate the TextPane it will set the default to whatever you want.
Enjoy.
20 years ago
Anyone have any input on this? Is there a setting for a default font in JTexPane? Is there such a thing as the "default font"?
It looks like there are tags around the text telling it the style it shoulb be in, somehow we get outside the tags, and it reverts to a different font. Is that what is happening? Do I need to submit a bug to Sun?
Thanks again for any assistance
Shane
20 years ago
Here is a brief example, at least it works for me.

[ March 30, 2004: Message edited by: Shane Roylance ]
[ March 30, 2004: Message edited by: Shane Roylance ]
20 years ago
Here is a program I got from the java tutorial on using JTextPane, modified to make it simpler and to show my problem. If you compile this code and run it a JTextPane will come up with some text. Now go to the end of the text, press enter and type a character or two. Delete the character(s) you just typed, then type another character. What you see is that the font is now different, it turns into what looks like a 12 pt font instead of the 24 pt font that it was. My question is why does it do this, and how can I stop it from doing that?
Thanks in advance
Shane
20 years ago
If it turns out that I am getting an NoClassDefFoundError, why would it not be able to find the class at runtime? What am I doing wrong here?
20 years ago
I have incorporated some stuff for the Apache FO processor in my application. To build my application I include the jar files necessary for the apache stuff, and it builds fine. But during execution when I get to the point that calls the Apache stuff my application just hangs, I assume because it can't find it. I don't get any errors or exceptions. I know the jar files are in my classpath, and just to be sure I have explicity added each one to the classpath on the command line. What could be going on here?
One other note. I am using NetBeans as my IDE, and I can build and execute my application with no problem from netbeans. But outside of the IDE is where I run into these difficulties. Any help would be appreciated.
20 years ago
This may be an oversimplification of what you are doing, but couldn't you just add an addText(String) method to the object that contains the text field you want to modify? Assuming, of course, that you have access to the instance of that object.
Shane
21 years ago
I have a JList which resides in a JScrollPane. In the list are various codes, the user can begin to type and narrow the list. As the list narrows I would like the list to resize. This was all working fine until I moved to 1.4, now it acts like it is one refresh behind. For example first I have 20 visible rows, that gets narrowed to 10, but the list still shows 20 (10 are empty), then we narrow it to 5, and the list shows 10 (5 are empty), etc.
Here is my resizing code, any help would be appreciated.
21 years ago

JAVA 1.4As of Java 1.4 there is a new javax.print package allowing more detailed control of print jobs and communication with printers. Coverage of this new package is beyond the scope of this book, as it is deserving of a much more extensive treatment than we can provide here. This chapter should be considered a primer on printing with Swing, and for those issues that cannot be solved using the material here we would suggest digging into the new javax.print package.


That's a quote from this book. Does anyone know of any kind of documentation on the javax.print package???
Thanks
Shane
21 years ago
Hi Matt,
I was wondering if the book covered the new printing API at all. It's a subject that I am having a hard time finding anything about. (Is that considered part of swing?)
Thanks
Shane
[ April 02, 2003: Message edited by: Shane Roylance ]
21 years ago
Maybe I don't understand the dillema, but JTextPane is a decendent of JTextComponent. Therefore it does have getSelectionStart and getSelectionEnd methods. I have been messing around with JTextPanes for a little bit, and I still don't really understand them. But there is a good tutorial on Sun's site about them if you haven't already read it Sun Text Tutorial
Sorry I am not more help.
Shane
21 years ago
I have a JTextPane that is populated by output text from a program (report). The text being inserted in the JTextPane has new line ('\n') characters for line breaks. There is a little blurb in the javadoc comments of JTextPane (well it points you to the DefaultEditorKit), that says:
"There are two properties which deal with newlines. The system property, line.separator, is defined to be platform-dependent, either "\n", "\r", or "\r\n". There is also a property defined in DefaultEditorKit, called EndOfLineStringProperty, which is defined automatically when a document is loaded, to be the first occurrence of any of the newline characters. When a document is loaded, EndOfLineStringProperty is set appropriately, and when the document is written back out, the EndOfLineStringProperty is used. But while the document is in memory, the "\n" character is used to define a newline, regardless of how the newline is defined when the document is on disk. Therefore, for searching purposes, "\n" should always be used. When a new document is created, and the EndOfLineStringProperty has not been defined, it will use the System property when writing out the document."
The bottom line is, I am getting carriage returns in my text, and I don't want them. Can anyone show me how to manually change this so JTextPane does not insert carriage returns? (I am running this on a Windows platform)
21 years ago
Hi all,
Maybe this is a simple question (I hope so anyway). I want to get a version out of a dll file through java code, and ideas how I can accomplish this?
Shane
21 years ago
If you are using 1.4, I think this will do it:
21 years ago