package rtkanchor;
|
import java.awt.BorderLayout;
|
import java.awt.Color;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.util.Iterator;
|
import java.util.List;
|
import java.util.Vector;
|
import javax.swing.Box;
|
import javax.swing.ImageIcon;
|
import javax.swing.JPanel;
|
import javax.swing.JScrollPane;
|
import javax.swing.JTable;
|
import javax.swing.table.DefaultTableModel;
|
import ColorAndFont.English;
|
import ColorAndFont.UIColor;
|
import ColorAndFont.buttonTitle;
|
import PbuliClass.JButtonModel;
|
import PbuliClass.Systems;
|
import PbuliClass.greateTables;
|
import PbuliClass.jinternalFrame;
|
@SuppressWarnings("rawtypes")
|
public class Now_rtk_move extends jinternalFrame {
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 1L;
|
|
|
JPanel inJpanel=null;//ÄÚ²¿Ãæ°å
|
JPanel northJpanel=null;//±±²¿Ãæ°å
|
JPanel centerJpanel=null;//Öв¿Ãæ°å
|
|
JButtonModel shuaxin=null;//ˢа´Å¥
|
JTable table=null;//ÉêÃ÷±í¸ñ
|
DefaultTableModel tableModel=null;//±í¸ñÄ£ÐÍ
|
List list=null;
|
JScrollPane gd;
|
Vector rowData=null;
|
|
public Now_rtk_move() {
|
rowData=new Vector();
|
this.setTitle(English.name("µ±Ç°Á¬½ÓµÄ²î·ÖÒÆ¶¯¶Ë", "RTKSET"));
|
this.setFrameIcon(new ImageIcon("image/icon/rtkac.png"));//ÉèÖô°Ìåͼ±ê
|
this.add(getInJpanel());
|
}
|
|
/**»ñÈ¡ÄÚ²¿´°ÌåµÄÄÚ²¿Ãæ°å*/
|
public JPanel getInJpanel() {
|
if(inJpanel==null) {
|
inJpanel=new JPanel();
|
inJpanel.setLayout(new BorderLayout());//ÉèÖÃÃæ°åΪ±ß½ç²¼¾Ö
|
inJpanel.setBackground(Color.WHITE);//ÉèÖÃÃæ°å±³¾°Îª°×É«
|
inJpanel.add(getNorthJpanel(),BorderLayout.NORTH);
|
inJpanel.add(getGd(),BorderLayout.CENTER);
|
}
|
return inJpanel;
|
}
|
|
/**»ñÈ¡±±²¿Ãæ°å*/
|
public JPanel getNorthJpanel() {
|
if(northJpanel==null) {
|
northJpanel=new JPanel();
|
Box topicBox = Box.createHorizontalBox();// ´´½¨Ò»¸öˮƽÏäÈÝÆ÷
|
topicBox.add(getShuaxin());//Ìí¼Óˢа´Å¥
|
northJpanel.add(topicBox );
|
}
|
|
return northJpanel;
|
}
|
|
|
|
/**»ñȡˢа´Å¥µÄ·½·¨*/
|
public JButtonModel getShuaxin() {
|
if(shuaxin==null){
|
shuaxin=new JButtonModel(buttonTitle.getRefresh());
|
shuaxin.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
updateTable();
|
}
|
});
|
|
}
|
return shuaxin;
|
}
|
|
|
|
|
/**»ñÈ¡¹ö¶¯Ãæ°åµÄ·½·¨*/
|
public JScrollPane getGd() {
|
gd=new JScrollPane(getTable());
|
gd.getViewport().setBackground(UIColor.getNorth_color());
|
return gd;
|
}
|
|
|
/**Ìí¼Ó±í¸ñÐÐÏòÁ¿Êý¾Ý·½·¨*/
|
@SuppressWarnings("unchecked")
|
public void getRowData(Vector<Urt> list ) {
|
Iterator<Urt> iterator = list.iterator();//´´½¨µü´úÆ÷
|
while (iterator.hasNext()) {//µü´úÆ÷´æÔÚÔªËØ
|
Urt jz = iterator.next();//½«µü´úÆ÷ÀïÃæµÄÔªËØ¸øµ½info¼¯ºÏ
|
Vector row = new Vector();
|
if(jz !=null) {
|
String IP=jz.getIp();
|
String PORT=jz.getPort();
|
String TIME=jz.getTime();
|
row.add(IP);
|
row.add(PORT);
|
row.add(TIME);
|
tableModel.addRow(row);// Ïò±í¸ñ¶ÔÏóÌí¼ÓÐÐÊý¾Ý
|
}
|
}
|
|
}
|
|
|
/**±í¸ñ*/
|
@SuppressWarnings("serial")
|
public JTable getTable() {
|
if(table==null) {
|
String name1="IPµØÖ·";
|
String name2="¶Ë¿Ú";
|
String name3="ʱ¼ä";
|
|
if(Systems.sys().getLanguage().equals("English")) {
|
name1="IP";
|
name2="PORT";
|
name3="TIME";
|
|
}
|
|
String[] columnNames= {name1,name2,name3};//±í¸ñÁÐÃû
|
//Ìí¼Ó±í¸ñÁÐÏòÁ¿
|
Vector<String> columnName=new Vector<>();
|
for(int i=0;i<columnNames.length;i++){
|
columnName.add(columnNames[i]);
|
}
|
|
greateTables tables=new greateTables();
|
tableModel=new DefaultTableModel(rowData, columnName){ // ʵÏÖÈÃÕû¸ö±í¸ñ²»²»ÔÊÐí±»±à¼
|
public boolean isCellEditable(int row,int column){
|
return false;
|
}
|
};
|
table=tables.getTable(tableModel);
|
getRowData(Dell_urt.getVc_urt());
|
|
}
|
return table;
|
}
|
|
|
/**ˢбí¸ñ·½·¨*/
|
public void updateTable() {
|
if(tableModel !=null) {
|
tableModel.getDataVector().clear();
|
getRowData(Dell_urt.getVc_urt());
|
gd.validate();
|
}
|
}
|
|
|
}
|