⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 renamedialog.java

📁 emacs的一个非常有用的插件,叫xrefactory,可以实现source insight里的那种函数跳转.和cscope(跳回来不方便)配合使用,非常的不错.
💻 JAVA
字号:
package com.xrefactory.jedit;import javax.swing.*;import java.awt.event.*;import java.awt.*;public class RenameDialog extends JDialog {	public static class RenamePanel extends JPanel implements KeyListener {		JTextField textField;		class ButtonCancel extends JButton implements ActionListener {			ButtonCancel() {super("Cancel"); addActionListener(this);}			public void actionPerformed( ActionEvent e) {				actionCancel();			}		}		class ButtonContinue extends JButton implements ActionListener {			ButtonContinue() {super("Continue"); addActionListener(this);}			public void actionPerformed( ActionEvent e) {				actionContinue();			}		}		void actionContinue() {			s.getParentDialog(this).setVisible(false);		}		void actionCancel() {			s.getParentDialog(this).setVisible(false);			textField.setText("");		}		public void keyTyped(KeyEvent e) {}		public void keyReleased(KeyEvent e) {}		public void keyPressed(KeyEvent e) {			int code = e.getKeyCode();			if (code == KeyEvent.VK_ESCAPE) {				e.consume();				actionCancel();			} else if (code == KeyEvent.VK_ENTER) {				e.consume();				actionContinue();			}		}		RenamePanel(String sort, String oldname) {			super();			int y= -1;			JButton buttons[] = {new ButtonCancel(), 								 new ButtonContinue()};			textField = new JTextField(oldname);			textField.addKeyListener(this);			setLayout(new GridBagLayout());			y++;			s.addGbcComponent(this, 0,y, 2,1, 1,1, 							  GridBagConstraints.BOTH,							  new JPanel());			y++;			s.addGbcComponent(this, 0,y, 2,1, 1,1, 							  GridBagConstraints.NONE,							  new JLabel("  Rename "+sort+" "+oldname+" to  ", SwingConstants.CENTER));			y++;			s.addGbcComponent(this, 0,y, 2,1, 1,1, 							  GridBagConstraints.BOTH,							  new JPanel());			y++;			s.addGbcComponent(this, 0,y, 1,1, 1,1, 							  GridBagConstraints.NONE,							  new JLabel("  new name:", SwingConstants.RIGHT));			s.addGbcComponent(this, 1,y, 1,1, 100,1, 							  GridBagConstraints.HORIZONTAL,							  textField);			y++;			s.addGbcComponent(this, 0,y, 2,1, 1,1, 							  GridBagConstraints.BOTH,							  new JPanel());			y++;			s.addExtraButtonLine(this, 0, y, 2,1, 1,1, buttons,true);			y++;			s.addGbcComponent(this, 0,y, 2,1, 1,1, 							  GridBagConstraints.BOTH,							  new JPanel());		}	}	public String getNewName() {		String newname = ((RenamePanel)getContentPane()).textField.getText();		if (newname.equals("")) return(null);		else return(newname);	}	public RenameDialog(String sort, String oldname) {		super(s.view, "Renaming");		setContentPane(new RenamePanel(sort, oldname));		setModal(true);		pack();		setLocationRelativeTo(s.view);		setVisible(true);	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -