Swing/RatingLabel のバックアップ差分(No.7)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/RatingLabel へ行く。
- 1 (2006-08-21 (月) 11:55:27)
- 2 (2006-08-21 (月) 14:45:47)
- 3 (2006-08-23 (水) 17:33:51)
- 4 (2006-11-07 (火) 12:38:34)
- 5 (2006-11-09 (木) 20:53:32)
- 6 (2007-08-23 (木) 23:03:37)
- 7 (2008-10-20 (月) 18:20:37)
- 8 (2008-11-25 (火) 11:19:25)
- 9 (2012-10-20 (土) 04:20:53)
- 10 (2013-02-24 (日) 22:31:53)
- 11 (2013-12-10 (火) 20:18:42)
- 12 (2014-01-31 (金) 21:23:15)
- 13 (2014-11-28 (金) 16:31:17)
- 14 (2016-02-16 (火) 19:35:51)
- 15 (2017-07-11 (火) 15:31:58)
- 16 (2018-02-24 (土) 19:51:30)
- 17 (2018-07-12 (木) 18:07:59)
- 18 (2018-12-19 (水) 20:39:43)
- 19 (2020-11-12 (木) 09:41:03)
- 20 (2022-11-16 (水) 16:41:11)
- 追加された行はこの色です。
- 削除された行はこの色です。
TITLE:RGBImageFilterでアイコンの色調を変更 #navi(../) *RGBImageFilterでアイコンの色調を変更 [#w9fce2db] >編集者:[[Terai Atsuhiro>terai]]~ 作成日:2006-08-21~ 更新日:&lastmod; Posted by [[terai]] at 2006-08-21 #contents **概要 [#l9857d29] RGBImageFilterで色調を変更したアイコンの用意し、評価用コンポーネントを作成します。 -&jnlp; -&jar; -&zip; #screenshot **サンプルコード [#a85a2963] #code{{ private final ImageProducer ip = orgIcon.getImage().getSource(); private MyLabel makeLabel(float[] filter) { SelectedImageFilter sif = new SelectedImageFilter(filter); ImageIcon imageIcon = new ImageIcon( createImage(new FilteredImageSource(ip, sif))); return new MyLabel(imageIcon); } private class SelectedImageFilter extends RGBImageFilter { private final float[] filter; public SelectedImageFilter(float[] filter) { this.filter = filter; canFilterIndexColorModel = true; } public int filterRGB(int x, int y, int argb) { Color color = new Color(argb, true); float[] array = new float[4]; color.getComponents(array); return new Color(array[0]*filter[0], array[1]*filter[1], array[2]*filter[2], array[3]).getRGB(); } } private final ImageProducer ip = orgIcon.getImage().getSource(); private MyLabel makeLabel(float[] filter) { SelectedImageFilter sif = new SelectedImageFilter(filter); ImageIcon imageIcon = new ImageIcon( createImage(new FilteredImageSource(ip, sif))); return new MyLabel(imageIcon); } private class SelectedImageFilter extends RGBImageFilter { private final float[] filter; public SelectedImageFilter(float[] filter) { this.filter = filter; canFilterIndexColorModel = true; } public int filterRGB(int x, int y, int argb) { Color color = new Color(argb, true); float[] array = new float[4]; color.getComponents(array); return new Color(array[0]*filter[0], array[1]*filter[1], array[2]*filter[2], array[3]).getRGB(); } } }} -&jnlp; -&jar; -&zip; **解説 [#s11c2ccf] RGBImageFilterを使用して、一つのアイコンから複数の色の異なるアイコンを生成しています。 上記のサンプルは、アマゾンなど((いろんな所でよく見かけるのですが、オリジナルは何処なんでしょうか?))でよく見かける5段階の評価を行うコンポーネントです。クリックしたアイコンの位置が評価レベルになります。 **参考リンク [#s1cec87d] -[[XP Style Icons - Windows Application Icon, Software XP Icons>http://www.icongalore.com/]] --アイコンを利用しています。 **コメント [#afaf0ed0] - 「Rating Bar」と言うみたいです。[[Masuga Design » Unobtrusive AJAX Star Rating Bar>http://www.masugadesign.com/the-lab/scripts/unobtrusive-ajax-star-rating-bar/]] -- [[terai]] &new{2006-11-07 (火) 12:38:34}; #comment 素晴しい!:)