JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java 程式分享區 » Image  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Easy J Shop - A Simple Image Processor [精華]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-03 21:59 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
GitHub

From:
http://openhome.cc

EasyJShop is an easy image processor. It could help you capture screen, open files and do simple image processing, such as copying or cropping a selection, doing a horizontal or vertical mirror, rotating it clockwise or counter-clockwise.


caterpillar edited on 2013-02-22 11:04
reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
ccjack

Java攝影Mac業餘玩家



發文: 101
積分: 6
於 2005-01-03 23:07 user profilesend a private message to usersend email to ccjackreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
現在投奔 Mac OS X了,出現以下錯誤碼,OS X目前只支援1.4.2是這個原因嗎?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
java -jar EasyJShop.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: onlyfun/caterpillar/imageapp/EasyJShop (Unsupported major.minor version 49.0)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)


在OS X重新編譯後執行後,又出現另一問題

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
apple.awt.EventQueueExceptionHandler Caught Throwable : java.lang.Error: Do not use javax.swing.JInternalFrame.add() use javax.swing.JInternalFrame.getContentPane().add() instead
java.lang.Error: Do not use javax.swing.JInternalFrame.add() use javax.swing.JInternalFrame.getContentPane().add() instead
  at javax.swing.JInternalFrame.createRootPaneException(JInternalFrame.java:416)
  at javax.swing.JInternalFrame.addImpl(JInternalFrame.java:443)
  at java.awt.Container.add(Container.java:307)
  at onlyfun.caterpillar.imageapp.EasyJShop.createImageInternalFrame(EasyJShop.java:564)
  at onlyfun.caterpillar.imageapp.EasyJShop.openImageFile(EasyJShop.java:328)
  at onlyfun.caterpillar.imageapp.EasyJShop.access$2(EasyJShop.java:322)
  at onlyfun.caterpillar.imageapp.EasyJShop$3.actionPerformed(EasyJShop.java:175)
  at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1819)
  at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1872)
  at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
  at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
  at javax.swing.AbstractButton.doClick(AbstractButton.java:321)
  at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)
  at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
  at java.awt.Component.processMouseEvent(Component.java:5166)
  at java.awt.Component.processEvent(Component.java:4963)
  at java.awt.Container.processEvent(Container.java:1613)
  at java.awt.Component.dispatchEventImpl(Component.java:3681)
  at java.awt.Container.dispatchEventImpl(Container.java:1671)
  at java.awt.Component.dispatchEvent(Component.java:3543)
  at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3527)
  at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3242)
  at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3172)
  at java.awt.Container.dispatchEventImpl(Container.java:1657)
  at java.awt.Window.dispatchEventImpl(Window.java:1606)
  at java.awt.Component.dispatchEvent(Component.java:3543)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
  at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
  at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
 


依照以上指示在564行修改internalFrame.add(scrollPanel);加了getContentPane()

1
2
3
internalFrame.getContentPane().add(scrollPanel);
 


成功了,可以在Mac OS X執行了 Big Smile

附上執行的畫面


ccjack edited on 2005-06-11 20:05
reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-03 23:30 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
嘿!我的eclipse倒是沒有報這個錯誤。。。加上好了。。。。Big SmileBig SmileBig Smile

原來Swing在Mac OS X下是長這樣喔。。。。Good.....


reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
Duncan

還隱隱作痛

版主

發文: 7816
積分: 39
於 2005-01-03 23:31 user profilesend a private message to usersend email to Duncanreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
caterpillar wrote:
Although I only use the syntax of J2SE 1.4.2 to write all the application here, all the jar files are made up under J2SE 5.0 SDK (using eclipse). If you get a message such as “could not find the main class.Program will exit”, your sdk's version may be under J2SE 5.0. You could just update your sdk to J2SE 5.0 or recompile the sources and make up the jar file under your current environment


如果你希望 1.4 能跑,你至少編譯時要給 -target 1.4,不然你編譯出來的 class file 版號是 49.0,1.5- 的 JRE 一執行就會 reject 掉不會 load class 進來。

1.4 只接受版號為 45.0 ~ 48.0 的 class file。


reply to postreply to post

給我
辣味豆腐 其餘免談
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
ccjack

Java攝影Mac業餘玩家



發文: 101
積分: 6
於 2005-01-03 23:39 user profilesend a private message to usersend email to ccjackreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在Mac OS X的eclipse沒問題,但跑的時候才出現第二個錯誤的,所以....應該是OS X的問題吧...龜毛的OS X ...Embaressed

reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-03 23:47 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
瞭解了!。。。我再將eclipse的專案設成1.4.2環境的好了,我這邊的電腦都換成Tiger了,所以之前沒有注意到。。。

reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-04 00:09 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
將專案換為1.4並重新編譯過了,有沒有人可以幫我試試1.4環境中可不可以直接run的。。。。Tongue

caterpillar edited on 2005-01-04 00:11
reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
ccjack

Java攝影Mac業餘玩家



發文: 101
積分: 6
於 2005-01-04 00:29 user profilesend a private message to usersend email to ccjackreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在Mac OS X 10.3.7可以直接run了Wink

reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
bbsbsai

J@VA+Firefox



發文: 86
積分: 0
於 2005-01-04 00:50 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在windows xp sp1

在jsdk 1.42

可以跑了,真感謝~~


reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:ccjack]
Duncan

還隱隱作痛

版主

發文: 7816
積分: 39
於 2005-01-04 01:22 user profilesend a private message to usersend email to Duncanreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
ccjack wrote:
在Mac OS X的eclipse沒問題,但跑的時候才出現第二個錯誤的,所以....應該是OS X的問題吧...龜毛的OS X ...Embaressed


那是 swing 設計人員故意不讓你把 JFrame/JWindow/JDialog 等 top-level container 當作一般的 container 使用(直接把 component 放進去),他希望 RootPaneContainer 就要依照 root pane 的設計,把一般的元件放在 layered pane 底層的 content pane,故意在 add method 被使用時丟出 exception(除非你改寫 isRootPaneCheckingEnabled method 來傳回 false),編譯時沒事是正常的,跟特定平台的 JRE 實做無關。


reply to postreply to post

給我
辣味豆腐 其餘免談
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
bbsbsai

J@VA+Firefox



發文: 86
積分: 0
於 2005-01-04 10:02 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
請問一下,有沒有快速鍵可以直接screenshot的呢???

reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-04 10:10 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
選單上不是有嗎?Ctrl+G。。。。

reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
dorian

Dorian



發文: 164
積分: 5
於 2005-01-04 11:21 user profilesend a private message to usersend email to dorianreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我在运行的时候发现
如果鼠标动的快一点的话,那个虚线框没有显示耶


reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-04 12:12 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
框線的顯示是以滑鼠左鍵壓下及放開為準,所以應該是您滑鼠左鍵跳開了的問題,您以為您按住開始拉了,但其實在開始拉前滑鼠左鍵已經跳開了。。。。Tongue

另一個可能是滑鼠左鍵連續跳了兩下,在框線拉出後,由於連續跳了兩下,所以框線又重置了。。。嗯。。。應該要加個判斷,滑鼠按下放開的時間間隔太快的話就先不處理,有些滑鼠太敏感的話會需要這個限制的。。。。

還沒改之前,您可以確實的按住,然後任意的快速移動試試,應該不會消失的。。。

嗯。。。或許改成click一下當起點,再click一下作終點會比較清楚。。。。有的影像軟體是這麼作的。。。。不過我是比較習慣按下、拖曳、放開這樣的方式啦。。。。Big SmileBig SmileBig Smile


caterpillar edited on 2005-01-04 12:19
reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-04 12:21 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
程式邏輯應該是沒錯的。。。。只是要再考慮一下滑鼠的性能啦。。。。總之拉慢一些啦。。。。。。。Big SmileBig SmileBig Smile

reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
dorian

Dorian



發文: 164
積分: 5
於 2005-01-04 15:32 user profilesend a private message to usersend email to dorianreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我知道你的问题出在哪了,你把mouseReleased方法中的
((ImageIcon) label.getIcon()).setImage(original)注释掉。
然后运行程序,用你最快的速度来选取,你就知道了。
其实并非你所说的哪样,滑鼠左鍵連續跳了兩下or滑鼠左鍵跳開
还有个问题,我想问为什么要在mousePressed方法中每次都要取label的Image,还要每次都初始化(我指initGraphics())?
不可以一开始就保存一个Image吗?然后每次paint的时候在此image上画框框,不知可否?


reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:dorian]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-04 18:22 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
將mouseReleased()中的那段注掉,您的label中的圖就是BufferedImage了喔!這樣下次您再從label取得的就是畫過虛線的圖,結果就是虛線不會消失了。。。。

我當中的作法是在mouseReleased()時,將原圖設回label中,因為您作影像處理時要取得的,不是畫過虛線的BufferedImage,而是拿原圖來作,不將原圖設回的話,是可以解決滑鼠放開的問題,但是您試試拉框線後直接作翻轉,會發現虛線還在。。。

至於initGraphics()每次都要重新作的原因,是因為考慮裁圖後,BufferedImage要根據裁剪後的大小重新產生,Graphics物件也就要再取得一次,您可以試試不initGraphics(),裁圖後再按按該圖,結果圖片會跑回來喔。。。。

當然,這是我目前還想不到更好的作法下的權宜之計,其實這個EasyJShop就是之前我的JScreenShot改的,之前的作法是直接繼承JLabel,這就省事多了,因為可以在繼承的類中直接保留原圖,但這次我不想這麼作,想作不繼承JLabel的話,可以怎麼作,所以繞了一下彎。。。。

總之,您的建議我之前試過,但會有bug。。。。不過我想mouseReleased()與initGraphics()的問題,應該還有更好的方式可以解決,可以再討論討論。。。Smile


reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-04 18:26 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
至於目前方案您所說的框線會消失問題,就是在mouseReleased()中的那段,我將原圖設回了,而在您放開滑鼠的某個瞬間,有個動作引發重繪動作,我覺得滑鼠的問題只是一個可能,不知道還有沒有其它的可能性。。。。

reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
ccjack

Java攝影Mac業餘玩家



發文: 101
積分: 6
於 2005-01-04 20:58 user profilesend a private message to usersend email to ccjackreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在Mac OS X滑鼠再快都不會有框線消失的問題

reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
T55555

Java, Ruby, Haskell

版主

發文: 1026
積分: 24
於 2005-01-05 00:18 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Many mouse events will create a lot of new Graphics2D object ( on initGraphics() method ),
that will use a lot of memory (especially you never call Graphics2D.dispose to release the memory as quick as possible when no needed).

Reuse the JLabel image with selection is not a good idea.
You could try use Z-order notion; use the glass pane or other layered pane ( transparent background to see your label image, and draw selection dash-line on foreground of glass pane or other layered pane)

More info: http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html

BTW: there is an other bug on your code:
(1) drag mouse the select the region ( see the dash-line rectangle )
(2) click the mouse to make the dash-line rectange disappear
(3) select menu / crop ...
It seems to me that when we do not see the selection rectangle,
that should act like no-selection, instead of hidden-selection.
It will confuse user.

Good Luck.

=======================
other discussion is between J2SE version.
Have a look at this article:
http://java.sun.com/developer/JDCTechTips/2004/tt1102.html#2

on 1.4 JFrame.add( ... ) will get exception...
many people at beginning are not used to it and complain about that.
after a while, when everybody used to it.
And now, we change back ?! Stupid
And the way is not like Frame.add, so, a new article to tell you what's happend...


T55555 edited on 2005-01-05 00:35
reply to postreply to post
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-05 01:01 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
先說一下。。。我加入了批次處理的功能。。有需要的人可以重新下載。。。。:D:D:D

會產生新物件,主要是在mousePressed()中的BufferedImage:
1
2
3
4
5
6
7
8
    public void mousePressed(MouseEvent e) {
        original = ((ImageIcon) label.getIcon()).getImage();
        bufferedImage = new BufferedImage(original.getWidth(label), original.getHeight(label), BufferedImage.TYPE_INT_RGB);
        initGraphics();
        ((ImageIcon) label.getIcon()).setImage(bufferedImage);
        paintDashedRect(null);
        start = e.getPoint();
    }


關於物件在拖曳時會產生太多物件我想倒是不致於,(我倒是真的忘了要dispose()。。。。)看看initGraphics(),可以重用的我都重用了:
1
2
3
4
5
6
    private void initGraphics() {
        g = bufferedImage.getGraphics();
        g2 = (Graphics2D) g;
        g2.setStroke(stroke);
        g2.setPaint(Color.black);
    }


當然了,如果使用者無聊的不斷的去點圖片,而不做任何事那就。。。。

至於使用者的習慣問題,其實就是照我的習慣來寫的,因為主要是我想用這些功能,我之前的文章也說過了,要解決框線問題,換個方式可能會不錯,即按下當起點,再按一下當終點,這會解決不少問題,不過主要是我的習慣還是目前的方式,至於按一下滑鼠框線消失也是按照我的習慣來作的。。。。。:P

如果想要改變一下框線的處理,您可以直接改SelectedRectHandler中的MouseListener, MouseMotionListener介面實作方式,其它什麼都不用改,您可以改為自己習慣的方式。。。。:)

其實框線處理在這個程式中算是最難處理的,大家討論也主要是針對這部份,目前好像還沒一個好的事件處理方式,使用者介面的部份是比較難處理一些,我寫影像處理的部份(ImageProcessor與ScreenCaptureHelper)只花了快一個小時,但寫UI花了半天。。。。

有興趣的可以自已針對一些不滿意的地方改寫,基本上除了我個人寫寫當作小工具使用之外,主要是在練習一些想法的實現,不算是個很好可用的作品,但我保留了相當的修改彈性,其實這次發表程式有這麼多回應我還蠻高興的,這表示我的程式還蠻容易看懂的。。。。:)


caterpillar edited on 2005-01-05 01:06
reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-05 11:13 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
那個GlassPane的例子,我看了後竟然試不太出來,它的範例有重新分送事件,與這有關嗎?

寫一個最簡單的開始:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import javax.swing.*;
 
import java.awt.*;
 
public class Test extends JFrame {
    public Test() {
        JComponent glass = new JComponent() {
            protected void paintComponent(Graphics g) {
        
                g.setColor(Color.red);
                g.fillOval(100, 100, 20, 20);
        
            }
        };
        
        this.setGlassPane(glass);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(300, 300);
        setVisible(true);
    }
 
    public static void main(String[] args) {
        new Test();
    }
}


結果是空白一片。。。Sad

GlassPane是否不會自動重繪呢?需要時要自己repaint(),那個範例程式不知道是不是事件處理模糊了焦點,我看不出還有哪邊需要注意,還是事件處理才是重點?


reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
Duncan

還隱隱作痛

版主

發文: 7816
積分: 39
於 2005-01-05 14:19 user profilesend a private message to usersend email to Duncanreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
caterpillar wrote:
那個GlassPane的例子,我看了後竟然試不太出來,它的範例有重新分送事件,與這有關嗎?

寫一個最簡單的開始:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import javax.swing.*;
 
import java.awt.*;
 
public class Test extends JFrame {
    public Test() {
        JComponent glass = new JComponent() {
            protected void paintComponent(Graphics g) {
        
                g.setColor(Color.red);
                g.fillOval(100, 100, 20, 20);
        
            }
        };
        
        this.setGlassPane(glass);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(300, 300);
        setVisible(true);
    }
 
    public static void main(String[] args) {
        new Test();
    }
}


結果是空白一片。。。Sad

GlassPane是否不會自動重繪呢?需要時要自己repaint(),那個範例程式不知道是不是事件處理模糊了焦點,我看不出還有哪邊需要注意,還是事件處理才是重點?


glass pane 預設是 invisible and non-opaque,你要設定為 visible 才看的見 glass pane。


Duncan edited on 2005-01-13 18:59
reply to postreply to post

給我
辣味豆腐 其餘免談
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-05 14:50 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
試出來了,原來是要用setVisible()才行啊,謝謝T5555與Duncan。。。。

程式也改好了,在拉框時不用BufferedImage來反覆替代了,這一次,動再快也不會消失。。。。喔!耶!。。。。Big SmileBig SmileBig Smile

那個批次處理的一個小bug也修正了,有需要的可以重新下載。。。。


reply to postreply to post
良葛格學習筆記
作者 Re:Easy J Shop - A Simple Image Processor [Re:caterpillar]
caterpillar

良葛格

版主

發文: 2613
積分: 70
於 2005-01-05 16:14 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
對了,也謝謝dorian點出滑鼠的問題,讓一些討論不斷的進行,也很感謝ccjack在Mac下幫我作的測試。。。。

程式分享版很久沒有這樣的討論了。。。。Smile


reply to postreply to post
良葛格學習筆記
go to first page go to previous page  1   2   3  go to next page go to last page
» JWorld@TW »  Java 程式分享區 » Image

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8