Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java GUI 设计 » Swing  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 倡议重新整理tame
windcao





发贴: 6
积分: 0
于 2005-02-24 15:31 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我最近刚从官方网站上当下的tame有很多例子不能使用。包里也有些方法是废弃的。大家合力整理一下吧。附件是kavinwang 修改的一个要数开张的了

GroupableHeaderExample.java (5.49k)



作者 Re:倡议重新整理tame [Re:windcao]
臧圩人





发贴: 63
积分: 15
于 2005-02-24 16:17 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
官方网站地址是什么?


作者 Re:倡议重新整理tame [Re:windcao]
windcao





发贴: 6
积分: 0
于 2005-02-24 17:43 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
呵呵,也许是我弄错了,http://www.physci.org/codes/tame/index.jsp
据说tame作者不干了 99年写的,和现在jdk有些出入所以有好些要改的地方



作者 呵呵,我来贡献一个 [Re:windcao]
windcao





发贴: 6
积分: 0
于 2005-02-25 10:05 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
/* (swing1.1.1beta2)*/
package tame.examples;

import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.ImageObserver;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableColumn;

/**
@author Nobuo Tamemasa
@version 1.0 06/19/99
*/
public class AnimatedIconHeaderExample extends JFrame {

private static Object[][] data = null;
private static String[] column = null;
public static Object[][] getData(){
if(data==null)
data=new Object[][]{
{"Leopard","Lycaon"},
{"Jaguar" ,"Jackal"},
{"Cheetah","Coyote"},
{"Puma" ,"Dingo" },
{"Lynx" ,"Fox" },
{"Tom" ,"Hot" }};
return data;
}
public static String[] getColumn(){
  if (column==null){
   column=new String[]{"Cat","Dog"};
   }
  return column;
}
public AnimatedIconHeaderExample(){
super( "AnimatedIconHeader Example" );

  
ImageIcon[] icons = {new ImageIcon("images/3-119.gif"),
new ImageIcon("images/3-6.gif")};

DefaultTableModel model = new DefaultTableModel() {
public int getColumnCount() { return getColumn().length; }
public int getRowCount() {
return getData().length;
}
public String getColumnName(int col) {
return getColumn()[col];
}
public Object getValueAt(int row, int col) {
return getData()[row][col];
}
};

JTable table = new JTable( model ){
public TableColumn getColumn(Object identifier) {
System.out.println("give me a rander");
(new MyTableColumn()).creatHeaderRenderer(super.getColumn(identifier));
return super.getColumn(identifier);
}

class MyTableColumn extends TableColumn{

private MyTableColumn() {
super();
}
/**
* @param column
*/
public void creatHeaderRenderer(TableColumn superColumn) {
if(superColumn.getHeaderRenderer()==null){
superColumn.setHeaderRenderer(super.createDefaultHeaderRenderer());
System.out.println("have a rander");
}
}

}
};
JTableHeader header = table.getTableHeader();
JLabel renderer;
for (int i=0;i<model.getColumnCount();i++) {
renderer = (JLabel)table.getColumn(model.getColumnNameLight Bulb).getHeaderRenderer();
if (renderer!=null)
renderer.setIcon(icons[i]);
else
System.out.println("nullrander");

// If you have only one column.
// icons[i].setImageObserver(header);

icons[i].setImageObserver(new HeaderImageObserver(header, i));
}
JScrollPane pane = new JScrollPane(table);
getContentPane().add(pane);
}

class HeaderImageObserver implements ImageObserver {
JTableHeader header;
int col;

HeaderImageObserver(JTableHeader header, int col) {
this.header = header;
this.col = col;
}

public boolean imageUpdate(Image img, int flags,
       int x, int y, int w, int h) {
if ((flags & (FRAMEBITS|ALLBITS)) != 0) {
Rectangle rect = header.getHeaderRect(col);
header.repaint(rect);
}
return (flags & (ALLBITS|ABORT)) == 0;
}
}

public static void main(String[] args) {
AnimatedIconHeaderExample frame = new AnimatedIconHeaderExample();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setSize( 300, 140 );
frame.setVisible(true);
}
}



作者 Re:倡议重新整理tame [Re:windcao]
windcao





发贴: 6
积分: 0
于 2005-02-25 10:08 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
呵呵,上面这个是个带图标的表格头的例子,奇怪的是好像没用到jame自带的东西。



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923