My Notepad

I have spent near more two weeks to write this Notepad application. At this moment,I want to share with you.

I wonder that do you kNow the Notepad in Windows XP/7. If you have no idea,I am pleasure to display the Notepad 

in Windows 7 with you,and it displays as below:

It has large future and simple interface,so does my Notepad!

Well,I will introduce my Notepad.

First,Let's look at the structure of the my Notepad application:

=================================================The structure of the project:=================================================   -src/main/java       -com.b510.notepad              -client                   -Client.java              -common                   -Common.java              -ui                   -AboutUI.java                   -FindManagerUI.java                   -FontManagerUI.java                   -FontSizeManagerUI.java                   -JUI.java                   -MainUI.java                   -NotepadUI.java                   -ReplaceManagerUI.java                   -SkinManagerUI.java             -util                   -EditMenuUtil.java                   -FileMenuUtil.java                   -FormatMenuUtil.java                   -HelpMenuUtil.java                   -NotepadUtil.java                   -ViewMenuUtil.java            -log4j.properties             -lib                  -skin                       -substance-1.0.jar            -pom.xml

=================================================Describe for all files: =================================================

-Client.java --> The entry of the notepad application. It contains the main method. -Common.java --> All constants in here. -AboutUI.java --> About notepad page. -FindManagerUI.java --> Find page. -FontManagerUI.java --> Font setting page. -FontSizeManagerUI.java --> Font sizt setting page. -JUI.java --> The parent class for the NotepadUI,It extends JFrame. -MainUI.java --> The main page of the notepad. -NotepadUI.java --> The parent class for the MainUI,It extends JUI and implements ActionListener. -ReplaceManagerUI.java --> Replace page. -SkinManagerUI.java --> Skin setting page. -EditMenuUtil.java --> Edit menu functions provider. -FileMenuUtil.java --> File menu functions provider. -FormatMenuUtil.java --> Format menu functions provider. -HelpMenuUtil.java --> Help menu functions provider. -NotepadUtil.java --> Common functions provider. -ViewMenuUtil.java --> View menu functions provider. -log4j.properties --> A properties for the log4j. -substance-1.0.jar --> substance dependency. -pom.xml --> pom.xml

=================================================How to add substance to your project build path?=================================================

NOTE: Your computer should install the Maven(apache-maven-3.2.2 is good choice) before running this project!There are TWO ways to provided.

1. Using eclipse tool to add the substance-1.0.jar to project build path.  1.1.Finding the substance-1.0.jar with the path "notepad/lib/skin/substance-1.0.jar".     Right Click --> Build Path --> Add to Build Path.  1.2.Then open the opm.xml(with the path "notepad/pom.xml")      Deleting the substance dependency:            org.jvnet.substance   substance   1.0   

2. Copy the substance-1.0.jar to your repository.  2.1.Finding the substance-1.0.jar with the path "notepad/lib/skin/substance-1.0.jar".   Copying the substance-1.0.jar file to your repository.   The default path of the repository is "${user.home}/.m2/repository/org/jvnet/substance/substance/1.0/substance-1.0.jar"

=================================================How to run notepad project?================================================= Using the eclipse tool and finding the Client.java file with the path "notepad/src/main/java/com/b510/notepad/client/Client.java". Right Click --> Run As --> Java Application

==================

Some UIs Show

==================

1.

2.

3.

4.

5.

6.

7.

8.

9.

10. Change Skin

=================================================Source Code:=================================================

MainUI ui = }

String HYPHEN = "-" String EMPTY = "" String NEW_LINE = "\r\n" String BLANK = " " String QUESTION_MARK = "?" String POINT = "." String COLOR = ":" String START = "*" String TXT = "txt" String TXT_FILE = START + POINT + String UNTITLE = "Untitled" String NOTEPAD = "Notepad" String NOTEPAD_NOTEPAD = BLANK + HYPHEN + BLANK + String TITLE = UNTITLE + String SYstem_EXIT = "System exit" String SYstem_OPEN = "System open" String FILE = "File" String EDIT = "Edit" String FORMAT = "Format" String VIEW = "View" String Help = "Help" String NEW = "New" String OPEN = "Open..." String SAVE = "Save" String SAVE_AS = "Save as..." String PROPERTIES = "Properties" String EXIT = "Exit" String UNDO = "Undo" String copY = "copy" String PASTE = "Paste" String CUT = "Cut" String DELETE = "Delete" String FIND = "Find..." String FIND_NEXT = "Find Next" String REPLACE = "Replace" String GO_TO = "Go To..." String SELECT_ALL = "Select All" String TIME_DATE = "Time/Date" String WORD_WRAP = "Word Wrap" String RESET_FONT = "Reset Font" String FONT = "Font" String FONT_STYLE = "Font Style" String FONT_SIZE_TITLE = "Font Size" String STATUS_BAR = "Status Bar" String SKIN = "Change Skin" String VIEW_HELP = "View Help" String ABOUT_NOTEPAD = "About NotePad" stroke A = 'A' N = 'N' O = 'O' L = 'L' Z = 'Z' C = 'C' D = 'D' W = 'W' H = 'H' F = 'F' V = 'V' X = 'X' G = 'G' S = 'S' P = 'P' T = 'T' SPACE = ' ' String IMAGE_PATH = "images/" String HONGTEN_PIC = IMAGE_PATH + "hongten.png" String AUTHOR = "Author" String AUTHOR_NAME = "Hongten" String AUTHOR_DESC = "I'm " + String ITEM = "Item" String DESCRIPTION = "Desctiption" String APPLICATION = "Application" String NAME = "Name" String APPLICATION_NAME = APPLICATION + BLANK + String NOTEPAD_APP = String APPLICATION_DESCRIPTION = APPLICATION + BLANK + String APPLICATION_DESCRIPTION_DETAIL = "A " + String VERSION = "Version" String VERSION_VALUE = "1.0" String BLOG = "Blog" String HOME_PAGE = "http://www.cnblogs.com/hongten" String NOTEPAD_PUBLISHED_PAGE = HOME_PAGE + "/p/hongten_notepad_index.html" String NOTEPAD_SUBSTANCE_SKINS_PAGE = HOME_PAGE + "/p/hongten_notepad_substance_skins.html" String SUBSTANCE_SKINS_PAGE = NOTEPAD_SUBSTANCE_SKINS_PAGE + "#" String NOTEPAD_PUBLISHED_BOOKMARK_PAGE = NOTEPAD_PUBLISHED_PAGE + "#" TABLE_ROW_HEIGHT = 20 String CONFIM_EXIT = "Confim Exit" String ACCESS_URL_REQUEST = "Access URL Request" String ACCESS_URL = "Access URL : " String FONT_LUCIDA_CONSOLE = "Lucida Console" String FONT_TYPE = "宋体" FONT_SIZE = 12 FONT_NUM = 148 FONT_SIZE_NUM = 4 FONT_STYLE_NUM = 0 String FONT_STYLE_DEFAULT = "Regular" String DATE_FORMAT = "HH:mm MM/dd/yyyy" String THIS_IS_A_SIMPLE = "This is a Simple" String SIMPLE = "Simple" String CURRENT_SINK = "Current Skin" + BLANK + COLOR + String DESCRIPTION_WITH_COLOR = DESCRIPTION + BLANK + COLOR + String CURRENT_FONT = "Current Font" + BLANK + COLOR + String CURRENT_FONT_SIZE = "Current Font Size" + BLANK + COLOR + String CURRENT_FONT_STYLE = "Current Font Style" + BLANK + COLOR + String DO_YOU_WANT_TO_SAVE_CHANGES = "Do you want to save changes?" String WHAT_DO_YOU_WANT_TO_FIND = "Please type what do you want to find." String CAN_NOT_FIND = "Cannot find " String MATCHES_REPLACED = " matches replaced!" String FIND_WHAT = "Find What :" String REPLACE_TO = "Replace To :" String REPLACE_ALL = "Replace All" String CASE_SENSITIVE = "Case Sensitive" String FORWARD = "Forward" String BACKWARD = "Backward" String CANCEL = "Cancel" String GB2312 = "GB2312" String NOTEPAD_HOME_PAGE = "Home Page" String NOTEPAD_SKINS = "Notepad Skins" String SOURCE = "Source" String SOURCE_CODE = SOURCE + " Code" String SOURCE_CODE_DOWNLOAD = SOURCE_CODE + " Download" String NOTEPAD_API = "Notepad API" String SOURCE_CODE_BOOKMARK = "Source.Code" String SOURCE_CODE_DOWNLOAD_BOOKMARK = SOURCE_CODE_BOOKMARK + ".Download" String NOTEPAD_API_BOOKMARK = "Notepad.API" }

Help --> About Notepad
AboutUI display the information about this application.
displaying in front of this page.
) if you click 'Yes'.
 AboutUI aboutUI = new AboutUI("About Notepad");
 

AboutUI serialVersionUID = 1L Logger log = Logger.getLogger(AboutUI. setAlwaysOnTop( addWindowListener( AboutUI..setVisible( distoryAboutUI(); .setVisible( setResizable( .setLocation(MainUI.pointX + 100,MainUI.pointY + 150 hongtenButton.setIcon( ImageIcon( Object[][] values = String[] titles = aboutUITable.setModel( serialVersionUID = 1L [] canEdit = [] { , isCellEditable( rowIndex, aboutUITable.setCursor( aboutUITable.setopaque( aboutUITable.setSurrendersFocusOnKeystroke( aboutUITable.getTableHeader().setReorderingallowed( aboutUITable.addMouseListener( mousepressed(MouseEvent e) { (e.getClickCount() == 2 id = String url = (String) aboutUITable.getValueAt(id,1 logoperation(); logoperation() { option = JOptionPane.showConfirmDialog(AboutUI.,Common.ACCESS_URL + Common.HOME_PAGE + Common.BLANK + (option == descriptionLabel.setFont( java.awt.Font(Common.FONT_LUCIDA_CONSOLE,1,18 mainPanel = hongtenButton = rightScrollPane = aboutUITable = descriptionLabel = .help = GroupLayout mainPanelLayout = mainPanelLayout.setHorizontalGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addContainerGap().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(hongtenButton).addComponent(descriptionLabel,GroupLayout.PREFERRED_SIZE,265,GroupLayout.PREFERRED_SIZE)).addGap(18,18,18).addComponent(rightScrollPane,243 mainPanelLayout.setVerticalGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addContainerGap().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING,).addComponent(rightScrollPane,Short.MAX_VALUE).addGroup(mainPanelLayout.createSequentialGroup().addComponent(hongtenButton,256,GroupLayout.PREFERRED_SIZE).addGap(18,18).addComponent(descriptionLabel,31,GroupLayout.PREFERRED_SIZE))).addGap(0,0 GroupLayout layout = arallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(mainPanel,GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE).addContainerGap())); arallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(mainPanel,Short.MAX_VALUE).addContainerGap())); }

Box; dioButton; FindManagerUI serialVersionUID = 1L Logger log = Logger.getLogger(FindManagerUI. dioButton backwardJRadioButton; Box caseSensitiveJCheckBox; dioButton forwardJRadioButton; isForward = isCaseSensitive = setAlwaysOnTop( addWindowListener( distoryFindManagerUI(); .setVisible( setResizable( .setLocation(MainUI.pointX + 100,MainUI.pointY + 150 bGJPanel = findWhatJLabel = keyWordJTextField = caseSensitiveJCheckBox = Box(); findNextJButton = cancelJButton = forwardJRadioButton = dioButton(); backwardJRadioButton = dioButton(); forwardJRadioButton.setSelected( dioButton.setText(Common.FORWARD); forwardJRadioButton.addActionListener( dioButton.setText(Common.BACKWARD); backwardJRadioButton.addActionListener( cancelJButton.setMaximumSize( Dimension(87,23 cancelJButton.setMinimumSize( Dimension(87,23 cancelJButton.setPreferredSize( Dimension(87,23 cancelJButton.addActionListener( findNextJButton.addActionListener( Box.setText(Common.CASE_SENSITIVE); caseSensitiveJCheckBox.addActionListener( ( == textArea.getSelectedText() || } ( != textArea.getSelectedText() && ! } (e.getSource() ==dioButton) { directionOfOperation( } (e.getSource() ==dioButton) { directionOfOperation( } (e.getSource() == } (e.getSource() == distoryFindManagerUI(); } (e.getSource() ==Box) { findWhat = JOptionPane.showMessageDialog(FindManagerUI.informatION_MESSAGE); keyWordJTextField.setFocusable( distoryFindManagerUI() { FindManagerUI..setVisible( distoryFindManagerUI(); ( ==Box.getSelectedobjects()) { isCaseSensitive = } isCaseSensitive = Forward : directionOfOperation(true); Backward : directionOfOperation(false); aramb = true; Forward is selected; b = false; Backward is selected.
directionOfOperation( isForward = dioButton.setSelected(b); backwardJRadioButton.setSelected(! .edit = GroupLayout bGJPanelLayout = bGJPanelLayout.setHorizontalGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(bGJPanelLayout.createSequentialGroup().addContainerGap().addGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(bGJPanelLayout.createSequentialGroup().addComponent(findWhatJLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(keyWordJTextField,221,GroupLayout.PREFERRED_SIZE)).addGroup(bGJPanelLayout.createSequentialGroup().addComponent(caseSensitiveJCheckBox).addGap(18,18).addComponent(forwardJRadioButton).addGap(18,18).addComponent(backwardJRadioButton))).addGap(18,18arallelGroup(GroupLayout.Alignment.LEADING).addComponent(findNextJButton,GroupLayout.Alignment.TRAILING,Short.MAX_VALUE).addComponent(cancelJButton,Short.MAX_VALUE)).addContainerGap())); bGJPanelLayout.setVerticalGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(bGJPanelLayout.createSequentialGroup().addGap(14,14,14).addGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(findWhatJLabel).addComponent(keyWordJTextField,GroupLayout.PREFERRED_SIZE).addComponent(findNextJButton)).addGap(18,18arallelGroup(GroupLayout.Alignment.BASELINE).addComponent(cancelJButton,GroupLayout.PREFERRED_SIZE).addComponent(caseSensitiveJCheckBox).addComponent(forwardJRadioButton).addComponent(backwardJRadioButton)).addContainerGap())); GroupLayout layout = arallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(bGJPanel,Short.MAX_VALUE).addContainerGap())); arallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(bGJPanel,Short.MAX_VALUE).addContainerGap())); }

BoxModel; Box; arator; FontManagerUI serialVersionUID = -37011351219515242L arator line; JComboBoxBox; GraphicsEnvironment ge = String fontNames[] = String FONT_TYPE = FONT_SIZE = String FONT_STYPLE = setAlwaysOnTop( addWindowListener( FontManagerUI..setVisible( distoryFontManagerUI(); .setVisible( setResizable( .setLocation(MainUI.pointX + 100,MainUI.pointY + 150 fontJComboBox.setModel( DefaultComboBoxModel i = 0 fontNum = i++ Box.setSelectedindex(fontNum); fontJComboBox.addActionListener( currentFontDescJLabel.setFont( currentFontJLabel = fontJComboBox = JComboBox descJlabel = currentFontDescJLabel = line = arator(); (e.getSource() ==Box) { fontNum =Box.getSelectedindex(); Box.getSelectedItem().toString()); FontManagerUI.FONT_TYPE =Box.getSelectedItem().toString(); currentFontDescJLabel.setFont( textArea.setFont( .format = GroupLayout layout = arallelGroup(GroupLayout.Alignment.LEADING).addGroup( .addGap(40,40,40 arallelGroup(GroupLayout.Alignment.BASELINE).addComponent(currentFontJLabel) .addComponent(fontJComboBox,GroupLayout.PREFERRED_SIZE)).addGap(26,26,26 .addComponent(line,11 .addComponent(descJlabel).addGap(18,18).addComponent(currentFontDescJLabel).addContainerGap(47 arallelGroup(GroupLayout.Alignment.LEADING) .addGap(21,21,21 arallelGroup(GroupLayout.Alignment.LEADING) .addComponent(fontJComboBox,195 .addGroup(layout.createSequentialGroup().addComponent(line,355,GroupLayout.PREFERRED_SIZE).addGap(0,Short.MAX_VALUE))); }

BoxModel; Box; arator; FontSizeManagerUI serialVersionUID = -37011351219515242L arator line; JComboBoxBox; String fontSizes[] = {"8","9","10","11","12","14","16","18","20","22","24","26","28","36","48","72" setAlwaysOnTop( addWindowListener( FontSizeManagerUI..setVisible( distoryFontSizeManagerUI(); .setVisible( setResizable( .setLocation(MainUI.pointX + 100,MainUI.pointY + 150 fontSizeJComboBox.setModel( DefaultComboBoxModel i = 0 (Integer.valueOf(size) == fontSizeNum = i++ Box.setSelectedindex(fontSizeNum); fontSizeJComboBox.addActionListener( currentFontSizeDescJLabel.setFont( currentFontSizeJLabel = fontSizeJComboBox = JComboBox descJlabel = currentFontSizeDescJLabel = line = arator(); (e.getSource() ==Box) { fontNum =Box.getSelectedindex(); Box.getSelectedItem().toString()); FontManagerUI.FONT_SIZE =Box.getSelectedItem()); currentFontSizeDescJLabel.setFont( textArea.setFont( .format = GroupLayout layout = arallelGroup(GroupLayout.Alignment.LEADING).addGroup( .addGap(40,40 arallelGroup(GroupLayout.Alignment.BASELINE).addComponent(currentFontSizeJLabel) .addComponent(fontSizeJComboBox,26 .addComponent(line,GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(descJlabel).addGap(18,18).addComponent(currentFontSizeDescJLabel).addContainerGap(47 arallelGroup(GroupLayout.Alignment.LEADING) .addGap(21,21 arallelGroup(GroupLayout.Alignment.LEADING) .addComponent(fontSizeJComboBox,GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup().addComponent(line,Short.MAX_VALUE))); }

BoxModel; Box; arator; FontStyleManagerUI serialVersionUID = -37011351219515242L arator line; JComboBoxBox; String fontStyles[] = {"Regular","Italic","Bold","Bold Italic" setAlwaysOnTop( addWindowListener( FontStyleManagerUI..setVisible( distoryFontSizeManagerUI(); .setVisible( setResizable( .setLocation(MainUI.pointX + 100,MainUI.pointY + 150 fontStyleJComboBox.setModel( DefaultComboBoxModel i = 0 fontStyleNum = i++ Box.setSelectedindex(fontStyleNum); fontStyleJComboBox.addActionListener( currentFontStyleDescJLabel.setFont( currentFontStyleJLabel = fontStyleJComboBox = JComboBox descJlabel = currentFontStyleDescJLabel = line = arator(); (e.getSource() ==Box) { fontStyleNum =Box.getSelectedindex(); FontManagerUI.FONT_STYPLE =Box.getSelectedItem(); currentFontStyleDescJLabel.setFont( textArea.setFont( .format = GroupLayout layout = arallelGroup(GroupLayout.Alignment.LEADING).addGroup( .addGap(40,40 arallelGroup(GroupLayout.Alignment.BASELINE).addComponent(currentFontStyleJLabel) .addComponent(fontStyleJComboBox,26 .addComponent(line,GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(descJlabel).addGap(18,18).addComponent(currentFontStyleDescJLabel).addContainerGap(47 arallelGroup(GroupLayout.Alignment.LEADING) .addGap(21,21 arallelGroup(GroupLayout.Alignment.LEADING) .addComponent(fontStyleJComboBox,GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup().addComponent(line,Short.MAX_VALUE))); }

jdialog; nessBlackSteelSkin; araSkin; java.awt.JFrame,there are three methods provided:
getSkin() to change the frame skin.
MagmaSkin .You can change value to change
setJUI() to refresh the page when you change the value. JUI serialVersionUID = 1L Logger log = Logger.getLogger(JUI. skinNum = 11 skinNums value,and the default skin is MagmaSkin aramskinNum value SubstanceAbstractSkin getSkin( 1 skin = 2 skin = nessBlackSteelSkin(); 3 skin = 4 skin = 5 skin = 6 skin = 7 skin = 8 skin = 9 skin = 10 skin = 11 skin = 12 skin = 13 skin = 14 skin = 15 skin = 16 skin = 17 skin = 18 skin = 19 skin = 20 skin = 21 skin = araSkin(); skin = UIManager.setLookAndFeel( JFrame.setDefaultLookAndFeelDecorated( jdialog.setDefaultLookAndFeelDecorated( SubstanceLookAndFeel.setCurrentTheme( SubstanceLookAndFeel.setCurrentButtonShaper( SubstanceLookAndFeel.setCurrentWatermark( SubstanceLookAndFeel.setCurrentBorderPainter( SubstanceLookAndFeel.setCurrentGradientPainter( } printstacktrace(); .title = }

arator; stroke; MainUI serialVersionUID = 1L Logger log = Logger.getLogger(MainUI. arator line; copy,paste,cut,find,findNext,replace,selectAll,timeDate; String filePath = saved = lineWrap = pointX = 0 pointY = 0 String savedText = fontNum = fontSizeNum = fontStyleNum = String findWhat = pointX = pointY = ( ( .setResizable( .setBounds( Rectangle(150,100,800,550 .setVisible( addWindowListener( FileMenuUtil file = file.exit(MainUI. setdisabledMenuAtCreating( menuBar = file = news = news.addActionListener( stroke.getKeystroke(Common.N,InputEvent.CTRL_MASK)); open = open.addActionListener( stroke.getKeystroke(Common.O,InputEvent.CTRL_MASK)); save = save.addActionListener( stroke.getKeystroke(Common.S,InputEvent.CTRL_MASK)); saveAs = saveAs.addActionListener( saveAs.setAccelerator(Keystroke.getKeystroke(Common.S,InputEvent.CTRL_MASK + line = arator(); properties = properties.addActionListener( line = arator(); exit = exit.addActionListener( edit = undo = undo.addActionListener( stroke.getKeystroke(Common.Z,InputEvent.CTRL_MASK)); line = arator(); cut = cut.addActionListener( stroke.getKeystroke(Common.X,InputEvent.CTRL_MASK)); copy = copY); copy.addActionListener( copy.setAccelerator(Keystroke.getKeystroke(Common.C,InputEvent.CTRL_MASK)); copy); paste = paste.addActionListener( stroke.getKeystroke(Common.V,InputEvent.CTRL_MASK)); line = arator(); find = find.addActionListener( stroke.getKeystroke(Common.F,InputEvent.CTRL_MASK)); findNext = findNext.addActionListener( findNext.setAccelerator(Keystroke.getKeystroke(Common.F,InputEvent.CTRL_MASK + replace = replace.addActionListener( stroke.getKeystroke(Common.H,InputEvent.CTRL_MASK)); line = arator(); selectAll = selectAll.addActionListener( stroke.getKeystroke(Common.A,InputEvent.CTRL_MASK)); timeDate = timeDate.addActionListener( stroke.getKeystroke(Common.T,InputEvent.CTRL_MASK)); format = wordWrap = wordWrap.addActionListener( stroke.getKeystroke(Common.W,InputEvent.CTRL_MASK)); resetFont = resetFont.addActionListener( line = arator(); font = font.addActionListener( fontSize = fontSize.addActionListener( fontStyle = fontStyle.addActionListener( view = skin = skin.addActionListener( help = viewHelp = homePage = homePage.addActionListener( skinPage = skinPage.addActionListener( source = .soURCE); sourceCode = .soURCE_CODE); sourceCode.addActionListener( sourceCodeDownload = .soURCE_CODE_DOWNLOAD); sourceCodeDownload.addActionListener( api = api.addActionListener( line = arator(); about = about.addActionListener( undoManager = setdisabledMenuAtCreating( copy.setEnabled(b); setdisabledMenuAtSelecting( copy.setEnabled(b); textArea = textArea.setLineWrap( lineWrap = textAreaFont = textArea.getDocument().addUndoableEditListener( textArea.addCaretListener( ( != savedText && != setSaved( } setSaved( textArea.setFocusable( setdisabledMenuAtCreating( textArea.addMouseMotionListener( textAreaScroll = textArea.setFocusable( String selectText = ( != setdisabledMenuAtSelecting( } setdisabledMenuAtSelecting( (e.getSource() == FileMenuUtil.news(MainUI. } (e.getSource() == FileMenuUtil file = file.open(MainUI. } (e.getSource() == FileMenuUtil.save(MainUI. } (e.getSource() == FileMenuUtil.saveAs(MainUI. } (e.getSource() == FileMenuUtil file = file.readProperties(MainUI. } (e.getSource() == FileMenuUtil file = file.exit(MainUI. (e.getSource() == } (e.getSource() ==copy) { copy(); } (e.getSource() == } (e.getSource() == } (e.getSource() == EditMenuUtil edit = } (e.getSource() == EditMenuUtil edit = } (e.getSource() == EditMenuUtil edit = } (e.getSource() == } (e.getSource() == (e.getSource() == } (e.getSource() == FormatMenuUtil format = format.resetFont(MainUI. } (e.getSource() == FormatMenuUtil format = format.font(MainUI. } (e.getSource() == FormatMenuUtil format = format.fontSize(MainUI. } (e.getSource() == FormatMenuUtil format = format.fontStyle(MainUI. (e.getSource() == ViewMenuUtil view = view.skin(MainUI. (e.getSource() == } (e.getSource() == } (e.getSource() == .soURCE_CODE); NotepadUtil.accessURL(Common.NOTEPAD_PUBLISHED_BOOKMARK_PAGE +.soURCE_CODE_BOOKMARK); } (e.getSource() == .soURCE_CODE_DOWNLOAD); NotepadUtil.accessURL(Common.NOTEPAD_PUBLISHED_BOOKMARK_PAGE +.soURCE_CODE_DOWNLOAD_BOOKMARK); } (e.getSource() == NotepadUtil.accessURL(Common.NOTEPAD_PUBLISHED_BOOKMARK_PAGE + } (e.getSource() == HelpMenuUtil help = help.about(MainUI. setSaved( .saved = }

NotepadUI class extends JUI and implements ActionListener. NotepadUI JUI serialVersionUID = 1L ( == mainUI = }

Box; ReplaceManagerUI serialVersionUID = 1L Logger log = Logger.getLogger(ReplaceManagerUI. Box caseSensitiveJCheckBox; etoJLabel; etoJTextField; isCaseSensitive = String replaceWord = replaceCount = 0 setAlwaysOnTop( addWindowListener( distoryReplaceManagerUI(); .setVisible( setResizable( .setLocation(MainUI.pointX + 100,MainUI.pointY + 150 etoTextField(); Box(); bGJPanel = findWhatJLabel = replacetoJLabel = findWordJTextField = replacetoJTextField = caseSensitiveJCheckBox = Box(); findNextJButton = replaceJButton = replaceAllJButton = cancelJButton = etoJLabel.setText(Common.REPLACE_TO); ( == textArea.getSelectedText() || } ( != textArea.getSelectedText() && ! } etoTextField() { etoJTextField.setText(Common.EMPTY); Box() { Box.setText(Common.CASE_SENSITIVE); caseSensitiveJCheckBox.addActionListener( findNextJButton.setMaximumSize( Dimension(99,23 findNextJButton.setMinimumSize( Dimension(99,23 findNextJButton.setPreferredSize( Dimension(99,23 findNextJButton.addActionListener( replaceJButton.setMaximumSize( Dimension(99,23 replaceJButton.setMinimumSize( Dimension(99,23 replaceJButton.setPreferredSize( Dimension(99,23 replaceJButton.addActionListener( replaceAllJButton.addActionListener( cancelJButton.setMaximumSize( Dimension(99,23 cancelJButton.setMinimumSize( Dimension(99,23 cancelJButton.setPreferredSize( Dimension(99,23 cancelJButton.addActionListener( (e.getSource() == (! } } (e.getSource() == (! } } (e.getSource() == (! } } (e.getSource() == distoryReplaceManagerUI(); } (e.getSource() ==Box) { JOptionPane.showMessageDialog(ReplaceManagerUI.informatION_MESSAGE); findWordJTextField.setFocusable( findWhat = replaceWord =etoJTextField.getText(); (! } distoryReplaceManagerUI() { ReplaceManagerUI..setVisible( distoryReplaceeManagerUI(); ( ==Box.getSelectedobjects()) { isCaseSensitive = } isCaseSensitive = .edit = GroupLayout bGJPanelLayout = arallelGroup(GroupLayout.Alignment.LEADING).addGroup( bGJPanelLayout.createSequentialGroup().addContainerGap().addGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING,).addGroup(bGJPanelLayout.createSequentialGroup().addComponent(findWhatJLabel).addGap(18,18).addComponent(findWordJTextField,227,GroupLayout.PREFERRED_SIZE)).addGroup(bGJPanelLayout.createSequentialGroup().addComponent(replacetoJLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(replacetoJTextField))).addComponent(caseSensitiveJCheckBox)).addGap(18,Short.MAX_VALUE).addComponent(replaceJButton,Short.MAX_VALUE).addComponent(replaceAllJButton,Short.MAX_VALUE)).addContainerGap())); arallelGroup(GroupLayout.Alignment.LEADING).addGroup( bGJPanelLayout.createSequentialGroup().addGap(17,17,17).addGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(bGJPanelLayout.createSequentialGroup().addGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(findWhatJLabel).addComponent(findWordJTextField,GroupLayout.PREFERRED_SIZE)).addGap(12,12,12arallelGroup(GroupLayout.Alignment.BASELINE).addComponent(replacetoJLabel).addComponent(replacetoJTextField,GroupLayout.PREFERRED_SIZE).addComponent(replaceJButton,GroupLayout.PREFERRED_SIZE))).addComponent(findNextJButton,GroupLayout.PREFERRED_SIZE)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(replaceAllJButton) .addGroup(bGJPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(bGJPanelLayout.createSequentialGroup().addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(cancelJButton,GroupLayout.PREFERRED_SIZE)).addGroup(bGJPanelLayout.createSequentialGroup().addGap(2,2,2).addComponent(caseSensitiveJCheckBox))).addContainerGap(8 GroupLayout layout = arallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(bGJPanel,Short.MAX_VALUE))); arallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(bGJPanel,Short.MAX_VALUE).addContainerGap())); }

BoxModel; Box; arator; SkinManagerUI serialVersionUID = 1L arator line; JComboBoxBox; String[][] skins = { { "AutumnSkin","1","What is the AutumnSkin skin?" },{ "BusinessBlackSteelSkin","2","What is the BusinessBlackSteelSkin skin?" },{ "ChallengerDeepSkin","3","What is the ChallengerDeepSkin skin?" },{ "CremeCoffeeSkin","4","What is the CremeCoffeeSkin skin?" },{ "CremeSkin","5","What is the CremeSkin skin?" },{ "EbonyHighContrastSkin","6","What is the EbonyHighContrastSkin skin?" },{ "EmeraldDuskSkin","7","What is the EmeraldDuskSkin skin?" },{ "FieldOfWheatSkin","8","What is the FieldOfWheatSkin skin?" },{ "FindingNemoSkin","What is the FindingNemoSkin skin?" },{ "GreenMagicSkin","What is the GreenMagicSkin skin?" },{ "MagmaSkin","What is the MagmaSkin skin?" },{ "MangoSkin","What is the MangoSkin skin?" },{ "MistSilverSkin","13","What is the MistSilverSkin skin?" { "ModerateSkin","What is the ModerateSkin skin?" },{ "NebulaBrickWallSkin","15","What is the NebulaBrickWallSkin skin?" },{ "NebulaSkin","What is the NebulaSkin skin?" },{ "OfficeBlue2007Skin","17","What is the OfficeBlue2007Skin skin?" },{ "RavenGraphiteGlassSkin","What is the RavenGraphiteGlassSkin skin?" },{ "RavenGraphiteSkin","19","What is the RavenGraphiteSkin skin?" },{ "RavenSkin","What is the RavenSkin skin?" },{ "SaharaSkin","21","What is the SaharaSkin skin?" String[] os = ( i = 0; i < skins.length; i++ os[i] = skins[i][0 ( i = 0; i < skins.length; i++ (skins[i][0 Object[] os = Object[skins[i].length - 1 ( j = 0; j < os.length; j++ os[j] = skins[i][j + 1 setAlwaysOnTop( addWindowListener( SkinManagerUI..setVisible( distorySkinManagerUI(); .setVisible( setResizable( .setLocation(MainUI.pointX + 100,MainUI.pointY + 150 String[] skinNames = sinkJComboBox.setModel( DefaultComboBoxModel sinkJComboBox.setSelectedindex(skinNum - 1 sinkJComboBox.addActionListener( currentSkinDescJLabel.setText(skins[skinNum][2 currentSkinDescJLabel.addMouseListener( Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + Common.SUBSTANCE_SKINS_PAGE +Box.getSelectedItem()); } printstacktrace(); mousepressed(MouseEvent e) { currentSkinJLabel = sinkJComboBox = JComboBox descJlabel = currentSkinDescJLabel = line = arator(); (e.getSource() ==Box) { Object[] os =Box.getSelectedItem()); String index = (String) os[0 String desc = (String) os[1 skinNum = .view = GroupLayout layout = layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(40,40).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(currentSkinJLabel).addComponent(sinkJComboBox,26).addComponent(line,11,GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(descJlabel).addGap(18,18).addComponent(currentSkinDescJLabel).addContainerGap(47 layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(21,21).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(currentSkinDescJLabel).addComponent(descJlabel).addGroup(layout.createSequentialGroup().addComponent(currentSkinJLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(sinkJComboBox,195,GroupLayout.PREFERRED_SIZE))).addContainerGap(GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addComponent(line,Short.MAX_VALUE))); }

EditMenuUtil serialVersionUID = 1L Logger log = Logger.getLogger(EditMenuUtil. copy() { copY); copy(); FindManagerUI window. ( == findManagerUI = findManagerUI.setEditMenuUtil(EditMenuUtil. } findManagerUI.setVisible( findManagerUI.setFocusable( JOptionPane.showMessageDialog(EditMenuUtil.informatION_MESSAGE); } (findWhat.length() > } String content = String temp = position = textArea.getSelectionEnd() - findWhat.length() + 1 (position > content.length() - (; position <= content.length() - findWhat.length(); position++ temp = content.substring(position,position + setTextAreaSelection(position,position + } (position >= content.length() - } noreCase(findWhat)) { setTextAreaSelection(position,position + } (position >= content.length() - } { ( != textArea.getSelectedText() && ! position = (position < canNotFindKeyWordOperation(0,0 (; position - findWhat.length() >= 0; position-- temp = content.substring(position - (FindManagerUI.isCaseSensitive) { setTextAreaSelection(position - } (position - findWhat.length() == 0 canNotFindKeyWordOperation(0,0 } noreCase(findWhat)) { setTextAreaSelection(position - } (position - findWhat.length() == 0 canNotFindKeyWordOperation(0,0 canNotFindKeyWordOperation( start, JOptionPane.showMessageDialog(,Common.CAN_NOT_FIND +informatION_MESSAGE); setTextAreaSelection( start, ReplaceManagerUI window. ( == replaceeManagerUI = replaceeManagerUI.setEditMenuUtil(EditMenuUtil. } replaceeManagerUI.setVisible( replaceeManagerUI.setFocusable( replaceOperation method can NOT be called when
null == textArea.getSelectedText();
Or
Common.EMPTY.equals(textArea.getSelectedText().trim());
FindManagerUI.isForward = ( != textArea.getSelectedText() && ! information window will display after replacing all words.
Finally,the application will set
ReplaceManagerUI.replaceCount = 0; String replaceWord = String content = ( i = 0; i <= content.length() - findWhat.length(); i++ temp = content.substring(i,i + } noreCase(findWhat)) { JOptionPane.showMessageDialog(,ReplaceManagerUI.replaceCount +informatION_MESSAGE); ReplaceManagerUI.replaceCount = 0 replaceRangeOperation(String findWhat,String replaceWord, ReplaceManagerUI.replaceCount++ textArea.setSelectionEnd(i + distoryFindManagerUI() { ( != findManagerUI = distoryReplaceeManagerUI() { ( != replaceeManagerUI = }

FileMenuUtil serialVersionUID = 1L Logger log = Logger.getLogger(FileMenuUtil. setVisible(false)
save(), nothing to do and return aram (! } } } aram option = (option == } (option == } (option == textArea.setFocusable( display.
nothing to do and return to textArea.
aram noperation() (! noperation(mainUI); } } noperation(mainUI); } option = JOptionPane.showConfirmDialog(FileMenuUtil. (option == noperation(mainUI); } (option == noperation(mainUI); } (option == textArea.setFocusable( aram open() noperation(MainUI mainUI) { JFileChooser chooser = filter = ret = chooser.showOpenDialog( (ret == path = String name = BufferedReader reader = BufferedReader( InputStreamReader( StringBuffer buffer = String line = ((line = reader.readLine()) != mainUI.setTitle(name + savedText = mainUI.setSaved( filePath = } printstacktrace(); display.
save() method to save content.
aram ( != filePath && ! OutputStreamWriter out = OutputStreamWriter( mainUI.setSaved( savedText = } FileDialog fileDialog = fileDialog.setVisible( (fileDialog.getDirectory() != && fileDialog.getFile() != String fileName = (!noreCase(NotepadUtil.getPostfix(fileName))) { fileName = fileName + Common.POINT + String path = fileDialog.getDirectory() + OutputStreamWriter out = OutputStreamWriter( mainUI.setTitle(fileName + filePath = mainUI.setSaved( savedText = } String path = filePath = filePath = (!Common.EMPTY.equals(filePath) && File file = JOptionPane.showMessageDialog(FileMenuUtil.informatION_MESSAGE); } (! } } } option = JOptionPane.showConfirmDialog(FileMenuUtil. (option == } (option == } (option == textArea.setFocusable( mainUI.setTitle(Common.UNTITLE + filePath = savedText = mainUI.setSaved( }

FormatMenuUtil serialVersionUID = 1L Logger log = Logger.getLogger(FormatMenuUtil. textArea.setLineWrap( lineWrap = } textArea.setLineWrap( lineWrap = fontNum = FontManagerUI.FONT_TYPE = fontSizeNum = FontManagerUI.FONT_SIZE = FontManagerUI.FONT_STYPLE = fontStyleNum = textArea.setFont( ( == fontManagerUI = fontManagerUI.setFormatMenuUtil(FormatMenuUtil. } fontManagerUI.setVisible( fontManagerUI.setFocusable( ( == fontSizeManagerUI = fontSizeManagerUI.setFormatMenuUtil(FormatMenuUtil. } fontSizeManagerUI.setVisible( fontSizeManagerUI.setFocusable( ( == fontStyleManagerUI = fontStyleManagerUI.setFormatMenuUtil(FormatMenuUtil. } fontStyleManagerUI.setVisible( fontStyleManagerUI.setFocusable( distoryFontManagerUI() { ( != fontManagerUI = distoryFontSizeManagerUI() { ( != fontSizeManagerUI = distoryFontStyleManagerUI() { ( != fontSizeManagerUI = }

HelpMenuUtil serialVersionUID = 1L Logger log = Logger.getLogger(HelpMenuUtil. ( == aboutUI = aboutUI.setHelpMenuUtil(HelpMenuUtil. } aboutUI.setVisible( aboutUI.setFocusable( distoryAboutUI() { ( != aboutUI = }

Logger log = Logger.getLogger(NotepadUtil. stem_EXIT); System.exit(0 ( == url || Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + } printstacktrace(); SimpleDateFormat sdf = Date date = String timeDate = aram (path == || path.substring(path.lastIndexOf(Common.POINT) + 1 "" + "File Name : " + file.getName() + "
" + "File Type : "+ getPostfix(file.getAbsolutePath()) +" file
" + "File Size : " + file.length()/1024 +" KB
" + "Modify Date : " + SimpleDateFormat().format(file.lastModified()) + "
" + "Location : " + file.getParent() + "
" + "CanRead : " + file.canRead() + "
" + "CanWrite : " + file.canWrite() + "" }

ViewMenuUtil serialVersionUID = 1L Logger log = Logger.getLogger(ViewMenuUtil. ( == skinManagerUI = skinManagerUI.setViewMenuUtil(ViewMenuUtil. } skinManagerUI.setVisible( skinManagerUI.setFocusable( distorySkinManagerUI() { ( != skinManagerUI = }

log4j.appender.stdout= log4j.appender.stdout.Target=stem.out log4j.appender.stdout.layout= log4j.appender.stdout.layout.ConversionPattern=[Notepad] %d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c:%L - %m% log4j.appender.notepad= log4j.appender.notepad.File=C:\\log4j\\log4j- log4j.appender.notepad.DatePattern='_'yyyy-MM-dd'.log' log4j.appender.notepad.layout= log4j.appender.notepad.layout.ConversionPattern=[Notepad] %d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c:%L - %m% log4j.rootLogger=debug,stdout,notepad

4.0.0 com.b510.notepad notepad 1.0 jar notepad http://maven.apache.org .sourceEncodingUTF-8.sourceEncoding junit junit 4.10 copetestcope log4j log4j 1.2.16 org.jvnet.substance substance 1.0

=================================================More information About Notepad:================================================= Author : E-mail : hongtenzone@foxmail.com Home Page : Notepad Page : Notepad Skin Page : Windows Notepad :

=================================================Download:=================================================

Source Code Download : 

    

http://pan.baidu.com/s/1o6wU49k

Notepad API : 

http://pan.baidu.com/s/1o6wU49k

Notepad_1.1 :  Updating My Notepad_1.1

========================================================

More reading,and english is important.

I'm Hongten

大哥哥大姐姐,觉得有用打赏点哦!多多少少没关系,一分也是对我的支持和鼓励。谢谢。Hongten博客排名在100名以内。粉丝过千。Hongten出品,必是精品。

E | hongtenzone@foxmail.com  B | 

========================================================

相关文章

Java中的String是不可变对象 在面向对象及函数编程语言中,不...
String, StringBuffer 和 StringBuilder 可变性 String不可变...
序列化:把对象转换为字节序列的过程称为对象的序列化. 反序...
先说结论,是对象!可以继续往下看 数组是不是对象 什么是对...
为什么浮点数 float 或 double 运算的时候会有精度丢失的风险...
面试题引入 这里引申出一个经典问题,看下面代码 Integer a ...