锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲AV电影天堂男人的天堂,亚洲av无码国产精品色在线看不卡 ,亚洲Av无码国产一区二区http://www.tkk7.com/zhaochengming/category/28388.html 鐭ユ鑰屽悗鏈夊畾錛屽畾鑰屽悗鑳介潤錛岄潤鑰屽悗鑳藉畨錛屽畨鑰屽悗鑳借檻錛岃檻鑰屽悗鑳藉緱銆傜墿鏈夋湰鏈紝浜嬫湁緇堝銆傜煡鎵鍏堝悗錛屽垯榪戦亾鐭c?/description>zh-cnWed, 11 Aug 2010 15:53:07 GMTWed, 11 Aug 2010 15:53:07 GMT60java 鑷甫椋庢牸http://www.tkk7.com/zhaochengming/archive/2010/07/21/326709.htmlhelloworld2008helloworld2008Wed, 21 Jul 2010 02:42:00 GMThttp://www.tkk7.com/zhaochengming/archive/2010/07/21/326709.htmlhttp://www.tkk7.com/zhaochengming/comments/326709.htmlhttp://www.tkk7.com/zhaochengming/archive/2010/07/21/326709.html#Feedback0http://www.tkk7.com/zhaochengming/comments/commentRss/326709.htmlhttp://www.tkk7.com/zhaochengming/services/trackbacks/326709.html

]]>
Swing--緙栬緫鍣?http://www.tkk7.com/zhaochengming/archive/2008/03/05/184105.htmlhelloworld2008helloworld2008Wed, 05 Mar 2008 14:25:00 GMThttp://www.tkk7.com/zhaochengming/archive/2008/03/05/184105.htmlhttp://www.tkk7.com/zhaochengming/comments/184105.htmlhttp://www.tkk7.com/zhaochengming/archive/2008/03/05/184105.html#Feedback0http://www.tkk7.com/zhaochengming/comments/commentRss/184105.htmlhttp://www.tkk7.com/zhaochengming/services/trackbacks/184105.html
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Map;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JToolBar;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.JTextComponent;


public class EditPlus extends JFrame {
    
private Action openAction;
    
private Action saveAction;
    
private Action closeAction;
    
    
private JTextComponent textComp;
    
private Map actionMap = new Hashtable();
    
    
public EditPlus() {
        
super("EditPlus瀛︿範");
        textComp 
= createTextCompoent();
        
this.setSize(400300);
        
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        initActionProperty();
        Container c 
= this.getContentPane();
        c.add(
new JScrollPane(textComp), BorderLayout.CENTER);
        c.add(createToolBar(), BorderLayout.NORTH);
        
this.setJMenuBar(createMenuBar());        
        
    }
    
    
protected JTextComponent createTextCompoent() {
        JTextArea a 
= new JTextArea();
        a.setLineWrap(
true);
        
return a;
    }
    
    
// 鍒濆鍖朅ction鐨勪竴浜涗俊鎭?濡傚浘鏍囩瓑
    protected void initActionProperty() {
        Action a 
= null;
        a 
= textComp.getActionMap().get(DefaultEditorKit.cutAction);
        a.putValue(Action.SMALL_ICON, 
new ImageIcon("icons/cut.gif"));
        a.putValue(Action.NAME, 
"鍓垏");
        
        a 
= textComp.getActionMap().get(DefaultEditorKit.copyAction);
        a.putValue(Action.SMALL_ICON, 
new ImageIcon("icons/copy.gif"));
        a.putValue(Action.NAME, 
"澶嶅埗");

        a 
= textComp.getActionMap().get(DefaultEditorKit.pasteAction);
        a.putValue(Action.SMALL_ICON, 
new ImageIcon("icons/paste.gif"));
        a.putValue(Action.NAME, 
"綺樿創(chuàng)");
        
        a 
= textComp.getActionMap().get(DefaultEditorKit.selectAllAction);
        a.putValue(Action.NAME, 
"鍏ㄩ儴閫夊畾");
    }
    
    
// 鍒涘緩ToolBar
    protected JToolBar createToolBar() {
        JToolBar bar 
= new JToolBar();
        bar.add(getOpenAction()).setText(
"");
        bar.add(getSaveAction()).setText(
"");
        bar.addSeparator();

        JButton cutBtn 
= bar.add(textComp.getActionMap().get(DefaultEditorKit.cutAction));
        JButton copyBtn 
= bar.add(textComp.getActionMap().get(DefaultEditorKit.copyAction));
        JButton pasterBtn 
= bar.add(textComp.getActionMap().get(DefaultEditorKit.pasteAction));
        cutBtn.setText(
"");
        copyBtn.setText(
"");
        pasterBtn.setText(
"");
        
return bar;
    }
    
    
// 鍒涘緩MenuBar
    protected JMenuBar createMenuBar() {
        JMenuBar bar 
= new JMenuBar();
        JMenu file 
= new JMenu("鏂囦歡");
        JMenu edit 
= new JMenu("緙栬緫");
        bar.add(file);
        bar.add(edit);
        
        file.add(getOpenAction());
        file.add(getSaveAction());
        file.add(getCloseAction());
        
        edit.add(textComp.getActionMap().get(DefaultEditorKit.cutAction));
        edit.add(textComp.getActionMap().get(DefaultEditorKit.copyAction));
        edit.add(textComp.getActionMap().get(DefaultEditorKit.pasteAction));
        edit.add(textComp.getActionMap().get(DefaultEditorKit.selectAllAction));        
        
return bar;
    }
    
    
protected Action getOpenAction() {
        
if (openAction == null)
            openAction 
= new OpenAction();
        
return openAction;
    }
    
    
protected Action getSaveAction() {
        
if (saveAction == null)
            saveAction 
= new SaveAction();
        
return saveAction;
    }
    
    
protected Action getCloseAction() {
        
if (closeAction == null)
            closeAction 
= new CloseAction();
        
return closeAction;
    }
    
    
protected JTextComponent getTextComponent() {
        
return textComp;
    }
    
    
public class OpenAction extends AbstractAction {
        
public OpenAction() {
            
super("鎵撳紑"new ImageIcon("icons/open.gif"));
        }
        
public void actionPerformed(ActionEvent e) {
            JFileChooser fc 
= new JFileChooser();
            
if (fc.showOpenDialog(EditPlus.this!= JFileChooser.APPROVE_OPTION) 
                
return;
            File f 
= fc.getSelectedFile();
            
if (f == null
                
return;
            FileReader fr 
= null;
            
try {
                fr 
= new FileReader(f);
                textComp.read(fr, 
null);
            } 
catch (Exception ee) {
                showWarnDialog(
"璇繪枃浠跺紓甯?",ee.toString());
            } 
finally {
                
if (fr != null) {
                    
try {
                        fr.close();
                    } 
catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
            }
        }
    }
    
    
public class SaveAction extends AbstractAction {
        
public SaveAction() {
            
super("淇濆瓨"new ImageIcon("icons/save.gif"));
        }
        
        
public void actionPerformed(ActionEvent e) {
            JFileChooser fc 
= new JFileChooser();
            
if (fc.showSaveDialog(EditPlus.this!= JFileChooser.APPROVE_OPTION)
                
return;
            File f 
= fc.getSelectedFile();
            
if (f == null)
                
return;
            
            FileWriter fw 
= null;
            
try {
                fw 
= new FileWriter(f);
                textComp.write(fw);
            } 
catch (Exception ee) {
                showWarnDialog(
"淇濆瓨鏂囦歡寮傚父!",ee.toString());
            } 
finally {
                
try {
                    
if (fw != null)
                        fw.close();
                } 
catch (IOException eee) {
                    eee.printStackTrace();
                }
            }
        }
    }
    
    
public class CloseAction extends AbstractAction {
        
public CloseAction() {
            
super("鍏抽棴");
        }
        @Override
        
public void actionPerformed(ActionEvent e) {
            System.exit(
0);
        }        
    }
    
    
public void showWarnDialog(String msg, String warn) {
        JPanel p 
= new JPanel();
        JLabel label 
= new JLabel(msg);
        label.setFont(label.getFont().deriveFont(Font.BOLD));
        JTextArea area 
= new JTextArea(warn);
        area.setOpaque(
false);
        area.setLineWrap(
true);
        area.setPreferredSize(
new Dimension(280100));
        p.setLayout(
new BorderLayout());
        p.add(
new JLabel(" "), BorderLayout.CENTER);
        p.add(label, BorderLayout.NORTH);
        p.add(
new JScrollPane(area), BorderLayout.SOUTH);
        JOptionPane.showMessageDialog(EditPlus.
this, p, "寮傚父淇℃伅"
                JOptionPane.WARNING_MESSAGE);

    }
    
    
public static void main(String args[]) {
        Utils.setLookAndFeel();
        EditPlus ep 
= new EditPlus();
        ep.setVisible(
true);
    }
}


]]>
Java Swing 瀛︿範絎旇(1) -- JTablehttp://www.tkk7.com/zhaochengming/archive/2008/02/29/182971.htmlhelloworld2008helloworld2008Fri, 29 Feb 2008 08:32:00 GMThttp://www.tkk7.com/zhaochengming/archive/2008/02/29/182971.htmlhttp://www.tkk7.com/zhaochengming/comments/182971.htmlhttp://www.tkk7.com/zhaochengming/archive/2008/02/29/182971.html#Feedback0http://www.tkk7.com/zhaochengming/comments/commentRss/182971.htmlhttp://www.tkk7.com/zhaochengming/services/trackbacks/182971.html榪欎釜渚嬪瓙鏄疛Table鍙互閫夋嫨琛屽拰鍒楋紝鐣岄潰濡傚浘


浠g爜濡備笅

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableModel;

public class A7_SelectionModel extends JFrame {
    
public A7_SelectionModel() {
        
super("Selection Model Test");
        setSize(
450350);
        
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        TableModel m 
= new AbstractTableModel() {
            
public int getColumnCount() {
                
return 10;
            }

            
public int getRowCount() {
                
return 10;
            }

            
public Object getValueAt(int r, int c) {
                
return "" + (r+1)*(c+1);
            }            
        };
        
        
final JTable jt = new JTable(m);
        
        
this.getContentPane().add(new JScrollPane(jt), BorderLayout.CENTER);
        
        JPanel controlPanel, buttonPanel, columnPanel, rowPanel;
        
        buttonPanel 
= new JPanel();
        
final JCheckBox cellBox, columnBox, rowBox;
        cellBox 
= new JCheckBox("Cells", jt.getCellSelectionEnabled());
        columnBox 
= new JCheckBox("Columns", jt.getColumnSelectionAllowed());
        rowBox 
= new JCheckBox("Rows", jt.getRowSelectionAllowed());
        
        cellBox.addActionListener(
new ActionListener() {
            
public void actionPerformed(ActionEvent e) {
                jt.setCellSelectionEnabled(cellBox.isSelected());
                columnBox.setSelected(jt.getColumnSelectionAllowed());
                rowBox.setSelected(jt.getRowSelectionAllowed());
            }
        });
        columnBox.addActionListener(
new ActionListener() {
            
public void actionPerformed(ActionEvent e) {
                jt.setColumnSelectionAllowed(columnBox.isSelected());
                cellBox.setSelected(jt.getCellSelectionEnabled());
            }
        });
        rowBox.addActionListener(
new ActionListener() {
            
public void actionPerformed(ActionEvent e) {
                jt.setRowSelectionAllowed(rowBox.isSelected());
                cellBox.setSelected(jt.getCellSelectionEnabled());
            }
        });
        
        buttonPanel.add(
new JLabel("Selections allowed:"));
        buttonPanel.add(cellBox);
        buttonPanel.add(columnBox);
        buttonPanel.add(rowBox);
        
        columnPanel 
= new JPanel();
        ListSelectionModel csm 
= jt.getColumnModel().getSelectionModel();
        JLabel columnCounter 
= new JLabel("(Selected Column INdices Go Here)");
        csm.addListSelectionListener(
new SelectionDebugger(columnCounter, csm));
        columnPanel.add(
new JLabel("Selected columns:"));
        columnPanel.add(columnCounter);
        
        rowPanel 
= new JPanel();
        ListSelectionModel rsm 
= jt.getColumnModel().getSelectionModel();
        JLabel rowCounter 
= new JLabel("(Selected Row INdices Go Here)");
        rsm.addListSelectionListener(
new SelectionDebugger(columnCounter, csm));
        rowPanel.add(
new JLabel("Selected Rows:"));
        rowPanel.add(rowCounter);
        
        controlPanel 
= new JPanel(new GridLayout(01));
        controlPanel.add(buttonPanel);
        controlPanel.add(columnPanel);
        controlPanel.add(rowPanel);
        
        
this.getContentPane().add(controlPanel, BorderLayout.SOUTH);
        
    }
    
class SelectionDebugger implements ListSelectionListener  {
        JLabel debugger;
        ListSelectionModel model;
        
public SelectionDebugger(JLabel l, ListSelectionModel m) {
            
this.debugger = l;
            
this.model = m;
        }
        
public void valueChanged(ListSelectionEvent e) {
            
if (!e.getValueIsAdjusting()) {
                StringBuffer buf 
= new StringBuffer();
                
int[] selecton = getSelectonIndices(model.getMinSelectionIndex(),
                        model.getMaxSelectionIndex());
                
if (selecton.length == 0) {
                    buf.append(
"NONE");
                } 
else {
                    
for (int i = 0; i < selecton.length - 1; i++) {
                        buf.append(selecton[i]);
                        buf.append(
",");
                    }
                    buf.append(selecton[selecton.length 
- 1]);
                }
                debugger.setText(buf.toString());
            }
        }
        
        
protected int[] getSelectonIndices(int start, int stop) {
            
if ((start == -1|| (stop == -1)) {
                
return new int[0];
            }
            
            
int guesses[] = new int[stop - start + 1];
            
int index = 0;
            
for (int i = start; i <= stop; i++) {
                
if (model.isSelectedIndex(i)) {
                    guesses[index
++= i;
                }
            }
            
int realthing[] = new int[index];
            System.arraycopy(guesses, 
0, realthing, 0, index);
            
return realthing;
        }
        
        
    }
    
public static void main(String args[]) {
        AbmUtils.setLookAndFeel();
        A7_SelectionModel s 
= new A7_SelectionModel();
        s.setVisible(
true);
    }
}


]]>
主站蜘蛛池模板: 国产成人免费高清在线观看| 78成人精品电影在线播放日韩精品电影一区亚洲 | 91亚洲精品麻豆| 夭天干天天做天天免费看| 亚欧乱色国产精品免费视频| 亚洲伊人久久综合中文成人网| 国产免费AV片在线观看| 国产成人精品日本亚洲11| 亚洲人AV永久一区二区三区久久| 蜜桃视频在线观看免费视频网站WWW| 日韩亚洲国产高清免费视频| 亚洲色成人网站WWW永久| 成年性午夜免费视频网站不卡| aaa毛片免费观看| 亚洲熟妇无码av另类vr影视| 亚洲国产另类久久久精品| 日韩免费福利视频| 1000部羞羞禁止免费观看视频| 杨幂最新免费特级毛片| 亚洲啪啪免费视频| 亚洲深深色噜噜狠狠爱网站| 午夜网站免费版在线观看| 6080午夜一级毛片免费看6080夜福利| 新最免费影视大全在线播放| 亚洲男人的天堂久久精品 | 亚洲欧美成人av在线观看| 国产成人精品日本亚洲网站 | 亚洲伦理一二三四| 亚洲第一AV网站| 亚洲成人国产精品| 夜夜爽免费888视频| 91香蕉在线观看免费高清| 国产99精品一区二区三区免费| 国产精品高清视亚洲一区二区| 亚洲Av无码精品色午夜| 国产精品亚洲综合一区| 好大好硬好爽免费视频| 亚洲精品免费网站| 24小时日本电影免费看| 国产婷婷成人久久Av免费高清| 人人公开免费超级碰碰碰视频|