Missing Jar files javax.swing.text.Utilities(printTable)
Hi Experts,
please explain which jar files are required for Javax.swing.text.Utilites(printTable()).
tilities utilities = new Utilities();
ArrayList al = new ArrayList();
al.add(IPrivateWOAccCodeView.IWOElement.RQT_NO);
al.add(IPrivateWOAccCodeView.IWOElement.WO_TITLE);
al.add(IPrivateWOAccCodeView.IWOElement.RQTR);
al.add(IPrivateWOAccCodeView.IWOElement.TOT_AMT);
al.add(IPrivateWOAccCodeView.IWOElement.STATUS);
al.add(IPrivateWOAccCodeView.IWOElement.PLAN_START_DATE);
al.add(IPrivateWOAccCodeView.IWOElement.TARGET_END_DATE);
al.add(IPrivateWOAccCodeView.IWOElement.ACCOUNT_CODE);
al.add(IPrivateWOAccCodeView.IWOElement.APPLY_AMOUNT);
//To print in HTML
String printURL = (String) utilities.printTable(al,"Work Order Details By Account Code","Work Order Details By Account Code",wdContext.nodeWO()).get("url");
wdContext.currentContextElement().setPrintURL(printURL);
//@@end
Error in printTable that is method is undefined.
Regards,
Smruti
Edited by: smruti moharana on Jun 20, 2011 8:10 AM
According to my knowledge, there is no printTable method in javax.swing.text.Utilities class
What are you trying to achieve?
Similar Messages
-
there's the source:
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.text.html.*;
import javax.swing.border.*;
class HTMLMagician extends JFrame
protected static final String APP_NAME="HTML Magician V1.0 Produced By V Studio";
protected JTextPane hm_textPane;
protected StyleSheet hm_styleSheet;
protected HTMLEditorKit html_kit;
protected HTMLDocument html_document;
protected JMenuBar hm_menuBar;
protected JToolBar hm_toolBar;
protected JFileChooser hm_fileChooser;
protected File current_file;
protected boolean text_changed=false;
public HTMLMagician()
super(APP_NAME);
setSize(800,600);
getContentPane().setLayout(new BorderLayout());
produceMenuBar();
hm_textPane=new JTextPane();
html_kit=new HTMLEditorKit();
hm_textPane.setEditorKit(html_kit);
JScrollPane textPane_scrollPane=new JScrollPane();
textPane_scrollPane.getViewport().add(hm_textPane);
getContentPane().add(textPane_scrollPane,BorderLayout.CENTER);
hm_fileChooser=new JFileChooser();
javax.swing.filechooser.FileFilter hm_filter=new javax.swing.filechooser.FileFilter()
public boolean accept(File pathname)
if(pathname.isDirectory())
return true;
String ext_name=pathname.getName().toLowerCase();
if(ext_name.endsWith(".htm"))
return true;
if(ext_name.endsWith(".html"))
return true;
if(ext_name.endsWith(".asp"))
return true;
if(ext_name.endsWith(".jsp"))
return true;
if(ext_name.endsWith(".css"))
return true;
if(ext_name.endsWith(".php"))
return true;
if(ext_name.endsWith(".aspx"))
return true;
if(ext_name.endsWith(".xml"))
return true;
if(ext_name.endsWith(".txt"))
return true;
return false;
public String getDescription()
return "HTML files(*.htm,*.html,*.asp,*.jsp,*.css,*.php,*.aspx,*.xml)";
hm_fileChooser.setAcceptAllFileFilterUsed(false);
hm_fileChooser.setFileFilter(hm_filter);
try
File dir=(new File(".")).getCanonicalFile();
hm_fileChooser.setCurrentDirectory(dir);
}catch(IOException ex)
showError(ex,"Error openning current directory");
newDocument();
WindowListener action_winClose=new WindowAdapter()
public void windowClosing(WindowEvent evt)
if(!promptToSave())
return;
System.exit(0);
addWindowListener(action_winClose);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
setVisible(true);
protected void produceMenuBar()
hm_menuBar=new JMenuBar();
hm_toolBar=new JToolBar();
JMenu menu_file=new JMenu("File");
menu_file.setMnemonic('f');
ImageIcon icon_new=new ImageIcon("imgs/file.gif");
Action action_new=new AbstractAction("New",icon_new)
public void actionPerformed(ActionEvent evt)
if(!promptToSave())
return;
newDocument();
JMenuItem item_new=new JMenuItem(action_new);
item_new.setMnemonic('n');
item_new.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,InputEvent.CTRL_MASK));
menu_file.add(item_new);
JButton button_new=hm_toolBar.add(action_new);
ImageIcon icon_open=new ImageIcon("imgs/folder_open.gif");
Action action_open=new AbstractAction("Open...",icon_open)
public void actionPerformed(ActionEvent evt)
if(!promptToSave())
return;
openDocument();
JMenuItem item_open=new JMenuItem(action_open);
item_open.setMnemonic('o');
item_open.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,InputEvent.CTRL_MASK));
menu_file.add(item_open);
JButton button_open=hm_toolBar.add(action_open);
ImageIcon icon_save=new ImageIcon("imgs/floppy.gif");
Action action_save=new AbstractAction("Save",icon_save)
public void actionPerformed(ActionEvent evt)
saveAs(false);
JMenuItem item_save=new JMenuItem(action_save);
item_save.setMnemonic('s');
item_save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK));
menu_file.add(item_save);
JButton button_save=hm_toolBar.add(action_save);
Action action_saveAs=new AbstractAction("Save As...")
public void actionPerformed(ActionEvent evt)
saveAs(true);
JMenuItem item_saveAs=new JMenuItem(action_saveAs);
item_saveAs.setMnemonic('a');
item_saveAs.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,InputEvent.CTRL_MASK));
menu_file.add(item_saveAs);
menu_file.addSeparator();
Action action_close=new AbstractAction("Quit")
public void actionPerformed(ActionEvent evt)
if(!promptToSave())
return;
System.exit(0);
JMenuItem item_exit=new JMenuItem(action_close);
item_exit.setMnemonic('q');
item_exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q,InputEvent.CTRL_MASK));
menu_file.add(item_exit);
hm_menuBar.add(menu_file);
setJMenuBar(hm_menuBar);
getContentPane().add(hm_toolBar,BorderLayout.NORTH);
protected String getDocumentName()
return current_file==null ? "Untitled" : current_file.getName();
protected void newDocument()
html_document=(HTMLDocument)html_kit.createDefaultDocument();
hm_styleSheet=html_document.getStyleSheet();
hm_textPane.setDocument(html_document);
current_file=null;
setTitle(getDocumentName()+" - "+APP_NAME);
Runnable runner=new Runnable()
public void run()
text_changed=false;
html_document.addDocumentListener(new action_textChanged());
SwingUtilities.invokeLater(runner);
protected void openDocument()
if(hm_fileChooser.showOpenDialog(HTMLMagician.this)!=JFileChooser.APPROVE_OPTION)
return;
File f=hm_fileChooser.getSelectedFile();
if(f==null || !f.isFile())
return;
current_file=f;
setTitle(getDocumentName()+" - "+APP_NAME);
HTMLMagician.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try
InputStream in=new FileInputStream(current_file);
html_document=(HTMLDocument)html_kit.createDefaultDocument();
html_kit.read(in,html_document,0);
hm_styleSheet=html_document.getStyleSheet();
hm_textPane.setDocument(html_document);
in.close();
}catch(Exception ex)
showError(ex,"Error openning file "+current_file);
HTMLMagician.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
Runnable runner=new Runnable()
public void run()
text_changed=false;
html_document.addDocumentListener(new action_textChanged());
SwingUtilities.invokeLater(runner);
protected boolean saveAs(boolean as)
if(!as && !text_changed)
return true;
if(as || current_file==null)
if(hm_fileChooser.showSaveDialog(HTMLMagician.this)!=JFileChooser.APPROVE_OPTION)
return false;
File f=hm_fileChooser.getSelectedFile();
if(f==null || !f.isFile())
return false;
current_file=f;
setTitle(getDocumentName()+" - "+APP_NAME);
HTMLMagician.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try
OutputStream out=new FileOutputStream(current_file);
html_kit.write(out,html_document,0,html_document.getLength());
out.close();
}catch(Exception ex)
showError(ex,"Error saving file "+current_file);
HTMLMagician.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
return true;
protected boolean promptToSave()
if(!text_changed)
return true;
int result=JOptionPane.showConfirmDialog(this,"Save change to "+getDocumentName(),APP_NAME,JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE);
switch(result)
case JOptionPane.YES_OPTION:
if(!saveAs(false))
return false;
return true;
case JOptionPane.NO_OPTION:
return true;
case JOptionPane.CANCEL_OPTION:
return false;
return true;
protected void showError(Exception ex,String message)
ex.printStackTrace();
JOptionPane.showMessageDialog(this,message,APP_NAME,JOptionPane.WARNING_MESSAGE);
public static void main(String[] args)
new HTMLMagician();
class action_textChanged implements DocumentListener
public void changedUpdate(DocumentEvent evt)
text_changed=true;
public void insertUpdate(DocumentEvent evt)
text_changed=true;
public void removeUpdate(DocumentEvent evt)
text_changed=true;
when i open a .html file,the command output :
javax.swing.text.ChangedCharSetException
at javax.swing.text.html.parser.DocumentParser.handleEmptyTag(Unknown Source)
at javax.swing.text.html.parser.Parser.startTag(Unknown Source)
at javax.swing.text.html.parser.Parser.parseTag(Unknown Source)
at javax.swing.text.html.parser.Parser.parseContent(Unknown Source)
at javax.swing.text.html.parser.Parser.parse(Unknown Source)
at javax.swing.text.html.parser.DocumentParser.parse(Unknown Source)
at javax.swing.text.html.parser.ParserDelegator.parse(Unknown Source)
at javax.swing.text.html.HTMLEditorKit.read(Unknown Source)
at javax.swing.text.DefaultEditorKit.read(Unknown Source)
at HTMLMagician.openDocument(HTMLMagician.java:222)
at HTMLMagician$4.actionPerformed(HTMLMagician.java:128)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
why? what's wrong? thanksThe DocumentParser seems to throw a ChangedCharSetException if it finds a "http-equiv" meta tag for "content-type" or "charset" and if the parser's "ignoreCharSet" property is set to false on creation.
-
Many javax.swing.text.Position objects en masse
Hi,
I am wondering if anyone has much experience with the performance of javax.swing.text.Document implementations (using GapContent) and a large number of registered Position objects. I am trying to keep track of token boundaries for quick re-lexing, and the token count can be rocket high. I am just beginning to work with this API, and I guess I am looking for any insider information I may be missing.
Thanks,
galaxyHi,
I am wondering if anyone has much experience with the performance of javax.swing.text.Document implementations (using GapContent) and a large number of registered Position objects. I am trying to keep track of token boundaries for quick re-lexing, and the token count can be rocket high. I am just beginning to work with this API, and I guess I am looking for any insider information I may be missing.
Thanks,
galaxy -
Javax.swing.text.TableView bug in 1.4 beta 2 ?
Hi,
I derived a class from TableView, which worked fine with 1.3, but now causes the following exception as soon as being layouted:
java.lang.Error: should not happen: class com.lexetius.swing.text.LexTableView
at javax.swing.text.BoxView.baselineLayout(Unknown Source)
at javax.swing.text.ParagraphView$Row.layoutMinorAxis(Unknown Source)
at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
at javax.swing.text.BoxView.layout(Unknown Source)
at javax.swing.text.BoxView.setSize(Unknown Source)
at javax.swing.text.BoxView.updateChildSizes(Unknown Source)
at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
at javax.swing.text.BoxView.layout(Unknown Source)
at javax.swing.text.FlowView.layout(Unknown Source)
at javax.swing.text.BoxView.setSize(Unknown Source)
at javax.swing.text.BoxView.updateChildSizes(Unknown Source)
at javax.swing.text.BoxView.setSpanOnAxis(Unknown Source)
at javax.swing.text.BoxView.layout(Unknown Source)
at javax.swing.text.BoxView.setSize(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI$RootView.setSize(Unknown Source)
at javax.swing.plaf.basic.BasicTextUI.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.JEditorPane.getPreferredSize(Unknown Source)
at javax.swing.ScrollPaneLayout.layoutContainer(Unknown Source)
at java.awt.Container.layout(Unknown Source)
at java.awt.Container.doLayout(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validate(Unknown Source)
at javax.swing.RepaintManager.validateInvalidComponents(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknow
n Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
any ideas???I wrote the com.lexetius.swing.text.LexTableView component myself. It is derived directly from javax.swing.text.TableView and it adds virtually no functionality. I'm quite sure, the problem comes from the TableView class, but I can't verify that directly, since this class is abstract (why is that, anyway??).
It would certainly help me very much, if anybody had a component, which is also derived from javax.swing.text.TableView and works with the 1.4 beta. -
Using of javax.swing.text package
Where can I find any resources devoted to using javax.swing.text package?
At the end of the API documentation for that package you may notice this:
<quote>
Related Documentation
For overviews, tutorials, examples, guides, and tool documentation, please see:
Using Text Components, a section in The Java Tutorial.
</quote> -
Fix for PENDING in javax.swing.text.html.ParagraphView line #131
Investigating source of HTMLEditorKit I found many PENDING things. That's fix for one of them - proper minimal necessary span detecting in table cells.
Hope it will help to somebody else.
import javax.swing.*;
import javax.swing.text.html.*;
import javax.swing.text.html.ParagraphView;
import javax.swing.text.*;
import java.awt.*;
import java.text.*;
import java.util.ArrayList;
public class App extends JFrame {
public static String htmlString="<html>\n" +
"<body>\n" +
"<p>The following table is used to illustrate the PENDING in javax.swing.text.html.ParagraphView line #131 fix.</p>\n" +
"<table cellspacing=\"0\" border=\"1\" width=\"50%\" cellpadding=\"3\">\n" +
"<tr>\n" +
"<td>\n" +
"<p>111111111111111111111111111111111<b>bold</b>22222222222222222222222222222</p>\n" +
"</td>\n" +
"<td>\n" +
"<p>-</p>\n" +
"</td>\n" +
"</tr>\n" +
"</table>\n" +
"<p></p>\n" +
"</body>\n" +
"</html>";
JEditorPane editor=new JEditorPane();
JEditorPane editor2=new JEditorPane();
public static void main(String[] args) {
App app = new App();
app.setVisible(true);
public App() {
super("HTML span fix example");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JSplitPane split=new JSplitPane(JSplitPane.VERTICAL_SPLIT, createFixedPanel(), createOriginalPanel());
getContentPane().add(split);
setSize(700, 500);
split.setDividerLocation(240);
setLocationRelativeTo(null);
JComponent createOriginalPanel() {
JPanel p=new JPanel(new BorderLayout());
p.add(new JLabel("Original HTMLEditorKit"), BorderLayout.NORTH);
HTMLEditorKit kit=new HTMLEditorKit();
editor2.setEditorKit(kit);
editor2.setContentType("text/html");
editor2.setText(htmlString);
p.add(new JScrollPane(editor2), BorderLayout.CENTER);
return p;
JComponent createFixedPanel() {
JPanel p=new JPanel(new BorderLayout());
p.add(new JLabel("Fixed HTMLEditorKit"), BorderLayout.NORTH);
HTMLEditorKit kit=new MyHTMLEditorKit();
editor.setEditorKit(kit);
editor.setContentType("text/html");
editor.setText(htmlString);
p.add(new JScrollPane(editor), BorderLayout.CENTER);
return p;
class MyHTMLEditorKit extends HTMLEditorKit {
ViewFactory defaultFactory=new MyHTMLFactory();
public ViewFactory getViewFactory() {
return defaultFactory;
class MyHTMLFactory extends HTMLEditorKit.HTMLFactory {
public View create(Element elem) {
View v=super.create(elem);
if (v instanceof ParagraphView) {
v=new MyParagraphView(elem);
return v;
class MyParagraphView extends ParagraphView {
public MyParagraphView(Element elem) {
super(elem);
protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r) {
r = super.calculateMinorAxisRequirements(axis, r);
float min=getLongestWordSpan();
r.minimum = Math.max(r.minimum, (int) min);
return r;
public float getLongestWordSpan() {
if (getContainer()!=null && getContainer() instanceof JTextComponent) {
try {
int offs=0;
JTextComponent c=(JTextComponent)getContainer();
Document doc=getDocument();
int start=getStartOffset();
int end=getEndOffset()-1; //don't need the last \n
String text=doc.getText(start, end - start);
if(text.length() > 1) {
BreakIterator words = BreakIterator.getWordInstance(c.getLocale());
words.setText(text);
ArrayList<Integer> wordBounds=new ArrayList<Integer>();
wordBounds.add(offs);
int count=1;
while (offs<text.length() && words.isBoundary(offs)) {
offs=words.next(count);
wordBounds.add(offs);
float max=0;
for (int i=1; i<wordBounds.size(); i++) {
int wStart=wordBounds.get(i-1)+start;
int wEnd=wordBounds.get(i)+start;
float span=getLayoutSpan(wStart,wEnd);
if (span>max) {
max=span;
return max;
} catch (BadLocationException e) {
e.printStackTrace();
return 0;
public float getLayoutSpan(int startOffset, int endOffset) {
float res=0;
try {
Rectangle r=new Rectangle(Short.MAX_VALUE, Short.MAX_VALUE);
int startIndex= layoutPool.getViewIndex(startOffset,Position.Bias.Forward);
int endIndex= layoutPool.getViewIndex(endOffset,Position.Bias.Forward);
View startView=layoutPool.getView(startIndex);
View endView=layoutPool.getView(endIndex);
int x1=startView.modelToView(startOffset,r,Position.Bias.Forward).getBounds().x;
int x2=endView.modelToView(endOffset,r,Position.Bias.Forward).getBounds().x;
res=startView.getPreferredSpan(View.X_AXIS)-x1;
for (int i=startIndex+1; i<endIndex; i++) {
res+=layoutPool.getView(i).getPreferredSpan(View.X_AXIS);
res+=x2;
} catch (BadLocationException e) {
e.printStackTrace();
return res;
}Regards,
StasI'm changing the foreground color with
MutableAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setForeground(attr, newColor);
int start=MyJTextPane..getSelectionStart();
int end=MyJTextPane.getSelectionEnd();
if (start != end) {
htmlDoc.setCharacterAttributes(start, end, attr, false);
else {
MutableAttributeSet inputAttributes =htmlEditorKit.getInputAttributes();
inputAttributes.addAttributes(attr); -
AAARGH!!! Can't understand javax.swing.text.*
Good afternoon...
does anybody understand javax.swing.text classes? i've read a number of
books, downloaded docs (including those from the javax.swing.text author), and googled everything i could think of. but nothing seems to explain it to me so that i can understand it! maybe i'm just dense, but maybe it really is that difficult.
i want to create a read-only document, who's source is not necessarily a
string, but perhaps an ArrayList of objects with a HashMap of attributes. or even something simpler for now, just an object with a fixed number of attributes. i want to display this information in a JTextArea. i tried implementing a Document and passing it to the JTextArea constructor but just got a NullPointerException.
does anybody know where i can find more information on creating my own
document types?
here's the code for my ReadOnlyDocument class if anyone of you are generous (& adventurous) enough to take a look:
import java.util.ArrayList;
import javax.swing.event.DocumentListener;
import javax.swing.event.UndoableEditListener;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.Position;
import javax.swing.text.Segment;
public class ReadOnlyDocument implements Document{
private String myContent = "this is the contents of my document!";
private ArrayList listeners;
private ReadOnlyDocument refSelf = this;
public ReadOnlyDocument() {
System.out.println("ReadOnlyDocument.<init>");
public int getLength() {
System.out.println("ReadOnlyDocument.getLength() = " + myContent.length());
return myContent.length();
public void addDocumentListener(DocumentListener listener) {
System.out.println("ReadOnlyDocument.addDocumentListener(" + listener + ")");
if (listeners != null) {
listeners = new ArrayList();
listeners.add(listener);
} else {
listeners = new ArrayList();
listeners.add(listener);
public void removeDocumentListener(DocumentListener listener) {
System.out.println("ReadOnlyDocument.removeDocumentListener(" +
listener + ")");
if (listeners != null) {
listeners.remove(listener);
public void addUndoableEditListener(UndoableEditListener listener) {
// Read-only document, nothing to do here
System.out.println("ReadOnlyDocument.addUndoableEditListener(" +
listener + ")");
public void removeUndoableEditListener(UndoableEditListener listener) {
// Read-only document, nothing to do here
System.out.println("ReadOnlyDocument.removeUndoableEditListener(" +
listener + ")");
public Object getProperty(Object key) {
System.out.println("ReadOnlyDocument.getProperty(" + key + ") =
null");
return null;
public void putProperty(Object key, Object value) {
System.out.println("ReadOnlyDocument.putProperty(" + key + ")");
public void remove(int offs, int len) throws BadLocationException {
// Read-only document, nothing to do here
System.out.println("ReadOnlyDocument.remove(" + offs + ", " + len +
public void insertString(int offset, String str, AttributeSet a) throws
BadLocationException {
// Read-only document, nothing to do here
System.out.println("ReadOnlyDocument.insertString(" + offset + ", " +
str + ", " + a + ")");
public String getText(int offset, int length) throws
BadLocationException {
System.out.print("ReadOnlyDocument.getText(" + offset + ", " + length +
") = ");
if ((offset >= 0) && (length >= 0) && (offset+length <=
myContent.length()+1)) {
System.out.println(myContent.substring(offset, offset+length-1));
return myContent.substring(offset, offset+length-1);
} else {
System.out.println("BadLocationException!");
throw new BadLocationException("Bad location requested", 0);
public void getText(int offset, int length, Segment txt) throws
BadLocationException {
System.out.print("ReadOnlyDocument.getText(" + offset + ", " + length +
", " + txt + ") = ");
if ((offset >= 0) && (length >= 0) && (offset+length <=
myContent.length()+1)) {
System.out.println(myContent.substring(offset, offset+length-1));
txt = new Segment(myContent.toCharArray(), offset, length);
} else {
System.out.println("BadLocationException!");
throw new BadLocationException("Bad location requested", 0);
public Position getStartPosition() {
System.out.println("ReadOnlyDocument.getStartPosition() = 0");
return new Position() {
public int getOffset() {
return 0;
public Position getEndPosition() {
System.out.println("ReadOnlyDocument.getEndPosition() = " +
myContent.length());
return new Position() {
public int getOffset() {
return myContent.length();
public Position createPosition(int offs) throws BadLocationException {
System.out.println("ReadOnlyDocument.createPosition(" + offs + ") =
0");
if ((offs >= 0) && (offs <= myContent.length()-1)) {
return new Position() {
public int getOffset() {
return 0;
} else {
throw new BadLocationException("Bad location requested", 0);
public Element[] getRootElements() {
System.out.println("ReadOnlyDocument.getRootElements()");
Element[] roots = {new Element() {
public Document getDocument() {
return refSelf;
public Element getParentElement() {
return null;
public String getName() {
return "ReadOnlyRoot";
public AttributeSet getAttributes() {
return null;
public int getStartOffset() {
return 0;
public int getEndOffset() {
return myContent.length() - 1;
public int getElementIndex(int offset) {
return 0;
public int getElementCount() {
return 0;
public Element getElement(int index) {
return null;
public boolean isLeaf() {
return true;
return roots;
public Element getDefaultRootElement() {
System.out.println("ReadOnlyDocument.getDefaultRootElement()");
return new Element() {
public Document getDocument() {
return refSelf;
public Element getParentElement() {
return null;
public String getName() {
return "ReadOnlyRoot";
public AttributeSet getAttributes() {
return null;
public int getStartOffset() {
return 0;
public int getEndOffset() {
return myContent.length() - 1;
public int getElementIndex(int offset) {
return 0;
public int getElementCount() {
return 0;
public Element getElement(int index) {
return null;
public boolean isLeaf() {
return true;
public void render(Runnable r) {
// not sure what to put here
System.out.println("ReadOnlyDocument.render(" + r + ")");
}and here's a simple class to display the document/generate the error:
import java.awt.event.*;
import javax.swing.*;
public class ReadOnlyFrame extends JFrame {
public ReadOnlyFrame() {
super();
setTitle("Read Only Document");
addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
System.exit(0);
getContentPane().add(new JTextArea(new ReadOnlyDocument()));
setSize(200, 200);
public static void main(String[] args) {
ReadOnlyFrame rof = new ReadOnlyFrame();
rof.setVisible(true);
Headed for the second star to the right and straight on till morning...
Eric Schultz
aka: Storkman
http://community.webshots.com/user/storky1
mailto:EricSchultzATcanadaDOTcomif you are getting that print before the timer
starts, then I'd expect it's not blocking. The
problem with these small snippets of code is that we
can't really tell what might be going on elsewhere.Yes, I realize that. AAMOF, there isn't anything going on elsewhere, i.e.
the GestureController object spawns another thread when it gets
created. That other thread blocks until a 'Mover' object is delivered to
the GestureController object. The mutex/synchronizing stuff works
like the textbook version, i.e. no deadlock, no deadly embrace, no
nothing. When the timer is started, the Mover is supposed to
call back the 'animate' method, just a method in the GestureController
object.
All the System.out.prints show that it gets there. The task (an ActionListener)
dispatched by that timer doesn't start. As you can see above, I've
used System.out.prints for that too. It is as if that Timer doesn't start.
I still haven't found anything ... This is what the 'auto.move' thing is
supposed to do: static class DragMover implements Mover {
DrawableStack from;
DrawableStack to;
int position;
DragMover(DrawableStack from, int position, DrawableStack to) {
this.from= from;
this.to = to;
this.position= position;
public void move() {
System.out.println("moving the stuff...");
GestureController.getGestureController().animate(from, position, to);
public void undo() { }
}... the line "moving stuff ..." isn't displayed either, i.e. the actionPerformed
method is never called and then ... there's nothing in between there, i.e.
the Timer is supposed to call that method.
Thank you for your reply, much appreciated and,
kind regards,
Jos
by that timer (an ActionListener) -
Jar file to convert text into pdf
java coding or jar file to convert text file into pdf. i dont want exe file...
any converter to convert text into pdf.... to run in a webapplicationThis website is used to convert Word, Text , Excel file into pdf. I think it is useful to you.
http://www.planetpdf.com
Message was edited by:
ggopi -
Extends javax.swing.text.DefaultFormatter
I try to create my own DefaultFormatter to create en hexadecimal field:
I wand to display always 0x and next we can edit hex value.
The problem I have is that I need to overwrite the method:
boolean isNavigatable(int offset)
but his access is friendly (package).
I have try to create a new class in javax.swing.text but my new method is newer used !!!
What can I do !!!The only two methods you should need to override are "stringToValue" and "valueToString". Those will get you back and forth between what the user enters, and what value is saved.
Hope this helps,
Josh Castagno
http://www.jdc-software.com -
Extending javax.swing.text.html.parser
I'm trying to extend prepackaged jdk's html parser but stuck via specific javax.swing.text.html.parser.DTD (taking prepackaged HTML32 DTD and adding entities to it) but stuck with the fact DTD class is poorly described in javadoc (e.g. integer parameters without values description, messy list structures, e.g.). Is the any alternative documentation, maybe some working examples for my problem?
I'm trying to extend prepackaged jdk's html parser but stuck via specific javax.swing.text.html.parser.DTD (taking prepackaged HTML32 DTD and adding entities to it) but stuck with the fact DTD class is poorly described in javadoc (e.g. integer parameters without values description, messy list structures, e.g.). Is the any alternative documentation, maybe some working examples for my problem?
-
Javax.swing.text complexity?
Hello,
does someone know how complex the javax.swing.text package is?
Perhaps someone knows of how many rows and/or functions the package consists?
thanks
kbjHello,
does someone know how complex the javax.swing.text
package is?
Perhaps someone knows of how many rows and/or
functions the package consists?
thanks
kbjDidnt count yet, but if somebody could tell me how to get all classes from a package i could easily calculate method-number.
Besides why do you want to know it ??
regards,
Tim -
Error while compiling Web Dynpro program due to missing JAR files
Hi Experts,
I am getting error message while compiling Web Dynpro program. The erring lines are as below:
Message message = new MimeMessage(session);
try {
message.setFrom(new InternetAddress(fromMailId));
message.addRecipient(
Message.RecipientType.TO,
new InternetAddress(toMailId));
message.setSubject(mailSubject);
message.setText(mailBody);
message.setHeader("X-Mailer", "E-Mail");
message.setSentDate(new Date());
Transport.send(message);
The error messages are:
Message.ReceipientType can not be resolved
The method send(Message) is undefined for the type Transport
The method setFrom(InternetAddress) is undefined for the type Message
The method setHeader(String, String) is undefined for the type MessageThe method setSentDate(Date) is undefined for the type Message
The method setSubject(String) is undefined for the type Message
The method setText(String) is undefined for the type Message
Type mismatch: cannot convert from MimeMessage to Message
Can you please help me in resolving the issue. It seems that some API is missing. I believe if some one can tell me the name of JAR file / API then I will be able to sort out the issue. I will add these JAR file in my program.
Thanks,
SHI Stuart,
you are missing the jar files required for sending mail in java
Installing JavaMail
You will need the latest version of JavaMail (Version 1.2) available here:
http://java.sun.com/products/javamail/
Download and unzip the file, in the newly created top level JavaMail directory you will find a number of jar files,
these need adding to your classpath.
To do this in Eclipse, right click on your project in the tree view, select properties, select the libraries tab.
Now click the 'Add external jars' button, navigate to your JavaMail directory and click on the jars.
The tutorial also makes use of the Java Activation Framework, which is available here:
http://java.sun.com/products/javabeans/glasgow/jaf.html
Instalation of JAF is identical to JavaMail
activation.jar / mail.jar are 2 distinct names i remember rest you will get above
P.S: close the question to assist other users narrow the search and find solutions
Message was edited by:
Armin Reichert -
Missing .jar files in the Weblogic Server 6.1 beta
The files /weblogic/lib/weblogic_sp.jar and /weblogic/lib/poolorb.jar are required
to be set in the
classpath, according to the documentation. But they are missing in the downloaded
version of the server.
Is there any solution?Hi Rajashree,
weblogic_sp.jar file is for service pack. I am assuming that you installed
latest version from the download site. the latest one is a bundled version
of wls6.0 with sp2. we put sp2 with 6.0 together, then you do not see that
jar file.
I am confused with poolorb.jar file. do you mean wlepool.jar and wleorb.jar?
those 2 files are used when you need to make a connection pool to WLE
server. if you do not use it, you do not need to include it in your
classpath.
Thanks
yu
Rajashree Desai <[email protected]> wrote in message
news:3b53ea0c$[email protected]..
>
The files /weblogic/lib/weblogic_sp.jar and /weblogic/lib/poolorb.jar arerequired
to be set in the
classpath, according to the documentation. But they are missing in thedownloaded
version of the server.
Is there any solution? -
Hi All,
I am new to Netweaver. I have downloaded few sample applications from this site.
If any one can help me in getting jar files for the below packages it would be of great help.
com.sap.pct.srv.portaldataviewer_api.jar
com.sap.pct.srv.portaldataviewer_core.jar
com.sap.portal.compatibility50.jco_api.jar
com.sap.portal.compatibility50.jco_core.jar
com.sap.portal.runtime.application.jcoclient_api.jar
com.sap.portal.runtime.application.jcoclient_core.jar
jcoconnection_api.jar
prtconnection.jar
prtjndisupport.jar
prtregistry.jar
If you know atleast one of the path Please let me know.
It would be grateful for you.
And I find from SDN that we can logon to portal system administration->support->portal runtime->etc link.
But I am unable to find out that portal runtime link in portal.
Please let me know. I have to finish this issue.
Regards,
Subashini.JHi,
you can find these files on your portal at location
<b>prtjindisupport.jar & prtregistry[/b are at:
system admin -->support -->portal run time -->browse deployment -->WEB-INF/lib
<b>com.sap.portal.runtime.application.jcoclient_api.jar</b> file is at
system admin -->support -->portal run time -->browse deployment -->/WEB-INF/portal/portalapps/com.sap.portal.runtime.application.jcoclient/lib
<b>
com.sap.portal.runtime.application.jcoclient_core.jar files</b>
system admin -->support -->portal run time -->browse deployment -->WEB-INF/portal/portalapps/com.sap.portal.runtime.application.jcoclient/private/lib
Regards,
Ameya -
Does anyone know what jar file contains oracle.core.ojdl.logging.LoggingConfigurationException?
Thanks,
-DanIt's in $OC4J_HOME/diagnostics/lib/ojdl.jar.
--olaf
Maybe you are looking for
-
Diplay logs in SLG1 with messages dont have msgid , msgno etc.
Hi all , I want to display logs in SLG1 transaction and created object and subobject for this and i am using FM 'APPL_LOG_WRITE_HEADER' , BAL_DB_LOGNUMBER_GET , APPL_LOG_WRITE_MESSAGES and APPL_LOG_WRITE_DB . In my case am getting all these error me
-
Who wants to watch a grown man cry? I spent a small fortune on a shiny new mac with 64GB Ram and to quote Larry Jordan, "I could rocket to the moon with the power of this computer." I am running OSX (10.9.5) and have a 12 gig per channel ethernet M
-
How do I go from developer 10.9 preview to OSX Full 10.9
So I am in the Mac App store and I see that the full Mavericks is available for download. Earlier I tried downgrading to 10.8 so I could easily upgrade to 10.9, But the preview version wont allow mw to do so. So anyhow I try to download it in the app
-
How to get BOOLEAN from STORED FUNCTION
We are calling legacy PLSQL stored procedures and functions via named queries. This has worked fine so far, but there are some functions which return the type 'BOOLEAN'. e.g. FUNCTION some_function( some_argument IN NUMBER) RETURN BOOLEAN; Where the
-
Snapshot Report History and Edit rights
I have a report that is generating snapshots based on a schedule. I have a user base that have view rights to the library / folder - The only way to allow them to see report history is to give them edit rights.. this doesn't sound right - I have vali