Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-05-2007, 07:05 PM
Member
 
Join Date: Nov 2007
Posts: 12
daredavil82 is on a distinguished road
menu inserting table in the document
this is menu for insert image in the document i create it....the problem with this menu is i can insert image inside the document but cannot save the image went i save the document. the image disappear by it self. the image also cannot resize using mouse pointer like in open office or micorosft word..any want able to make this code work????????plz..



Code:
ItemInsertImage.setText(imagemenu); ItemInsertImage.setToolTipText("Masukkan Imej"); ItemInsertImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/thumbnail_tiny.png"))); ItemInsertImage.setComponentOrientation(java.awt.ComponentOrientation.RIGHT_TO_LEFT); ItemInsertImage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { fc = new JFileChooser(); fc.addChoosableFileFilter(m_gifFilter); fc.addChoosableFileFilter(m_jpgFilter); fc.setDialogTitle("\u0645\u0627\u0633\u0648\u0642\u06A9\u0646\u0020\u0627\u064A\u0645\u064A\u062C"); fc.setComponentOrientation(java.awt.ComponentOrientation.RIGHT_TO_LEFT); fc.setFileFilter(m_gifFilter); fc.removeChoosableFileFilter(m_rtfFilter); Thread runner = new Thread() { public void run() { if (fc.showOpenDialog(OJMain.this) != JFileChooser.APPROVE_OPTION) return; OJMain.this.repaint(); File fChoosen = fc.getSelectedFile(); ImageIcon icon = new ImageIcon(fChoosen.getPath()); int w = icon.getIconWidth(); int h = icon.getIconHeight(); if (w<=0 || h<=0) { JOptionPane.showMessageDialog(OJMain.this,"\u0645\u0639\u0627\u0641,\u0020\u0641\u0627\u0674\u064A\u0644\u0020\u06AC\u0627\u0645\u0628\u0631\u0020\u06AC\u0627\u06AC\u0644\u0020\u062F\u0628\u0627\u0686.\n"+fChoosen.getPath(), error , JOptionPane.WARNING_MESSAGE); return; } MutableAttributeSet attr = new SimpleAttributeSet(); StyleConstants.setIcon(attr, icon); int p = tpOpenJawi.getCaretPosition(); try { m_doc.insertString(p, " ", attr); } catch (BadLocationException ex) {} // Its ok to do this outside of the event-dispatching // thread because the chooser is not visible here. fc.addChoosableFileFilter(m_rtfFilter); fc.setFileFilter(m_rtfFilter); fc.removeChoosableFileFilter(m_gifFilter); fc.removeChoosableFileFilter(m_jpgFilter); } }; runner.start(); } }); MenuTools.add(ItemInsertImage);
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create Popup Menu with Sub Menu while right-clicking the JTree Node?? Kabiraa AWT / Swing 7 05-09-2008 09:54 AM
Inserting current date into a DB table Java Tip Java Tips 0 02-15-2008 10:38 AM
Inserting into a table (Example) Java Tip Java Tips 0 02-06-2008 11:25 AM
Inserting file in to database Java Tip Java Tips 0 01-07-2008 10:39 AM
inserting bit value in sqlserver2000 using hibernate javadev Database 0 06-07-2007 04:15 PM


All times are GMT +3. The time now is 03:30 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org